Skip to content

Commit c92248a

Browse files
committed
Add bound_type_of
1 parent 319575a commit c92248a

File tree

30 files changed

+90
-83
lines changed

30 files changed

+90
-83
lines changed

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ use rustc_index::vec::{Idx, IndexVec};
2323
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
2424
use rustc_middle::ty::fold::TypeFoldable;
2525
use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef};
26-
use rustc_middle::ty::{
27-
self, EarlyBinder, InlineConstSubsts, InlineConstSubstsParts, RegionVid, Ty, TyCtxt,
28-
};
26+
use rustc_middle::ty::{self, InlineConstSubsts, InlineConstSubstsParts, RegionVid, Ty, TyCtxt};
2927
use std::iter;
3028

3129
use crate::nll::ToRegionVid;
@@ -479,7 +477,10 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
479477
.infcx
480478
.tcx
481479
.mk_region(ty::ReVar(self.infcx.next_nll_region_var(FR).to_region_vid()));
482-
let va_list_ty = EarlyBinder(self.infcx.tcx.type_of(va_list_did))
480+
let va_list_ty = self
481+
.infcx
482+
.tcx
483+
.bound_type_of(va_list_did)
483484
.subst(self.infcx.tcx, &[region.into()]);
484485

485486
unnormalized_input_tys = self.infcx.tcx.mk_type_list(

compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_hir::lang_items::LangItem;
55
use rustc_middle::mir::TerminatorKind;
66
use rustc_middle::ty::layout::LayoutOf;
77
use rustc_middle::ty::subst::Subst;
8-
use rustc_middle::ty::EarlyBinder;
98
use rustc_span::{Span, Symbol};
109

1110
use crate::interpret::{
@@ -94,10 +93,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
9493
let col = if loc_details.column { Scalar::from_u32(col) } else { Scalar::from_u32(0) };
9594

9695
// Allocate memory for `CallerLocation` struct.
97-
let loc_ty = EarlyBinder(
98-
self.tcx.type_of(self.tcx.require_lang_item(LangItem::PanicLocation, None)),
99-
)
100-
.subst(*self.tcx, self.tcx.mk_substs([self.tcx.lifetimes.re_erased.into()].iter()));
96+
let loc_ty = self
97+
.tcx
98+
.bound_type_of(self.tcx.require_lang_item(LangItem::PanicLocation, None))
99+
.subst(*self.tcx, self.tcx.mk_substs([self.tcx.lifetimes.re_erased.into()].iter()));
101100
let loc_layout = self.layout_of(loc_ty).unwrap();
102101
// This can fail if rustc runs out of memory right here. Trying to emit an error would be
103102
// pointless, since that would require allocating more memory than a Location.

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
968968
}
969969
}
970970
GenericArgKind::Type(ty) => {
971-
if EarlyBinder(self.tcx.type_of(def_id)).subst(self.tcx, substs) != ty {
971+
if self.tcx.bound_type_of(def_id).subst(self.tcx, substs) != ty {
972972
break;
973973
}
974974
}

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::ty::codec::{TyDecoder, TyEncoder};
1010
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeVisitor};
1111
use crate::ty::print::{FmtPrinter, Printer};
1212
use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
13-
use crate::ty::{self, EarlyBinder, List, Ty, TyCtxt};
13+
use crate::ty::{self, List, Ty, TyCtxt};
1414
use crate::ty::{AdtDef, InstanceDef, Region, ScalarInt, UserTypeAnnotationIndex};
1515

