Make builtin_deref just return a Ty
This commit is contained in:
parent
8c7c151a7a
commit
d50c2b0a52
43 changed files with 92 additions and 116 deletions
|
@ -1060,7 +1060,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
|
||||
// Make sure that we've actually unwrapped the rcvr down
|
||||
// to a pointer or ref to `dyn* Trait`.
|
||||
if !op.layout.ty.builtin_deref(true).unwrap().ty.is_dyn_star() {
|
||||
if !op.layout.ty.builtin_deref(true).unwrap().is_dyn_star() {
|
||||
span_bug!(span, "can't codegen a virtual call on {:#?}", op);
|
||||
}
|
||||
let place = op.deref(bx.cx());
|
||||
|
|
|
@ -120,7 +120,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> DebugInfoOffsetLocation<'tcx, Bx>
|
|||
{
|
||||
fn deref(&self, bx: &mut Bx) -> Self {
|
||||
bx.cx().layout_of(
|
||||
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)).ty,
|
||||
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -215,8 +215,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
|
|||
.layout
|
||||
.ty
|
||||
.builtin_deref(true)
|
||||
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", self))
|
||||
.ty;
|
||||
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", self));
|
||||
|
||||
let (llptr, llextra) = match self.val {
|
||||
OperandValue::Immediate(llptr) => (llptr, None),
|
||||
|
@ -455,8 +454,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
|
|||
.layout
|
||||
.ty
|
||||
.builtin_deref(true)
|
||||
.unwrap_or_else(|| bug!("indirect_dest has non-pointer type: {:?}", indirect_dest))
|
||||
.ty;
|
||||
.unwrap_or_else(|| bug!("indirect_dest has non-pointer type: {:?}", indirect_dest));
|
||||
|
||||
let OperandValue::Ref(PlaceValue { llval: llptr, llextra: Some(llextra), .. }) = self
|
||||
else {
|
||||
|
|
|
@ -870,8 +870,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
mir::BinOp::Offset => {
|
||||
let pointee_type = input_ty
|
||||
.builtin_deref(true)
|
||||
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", input_ty))
|
||||
.ty;
|
||||
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", input_ty));
|
||||
let pointee_layout = bx.cx().layout_of(pointee_type);
|
||||
if pointee_layout.is_zst() {
|
||||
// `Offset` works in terms of the size of pointee,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue