Skip to content

Commit c9ca4f8

Browse files
committed
Implement pin-project in pattern matching for &pin mut|const T
1 parent 49e5e4e commit c9ca4f8

File tree

72 files changed

+2092
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2092
-129
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ fn suggest_ampmut<'tcx>(
15881588
} else {
15891589
// otherwise, suggest that the user annotates the binding; we provide the
15901590
// type of the local.
1591-
let ty = decl_ty.builtin_deref(true).unwrap();
1591+
let ty = decl_ty.builtin_deref(true, tcx).unwrap();
15921592

15931593
Some(AmpMutSugg {
15941594
has_sugg: false,

compiler/rustc_borrowck/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
24722472

24732473
// Check the kind of deref to decide
24742474
match base_ty.kind() {
2475-
ty::Ref(_, _, mutbl) => {
2475+
_ if let Some((_, _, _, mutbl)) =
2476+
base_ty.is_ref_or_pin_ref(self.infcx.tcx) =>
2477+
{
2478+
// FIXME(pin_ergonomics): handle `&pin mut|const T`
24762479
match mutbl {
24772480
// Shared borrowed data is never mutable
24782481
hir::Mutability::Not => Err(place),

compiler/rustc_borrowck/src/type_check/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
17611761
} else if let Some(static_def_id) = constant.check_static_ptr(tcx) {
17621762
let unnormalized_ty = tcx.type_of(static_def_id).instantiate_identity();
17631763
let normalized_ty = self.normalize(unnormalized_ty, locations);
1764-
let literal_ty = constant.const_.ty().builtin_deref(true).unwrap();
1764+
let literal_ty = constant.const_.ty().builtin_deref(true, tcx).unwrap();
17651765

17661766
if let Err(terr) =
17671767
self.eq_types(literal_ty, normalized_ty, locations, ConstraintCategory::Boring)
@@ -2360,7 +2360,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
23602360

23612361
debug!("add_reborrow_constraint - base_ty = {:?}", base_ty);
23622362
match base_ty.kind() {
2363-
ty::Ref(ref_region, _, mutbl) => {
2363+
_ if let Some((ref_region, _, _, mutbl)) =
2364+
base_ty.is_ref_or_pin_ref(tcx) =>
2365+
{
2366+
// FIXME(pin_ergonomics): handle `&pin mut|const T`
23642367
constraints.outlives_constraints.push(OutlivesConstraint {
23652368
sup: ref_region.as_var(),
23662369
sub: borrow_region.as_var(),

compiler/rustc_codegen_cranelift/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ fn codegen_stmt<'tcx>(
729729
let to_ty = fx.monomorphize(to_ty);
730730

731731
fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
732-
ty.builtin_deref(true).is_some_and(|pointee_ty| {
732+
ty.builtin_deref(true, fx.tcx).is_some_and(|pointee_ty| {
733733
fx.tcx
734734
.type_has_metadata(pointee_ty, ty::TypingEnv::fully_monomorphized())
735735
})

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
583583
intrinsic_args!(fx, args => (base, offset); intrinsic);
584584
let offset = offset.load_scalar(fx);
585585

586-
let pointee_ty = base.layout().ty.builtin_deref(true).unwrap();
586+
let pointee_ty = base.layout().ty.builtin_deref(true, fx.tcx).unwrap();
587587
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
588588
let ptr_diff = if pointee_size != 1 {
589589
fx.bcx.ins().imul_imm(offset, pointee_size as i64)
@@ -609,7 +609,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
609609
let val = val.load_scalar(fx);
610610
let count = count.load_scalar(fx);
611611

612-
let pointee_ty = dst.layout().ty.builtin_deref(true).unwrap();
612+
let pointee_ty = dst.layout().ty.builtin_deref(true, fx.tcx).unwrap();
613613
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
614614
let count = if pointee_size != 1 {
615615
fx.bcx.ins().imul_imm(count, pointee_size as i64)
@@ -717,7 +717,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
717717

718718
// Cranelift treats loads as volatile by default
719719
// FIXME correctly handle unaligned_volatile_load
720-
let inner_layout = fx.layout_of(ptr.layout().ty.builtin_deref(true).unwrap());
720+
let inner_layout = fx.layout_of(ptr.layout().ty.builtin_deref(true, fx.tcx).unwrap());
721721
let val = CValue::by_ref(Pointer::new(ptr.load_scalar(fx)), inner_layout);
722722
ret.write_cvalue(fx, val);
723723
}

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
897897
intrinsic_args!(fx, args => (ptr, offset); intrinsic);
898898

899899
let (lane_count, ptr_lane_ty) = ptr.layout().ty.simd_size_and_type(fx.tcx);
900-
let pointee_ty = ptr_lane_ty.builtin_deref(true).unwrap();
900+
let pointee_ty = ptr_lane_ty.builtin_deref(true, fx.tcx).unwrap();
901901
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
902902
let (ret_lane_count, ret_lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
903903
let ret_lane_layout = fx.layout_of(ret_lane_ty);

compiler/rustc_codegen_cranelift/src/num.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
398398
let is_thin_ptr = in_lhs
399399
.layout()
400400
.ty
401-
.builtin_deref(true)
401+
.builtin_deref(true, fx.tcx)
402402
.map(|ty| !fx.tcx.type_has_metadata(ty, ty::TypingEnv::fully_monomorphized()))
403403
.unwrap_or(true);
404404

@@ -411,7 +411,7 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
411411
codegen_compare_bin_op(fx, bin_op, false, lhs, rhs)
412412
}
413413
BinOp::Offset => {
414-
let pointee_ty = in_lhs.layout().ty.builtin_deref(true).unwrap();
414+
let pointee_ty = in_lhs.layout().ty.builtin_deref(true, fx.tcx).unwrap();
415415
let (base, offset) = (in_lhs, in_rhs.load_scalar(fx));
416416
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
417417
let ptr_diff = fx.bcx.ins().imul_imm(offset, pointee_size as i64);

compiler/rustc_codegen_cranelift/src/unsize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub(crate) fn coerce_unsized_into<'tcx>(
138138
let dst_ty = dst.layout().ty;
139139
let mut coerce_ptr = || {
140140
let (base, info) =
141-
if fx.layout_of(src.layout().ty.builtin_deref(true).unwrap()).is_unsized() {
141+
if fx.layout_of(src.layout().ty.builtin_deref(true, fx.tcx).unwrap()).is_unsized() {
142142
let (old_base, old_info) = src.load_scalar_pair(fx);
143143
unsize_ptr(fx, old_base, src.layout(), dst.layout(), Some(old_info))
144144
} else {

compiler/rustc_codegen_cranelift/src/value_and_place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ impl<'tcx> CPlace<'tcx> {
831831
}
832832

833833
pub(crate) fn place_deref(self, fx: &mut FunctionCx<'_, '_, 'tcx>) -> CPlace<'tcx> {
834-
let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true).unwrap());
834+
let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true, fx.tcx).unwrap());
835835
if fx.tcx.type_has_metadata(inner_layout.ty, ty::TypingEnv::fully_monomorphized()) {
836836
let (addr, extra) = self.to_cvalue(fx).load_scalar_pair(fx);
837837
CPlace::for_ptr_with_extra(Pointer::new(addr), extra, inner_layout)

compiler/rustc_codegen_cranelift/src/vtable.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
5959

6060
if let ty::Ref(_, ty, _) = arg.layout().ty.kind() {
6161
if ty.is_dyn_star() {
62-
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap());
62+
let inner_layout =
63+
fx.layout_of(arg.layout().ty.builtin_deref(true, fx.tcx).unwrap());
6364
let dyn_star = CPlace::for_ptr(Pointer::new(arg.load_scalar(fx)), inner_layout);
6465
let ptr = dyn_star.place_field(fx, FieldIdx::ZERO).to_ptr();
6566
let vtable =

compiler/rustc_codegen_llvm/src/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
626626
let element_type_index = unsafe { llvm::LLVMRustGetElementTypeArgIndex(callsite) };
627627
if element_type_index >= 0 {
628628
let arg_ty = self.args[element_type_index as usize].layout.ty;
629-
let pointee_ty = arg_ty.builtin_deref(true).expect("Must be pointer argument");
629+
let pointee_ty = arg_ty.builtin_deref(true, bx.tcx).expect("Must be pointer argument");
630630
let element_type_attr = unsafe {
631631
llvm::LLVMRustCreateElementTypeAttr(bx.llcx, bx.layout_of(pointee_ty).llvm_type(bx))
632632
};

compiler/rustc_codegen_llvm/src/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
25322532

25332533
if name == sym::simd_arith_offset {
25342534
// This also checks that the first operand is a ptr type.
2535-
let pointee = in_elem.builtin_deref(true).unwrap_or_else(|| {
2535+
let pointee = in_elem.builtin_deref(true, bx.tcx).unwrap_or_else(|| {
25362536
span_bug!(span, "must be called with a vector of pointer types as first argument")
25372537
});
25382538
let layout = bx.layout_of(pointee);

compiler/rustc_codegen_ssa/src/mir/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11061106

11071107
// Make sure that we've actually unwrapped the rcvr down
11081108
// to a pointer or ref to `dyn* Trait`.
1109-
if !op.layout.ty.builtin_deref(true).unwrap().is_dyn_star() {
1109+
if !op.layout.ty.builtin_deref(true, bx.tcx()).unwrap().is_dyn_star() {
11101110
span_bug!(span, "can't codegen a virtual call on {:#?}", op);
11111111
}
11121112
let place = op.deref(bx.cx());

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> DebugInfoOffsetLocation<'tcx, Bx>
130130
{
131131
fn deref(&self, bx: &mut Bx) -> Self {
132132
bx.cx().layout_of(
133-
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)),
133+
self.ty
134+
.builtin_deref(true, bx.tcx())
135+
.unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)),
134136
)
135137
}
136138

compiler/rustc_codegen_ssa/src/mir/operand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
291291
let projected_ty = self
292292
.layout
293293
.ty
294-
.builtin_deref(true)
294+
.builtin_deref(true, cx.tcx())
295295
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", self));
296296

297297
let layout = cx.layout_of(projected_ty);
@@ -701,7 +701,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
701701
let unsized_ty = indirect_dest
702702
.layout
703703
.ty
704-
.builtin_deref(true)
704+
.builtin_deref(true, bx.tcx())
705705
.unwrap_or_else(|| bug!("indirect_dest has non-pointer type: {:?}", indirect_dest));
706706

707707
let OperandValue::Ref(PlaceValue { llval: llptr, llextra: Some(llextra), .. }) = self

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
966966
mir::BinOp::BitXor => bx.xor(lhs, rhs),
967967
mir::BinOp::Offset => {
968968
let pointee_type = lhs_ty
969-
.builtin_deref(true)
969+
.builtin_deref(true, bx.tcx())
970970
.unwrap_or_else(|| bug!("deref of non-pointer {:?}", lhs_ty));
971971
let pointee_layout = bx.cx().layout_of(pointee_type);
972972
if pointee_layout.is_zst() {

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub(super) fn op_to_const<'tcx>(
216216
// This codepath solely exists for `valtree_to_const_value` to not need to generate
217217
// a `ConstValue::Indirect` for wide references, so it is tightly restricted to just
218218
// that case.
219-
let pointee_ty = imm.layout.ty.builtin_deref(false).unwrap(); // `false` = no raw ptrs
219+
let pointee_ty = imm.layout.ty.builtin_deref(false, *ecx.tcx).unwrap(); // `false` = no raw ptrs
220220
debug_assert!(
221221
matches!(
222222
ecx.tcx.struct_tail_for_codegen(pointee_ty, ecx.typing_env()).kind(),

compiler/rustc_const_eval/src/interpret/intrinsics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
636636
nonoverlapping: bool,
637637
) -> InterpResult<'tcx> {
638638
let count = self.read_target_usize(count)?;
639-
let layout = self.layout_of(src.layout.ty.builtin_deref(true).unwrap())?;
639+
let layout = self.layout_of(src.layout.ty.builtin_deref(true, *self.tcx).unwrap())?;
640640
let (size, align) = (layout.size, layout.align.abi);
641641

642642
let size = self.compute_size_in_bytes(size, count).ok_or_else(|| {
@@ -696,7 +696,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
696696
count: &OpTy<'tcx, <M as Machine<'tcx>>::Provenance>,
697697
name: &'static str,
698698
) -> InterpResult<'tcx> {
699-
let layout = self.layout_of(dst.layout.ty.builtin_deref(true).unwrap())?;
699+
let layout = self.layout_of(dst.layout.ty.builtin_deref(true, *self.tcx).unwrap())?;
700700

701701
let dst = self.read_pointer(dst)?;
702702
let byte = self.read_scalar(byte)?.to_u8()?;
@@ -735,7 +735,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
735735
lhs: &OpTy<'tcx, <M as Machine<'tcx>>::Provenance>,
736736
rhs: &OpTy<'tcx, <M as Machine<'tcx>>::Provenance>,
737737
) -> InterpResult<'tcx, Scalar<M::Provenance>> {
738-
let layout = self.layout_of(lhs.layout.ty.builtin_deref(true).unwrap())?;
738+
let layout = self.layout_of(lhs.layout.ty.builtin_deref(true, *self.tcx).unwrap())?;
739739
assert!(layout.is_sized());
740740

741741
let get_bytes = |this: &InterpCx<'tcx, M>,

compiler/rustc_const_eval/src/interpret/operator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
313313
// Pointer ops that are always supported.
314314
Offset => {
315315
let ptr = left.to_scalar().to_pointer(self)?;
316-
let pointee_ty = left.layout.ty.builtin_deref(true).unwrap();
316+
let pointee_ty = left.layout.ty.builtin_deref(true, *self.tcx).unwrap();
317317
let pointee_layout = self.layout_of(pointee_ty)?;
318318
assert!(pointee_layout.is_sized());
319319

compiler/rustc_const_eval/src/interpret/place.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,11 @@ where
419419
&self,
420420
val: &ImmTy<'tcx, M::Provenance>,
421421
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> {
422-
let pointee_type =
423-
val.layout.ty.builtin_deref(true).expect("`ref_to_mplace` called on non-ptr type");
422+
let pointee_type = val
423+
.layout
424+
.ty
425+
.builtin_deref(true, *self.tcx)
426+
.expect("`ref_to_mplace` called on non-ptr type");
424427
let layout = self.layout_of(pointee_type)?;
425428
let (ptr, meta) = val.to_scalar_and_meta();
426429

compiler/rustc_const_eval/src/util/check_validity_requirement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn check_validity_requirement_lax<'tcx>(
126126
}
127127

128128
// Special magic check for references and boxes (i.e., special pointer types).
129-
if let Some(pointee) = this.ty.builtin_deref(false) {
129+
if let Some(pointee) = this.ty.builtin_deref(false, cx.tcx()) {
130130
let pointee = cx.layout_of(pointee)?;
131131
// We need to ensure that the LLVM attributes `aligned` and `dereferenceable(size)` are satisfied.
132132
if pointee.align.abi.bytes() > 1 {

compiler/rustc_hir_analysis/src/autoderef.rs

+21-20
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,28 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
7777
// be better to skip this clause and use the Overloaded case only, since &T
7878
// and &mut T implement Receiver. But built-in derefs apply equally to Receiver
7979
// and Deref, and this has benefits for const and the emitted MIR.
80-
let (kind, new_ty) =
81-
if let Some(ty) = self.state.cur_ty.builtin_deref(self.include_raw_pointers) {
82-
debug_assert_eq!(ty, self.infcx.resolve_vars_if_possible(ty));
83-
// NOTE: we may still need to normalize the built-in deref in case
84-
// we have some type like `&<Ty as Trait>::Assoc`, since users of
85-
// autoderef expect this type to have been structurally normalized.
86-
if self.infcx.next_trait_solver()
87-
&& let ty::Alias(..) = ty.kind()
88-
{
89-
let (normalized_ty, obligations) = self.structurally_normalize_ty(ty)?;
90-
self.state.obligations.extend(obligations);
91-
(AutoderefKind::Builtin, normalized_ty)
92-
} else {
93-
(AutoderefKind::Builtin, ty)
94-
}
95-
} else if let Some(ty) = self.overloaded_deref_ty(self.state.cur_ty) {
96-
// The overloaded deref check already normalizes the pointee type.
97-
(AutoderefKind::Overloaded, ty)
80+
let (kind, new_ty) = if let Some(ty) =
81+
self.state.cur_ty.builtin_deref(self.include_raw_pointers, self.infcx.tcx)
82+
{
83+
debug_assert_eq!(ty, self.infcx.resolve_vars_if_possible(ty));
84+
// NOTE: we may still need to normalize the built-in deref in case
85+
// we have some type like `&<Ty as Trait>::Assoc`, since users of
86+
// autoderef expect this type to have been structurally normalized.
87+
if self.infcx.next_trait_solver()
88+
&& let ty::Alias(..) = ty.kind()
89+
{
90+
let (normalized_ty, obligations) = self.structurally_normalize_ty(ty)?;
91+
self.state.obligations.extend(obligations);
92+
(AutoderefKind::Builtin, normalized_ty)
9893
} else {
99-
return None;
100-
};
94+
(AutoderefKind::Builtin, ty)
95+
}
96+
} else if let Some(ty) = self.overloaded_deref_ty(self.state.cur_ty) {
97+
// The overloaded deref check already normalizes the pointee type.
98+
(AutoderefKind::Overloaded, ty)
99+
} else {
100+
return None;
101+
};
101102

102103
self.state.steps.push((self.state.cur_ty, kind));
103104
debug!(

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ fn check_method_receiver<'tcx>(
18081808
match receiver_validity_err {
18091809
ReceiverValidityError::DoesNotDeref if arbitrary_self_types_level.is_some() => {
18101810
let hint = match receiver_ty
1811-
.builtin_deref(false)
1811+
.builtin_deref(false, tcx)
18121812
.unwrap_or(receiver_ty)
18131813
.ty_adt_def()
18141814
.and_then(|adt_def| tcx.get_diagnostic_name(adt_def.did()))

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
12651265
match self
12661266
.cx
12671267
.try_structurally_resolve_type(pat.span, base_ty)
1268-
.builtin_deref(false)
1268+
.builtin_deref(false, self.cx.tcx())
12691269
{
12701270
Some(ty) => Ok(ty),
12711271
None => {
@@ -1555,7 +1555,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
15551555
let deref_ty = match self
15561556
.cx
15571557
.try_structurally_resolve_type(self.cx.tcx().hir_span(base_place.hir_id), base_curr_ty)
1558-
.builtin_deref(true)
1558+
.builtin_deref(true, self.cx.tcx())
15591559
{
15601560
Some(ty) => ty,
15611561
None => {

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
703703
let ret_ty = method.sig.output();
704704

705705
// method returns &T, but the type as visible to user is T, so deref
706-
ret_ty.builtin_deref(true).unwrap()
706+
ret_ty.builtin_deref(true, self.tcx).unwrap()
707707
}
708708

709709
pub(crate) fn type_var_is_sized(&self, self_ty: ty::TyVid) -> bool {

0 commit comments

Comments
 (0)