1616
use rustc_errors::ErrorGuaranteed;
@@ -2387,7 +2387,7 @@ impl<'tcx> Operand<'tcx> {
23872387
substs: SubstsRef<'tcx>,
23882388
span: Span,
23892389
) -> Self {
2390-
let ty = EarlyBinder(tcx.type_of(def_id)).subst(tcx, substs);
2390+
let ty = tcx.bound_type_of(def_id).subst(tcx, substs);
23912391
Operand::Constant(Box::new(Constant {
23922392
span,
23932393
user_ty: None,

compiler/rustc_middle/src/mir/tcx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use crate::mir::*;
77
use crate::ty::subst::Subst;
8-
use crate::ty::{self, EarlyBinder, Ty, TyCtxt};
8+
use crate::ty::{self, Ty, TyCtxt};
99
use rustc_hir as hir;
1010
use rustc_target::abi::VariantIdx;
1111

@@ -203,7 +203,7 @@ impl<'tcx> Rvalue<'tcx> {
203203
AggregateKind::Array(ty) => tcx.mk_array(ty, ops.len() as u64),
204204
AggregateKind::Tuple => tcx.mk_tup(ops.iter().map(|op| op.ty(local_decls, tcx))),
205205
AggregateKind::Adt(did, _, substs, _, _) => {
206-
EarlyBinder(tcx.type_of(did)).subst(tcx, substs)
206+
tcx.bound_type_of(did).subst(tcx, substs)
207207
}
208208
AggregateKind::Closure(did, substs) => tcx.mk_closure(did, substs),
209209
AggregateKind::Generator(did, substs, movability) => {

compiler/rustc_middle/src/ty/context.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ use crate::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, Substs
1919
use crate::ty::TyKind::*;
2020
use crate::ty::{
2121
self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig,
22-
ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, EarlyBinder, ExistentialPredicate,
23-
FloatTy, FloatVar, FloatVid, GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid,
24-
List, ParamConst, ParamTy, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy,
25-
Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut,
26-
UintTy,
22+
ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, ExistentialPredicate, FloatTy,
23+
FloatVar, FloatVid, GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid, List,
24+
ParamConst, ParamTy, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy, Region,
25+
RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut, UintTy,
2726
};
2827
use rustc_ast as ast;
2928
use rustc_data_structures::fingerprint::Fingerprint;
@@ -1605,7 +1604,7 @@ impl<'tcx> TyCtxt<'tcx> {
16051604
pub fn caller_location_ty(self) -> Ty<'tcx> {
16061605
self.mk_imm_ref(
16071606
self.lifetimes.re_static,
1608-
EarlyBinder(self.type_of(self.require_lang_item(LangItem::PanicLocation, None)))
1607+
self.bound_type_of(self.require_lang_item(LangItem::PanicLocation, None))
16091608
.subst(self, self.mk_substs([self.lifetimes.re_static.into()].iter())),
16101609
)
16111610
}
@@ -2334,7 +2333,7 @@ impl<'tcx> TyCtxt<'tcx> {
23342333
ty_param.into()
23352334
} else {
23362335
assert!(has_default);
2337-
EarlyBinder(self.type_of(param.def_id)).subst(self, substs).into()
2336+
self.bound_type_of(param.def_id).subst(self, substs).into()
23382337
}
23392338
}
23402339
});

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ impl<'tcx> FieldDef {
19321932
/// Returns the type of this field. The resulting type is not normalized. The `subst` is
19331933
/// typically obtained via the second field of [`TyKind::Adt`].
19341934
pub fn ty(&self, tcx: TyCtxt<'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> {
1935-
EarlyBinder(tcx.type_of(self.did)).subst(tcx, subst)
1935+
tcx.bound_type_of(self.did).subst(tcx, subst)
19361936
}
19371937

19381938
/// Computes the `Ident` of this variant by looking up the `Span`

compiler/rustc_middle/src/ty/print/mod.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,16 @@ pub trait Printer<'tcx>: Sized {
115115

116116
DefPathData::Impl => {
117117
let generics = self.tcx().generics_of(def_id);
118-
let mut self_ty = self.tcx().type_of(def_id);
119-
let mut impl_trait_ref = self.tcx().impl_trait_ref(def_id);
120-
if substs.len() >= generics.count() {
121-
self_ty = EarlyBinder(self_ty).subst(self.tcx(), substs);
122-
impl_trait_ref = EarlyBinder(impl_trait_ref).subst(self.tcx(), substs);
123-
}
118+
let self_ty = self.tcx().bound_type_of(def_id);
119+
let impl_trait_ref = self.tcx().impl_trait_ref(def_id);
120+
let (self_ty, impl_trait_ref) = if substs.len() >= generics.count() {
121+
(
122+
self_ty.subst(self.tcx(), substs),
123+
EarlyBinder(impl_trait_ref).subst(self.tcx(), substs),
124+
)
125+
} else {
126+
(self_ty.0, impl_trait_ref)
127+
};
124128
self.print_impl_path(def_id, substs, self_ty, impl_trait_ref)
125129
}
126130

@@ -203,8 +207,7 @@ pub trait Printer<'tcx>: Sized {
203207
has_default
204208
&& substs[param.index as usize]
205209
== GenericArg::from(
206-
EarlyBinder(self.tcx().type_of(param.def_id))
207-
.subst(self.tcx(), substs),
210+
self.tcx().bound_type_of(param.def_id).subst(self.tcx(), substs),
208211
)
209212
}
210213
ty::GenericParamDefKind::Const { has_default } => {

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use crate::mir::interpret::{get_slice_bytes, ConstValue, GlobalAlloc, Scalar};
88
use crate::ty::error::{ExpectedFound, TypeError};
99
use crate::ty::subst::{GenericArg, GenericArgKind, Subst, SubstsRef};
10-
use crate::ty::{self, EarlyBinder, ImplSubject, Term, Ty, TyCtxt, TypeFoldable};
10+
use crate::ty::{self, ImplSubject, Term, Ty, TyCtxt, TypeFoldable};
1111
use rustc_hir as ast;
1212
use rustc_hir::def_id::DefId;
1313
use rustc_span::DUMMY_SP;
@@ -159,8 +159,8 @@ pub fn relate_substs_with_variances<'tcx, R: TypeRelation<'tcx>>(
159159
let params = iter::zip(a_subst, b_subst).enumerate().map(|(i, (a, b))| {
160160
let variance = variances[i];
161161
let variance_info = if variance == ty::Invariant {
162-
let ty = *cached_ty
163-
.get_or_insert_with(|| EarlyBinder(tcx.type_of(ty_def_id)).subst(tcx, a_subst));
162+
let ty =
163+
*cached_ty.get_or_insert_with(|| tcx.bound_type_of(ty_def_id).subst(tcx, a_subst));
164164
ty::VarianceDiagInfo::Invariant { ty, param_index: i.try_into().unwrap() }
165165
} else {
166166
ty::VarianceDiagInfo::default()

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,7 @@ impl<'tcx> Ty<'tcx> {
23472347
ty::Str | ty::Slice(_) => (tcx.types.usize, false),
23482348
ty::Dynamic(..) => {
23492349
let dyn_metadata = tcx.lang_items().dyn_metadata().unwrap();
2350-
(EarlyBinder(tcx.type_of(dyn_metadata)).subst(tcx, &[tail.into()]), false)
2350+
(tcx.bound_type_of(dyn_metadata).subst(tcx, &[tail.into()]), false)
23512351
},
23522352

23532353
// type parameters only have unit metadata if they're sized, so return true

compiler/rustc_middle/src/ty/util.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ impl<'tcx> TyCtxt<'tcx> {
592592
trace!(?expanded_type);
593593
if visitor.found_recursion { Err(expanded_type) } else { Ok(expanded_type) }
594594
}
595+
596+
pub fn bound_type_of(self, def_id: DefId) -> EarlyBinder<Ty<'tcx>> {
597+
EarlyBinder(self.type_of(def_id))
598+
}
595599
}
596600

597601
struct OpaqueTypeExpander<'tcx> {
@@ -623,8 +627,8 @@ impl<'tcx> OpaqueTypeExpander<'tcx> {
623627
let expanded_ty = match self.expanded_cache.get(&(def_id, substs)) {
624628
Some(expanded_ty) => *expanded_ty,
625629
None => {
626-
let generic_ty = self.tcx.type_of(def_id);
627-
let concrete_ty = EarlyBinder(generic_ty).subst(self.tcx, substs);
630+
let generic_ty = self.tcx.bound_type_of(def_id);
631+
let concrete_ty = generic_ty.subst(self.tcx, substs);
628632
let expanded_ty = self.fold_ty(concrete_ty);
629633
self.expanded_cache.insert((def_id, substs), expanded_ty);
630634
expanded_ty

compiler/rustc_mir_build/src/build/matches/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_middle::mir::*;
1616
use rustc_middle::thir::*;
1717
use rustc_middle::ty::subst::{GenericArg, Subst};
1818
use rustc_middle::ty::util::IntTypeExt;
19-
use rustc_middle::ty::{self, adjustment::PointerCast, EarlyBinder, Ty, TyCtxt};
19+
use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
2020
use rustc_span::def_id::DefId;
2121
use rustc_span::symbol::{sym, Symbol};
2222
use rustc_span::Span;
@@ -834,8 +834,8 @@ fn trait_method<'tcx>(
834834
.find(|item| item.kind == ty::AssocKind::Fn)
835835
.expect("trait method not found");
836836

837-
let method_ty = tcx.type_of(item.def_id);
838-
let method_ty = EarlyBinder(method_ty).subst(tcx, substs);
837+
let method_ty = tcx.bound_type_of(item.def_id);
838+
let method_ty = method_ty.subst(tcx, substs);
839839

840840
ConstantKind::zero_sized(method_ty)
841841
}

compiler/rustc_mir_build/src/build/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::middle::region;
1414
use rustc_middle::mir::*;
1515
use rustc_middle::thir::{BindingMode, Expr, ExprId, LintLevel, PatKind, Thir};
1616
use rustc_middle::ty::subst::Subst;
17-
use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeckResults};
17+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeckResults};
1818
use rustc_span::symbol::sym;
1919
use rustc_span::Span;
2020
use rustc_target::spec::abi::Abi;
@@ -177,8 +177,7 @@ fn mir_build(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> Body<'_
177177
let ty = if fn_sig.c_variadic && index == fn_sig.inputs().len() {
178178
let va_list_did = tcx.require_lang_item(LangItem::VaList, Some(arg.span));
179179

180-
EarlyBinder(tcx.type_of(va_list_did))
181-
.subst(tcx, &[tcx.lifetimes.re_erased.into()])
180+
tcx.bound_type_of(va_list_did).subst(tcx, &[tcx.lifetimes.re_erased.into()])
182181
} else {
183182
fn_sig.inputs()[index]
184183
};

compiler/rustc_mir_transform/src/generator.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
6262
use rustc_middle::mir::*;
6363
use rustc_middle::ty::subst::{Subst, SubstsRef};
6464
use rustc_middle::ty::GeneratorSubsts;
65-
use rustc_middle::ty::{self, AdtDef, EarlyBinder, Ty, TyCtxt};
65+
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
6666
use rustc_mir_dataflow::impls::{
6767
MaybeBorrowedLocals, MaybeLiveLocals, MaybeRequiresStorage, MaybeStorageLive,
6868
};
@@ -245,7 +245,9 @@ impl<'tcx> TransformVisitor<'tcx> {
245245
) -> impl Iterator<Item = Statement<'tcx>> {
246246
let kind = AggregateKind::Adt(self.state_adt_ref.did(), idx, self.state_substs, None, None);
247247
assert_eq!(self.state_adt_ref.variant(idx).fields.len(), 1);
248-
let ty = EarlyBinder(self.tcx.type_of(self.state_adt_ref.variant(idx).fields[0].did))
248+
let ty = self
249+
.tcx
250+
.bound_type_of(self.state_adt_ref.variant(idx).fields[0].did)
249251
.subst(self.tcx, self.state_substs);
250252
expand_aggregate(
251253
Place::return_place(),

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn with_fresh_ty_vars<'cx, 'tcx>(
135135

136136
let header = ty::ImplHeader {
137137
impl_def_id,
138-
self_ty: EarlyBinder(tcx.type_of(impl_def_id)).subst(tcx, impl_substs),
138+
self_ty: tcx.bound_type_of(impl_def_id).subst(tcx, impl_substs),
139139
trait_ref: EarlyBinder(tcx.impl_trait_ref(impl_def_id)).subst(tcx, impl_substs),
140140
predicates: tcx.predicates_of(impl_def_id).instantiate(tcx, impl_substs).predicates,
141141
};

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
515515
}
516516

517517
let substs = substs.super_fold_with(self);
518-
let generic_ty = self.tcx().type_of(def_id);
519-
let concrete_ty = EarlyBinder(generic_ty).subst(self.tcx(), substs);
518+
let generic_ty = self.tcx().bound_type_of(def_id);
519+
let concrete_ty = generic_ty.subst(self.tcx(), substs);
520520
self.depth += 1;
521521
let folded_ty = self.fold_ty(concrete_ty);
522522
self.depth -= 1;

compiler/rustc_trait_selection/src/traits/query/normalize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_infer::traits::Normalized;
1414
use rustc_middle::mir;
1515
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder};
1616
use rustc_middle::ty::subst::Subst;
17-
use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt, TypeVisitor};
17+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
1818

1919
use std::ops::ControlFlow;
2020

@@ -217,8 +217,8 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
217217
self.infcx.report_overflow_error(&obligation, true);
218218
}
219219

220-
let generic_ty = self.tcx().type_of(def_id);
221-
let concrete_ty = EarlyBinder(generic_ty).subst(self.tcx(), substs);
220+
let generic_ty = self.tcx().bound_type_of(def_id);
221+
let concrete_ty = generic_ty.subst(self.tcx(), substs);
222222
self.anon_depth += 1;
223223
if concrete_ty == ty {
224224
bug!(

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10061006
// The last field of the structure has to exist and contain type/const parameters.
10071007
let (tail_field, prefix_fields) =
10081008
def.non_enum_variant().fields.split_last().ok_or(Unimplemented)?;
1009-
let tail_field_ty = tcx.type_of(tail_field.did);
1009+
let tail_field_ty = tcx.bound_type_of(tail_field.did);
10101010

10111011
let mut unsizing_params = GrowableBitSet::new_empty();
1012-
for arg in tail_field_ty.walk() {
1012+
for arg in tail_field_ty.0.walk() {
10131013
if let Some(i) = maybe_unsizing_param_idx(arg) {
10141014
unsizing_params.insert(i);
10151015
}
@@ -1030,8 +1030,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10301030
}
10311031

10321032
// Extract `TailField<T>` and `TailField<U>` from `Struct<T>` and `Struct<U>`.
1033-
let source_tail = EarlyBinder(tail_field_ty).subst(tcx, substs_a);
1034-
let target_tail = EarlyBinder(tail_field_ty).subst(tcx, substs_b);
1033+
let source_tail = tail_field_ty.subst(tcx, substs_a);
1034+
let target_tail = tail_field_ty.subst(tcx, substs_b);
10351035

10361036
// Check that the source struct with the target's
10371037
// unsizing parameters is equal to the target.

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19601960
// We can resolve the `impl Trait` to its concrete type,
19611961
// which enforces a DAG between the functions requiring
19621962
// the auto trait bounds in question.
1963-
t.rebind(vec![EarlyBinder(self.tcx().type_of(def_id)).subst(self.tcx(), substs)])
1963+
t.rebind(vec![self.tcx().bound_type_of(def_id).subst(self.tcx(), substs)])
19641964
}
19651965
}
19661966
}

compiler/rustc_traits/src/chalk/db.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
464464
let trait_item_id = assoc_item.trait_item_def_id.expect("assoc_ty with no trait version");
465465
let bound_vars = bound_vars_for_item(self.interner.tcx, def_id);
466466
let binders = binders_for(self.interner, bound_vars);
467-
let ty = EarlyBinder(self.interner.tcx.type_of(def_id))
467+
let ty = self
468+
.interner
469+
.tcx
470+
.bound_type_of(def_id)
468471
.subst(self.interner.tcx, bound_vars)
469472
.lower_into(self.interner);
470473

compiler/rustc_ty_utils/src/needs_drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn drop_tys_helper<'tcx>(
237237
Ok(Vec::new())
238238
} else {
239239
let field_tys = adt_def.all_fields().map(|field| {
240-
let r = EarlyBinder(tcx.type_of(field.did)).subst(tcx, substs);
240+
let r = tcx.bound_type_of(field.did).subst(tcx, substs);
241241
debug!("drop_tys_helper: Subst into {:?} with {:?} gettng {:?}", field, substs, r);
242242
r
243243
});

compiler/rustc_ty_utils/src/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub fn conservative_is_privately_uninhabited_raw<'tcx>(
444444
// one uninhabited field.
445445
def.variants().iter().all(|var| {
446446
var.fields.iter().any(|field| {
447-
let ty = EarlyBinder(tcx.type_of(field.did)).subst(tcx, substs);
447+
let ty = tcx.bound_type_of(field.did).subst(tcx, substs);
448448
tcx.conservative_is_privately_uninhabited(param_env.and(ty))
449449
})
450450
})

0 commit comments

Comments
 (0)