remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata
This commit is contained in:
parent
d822b97a27
commit
c183110cc2
164 changed files with 325 additions and 380 deletions
|
@ -2592,7 +2592,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
if is_closure {
|
||||
None
|
||||
} else {
|
||||
let ty = self.infcx.tcx.bound_type_of(self.mir_def_id()).subst_identity();
|
||||
let ty = self.infcx.tcx.type_of(self.mir_def_id()).subst_identity();
|
||||
match ty.kind() {
|
||||
ty::FnDef(_, _) | ty::FnPtr(_) => self.annotate_fn_sig(
|
||||
self.mir_def_id(),
|
||||
|
|
|
@ -1185,7 +1185,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
let parent_self_ty =
|
||||
matches!(tcx.def_kind(parent_did), rustc_hir::def::DefKind::Impl { .. })
|
||||
.then_some(parent_did)
|
||||
.and_then(|did| match tcx.bound_type_of(did).subst_identity().kind() {
|
||||
.and_then(|did| match tcx.type_of(did).subst_identity().kind() {
|
||||
ty::Adt(def, ..) => Some(def.did()),
|
||||
_ => None,
|
||||
});
|
||||
|
|
|
@ -575,7 +575,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
|
||||
let mut output_ty = self.regioncx.universal_regions().unnormalized_output_ty;
|
||||
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) = *output_ty.kind() {
|
||||
output_ty = self.infcx.tcx.bound_type_of(def_id).subst_identity()
|
||||
output_ty = self.infcx.tcx.type_of(def_id).subst_identity()
|
||||
};
|
||||
|
||||
debug!("report_fnmut_error: output_ty={:?}", output_ty);
|
||||
|
@ -896,7 +896,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
debug!(?fn_did, ?substs);
|
||||
|
||||
// Only suggest this on function calls, not closures
|
||||
let ty = tcx.bound_type_of(fn_did).subst_identity();
|
||||
let ty = tcx.type_of(fn_did).subst_identity();
|
||||
debug!("ty: {:?}, ty.kind: {:?}", ty, ty.kind());
|
||||
if let ty::Closure(_, _) = ty.kind() {
|
||||
return;
|
||||
|
|
|
@ -849,10 +849,9 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
|||
return None;
|
||||
};
|
||||
|
||||
let found = tcx
|
||||
.any_free_region_meets(&tcx.bound_type_of(region_parent).subst_identity(), |r| {
|
||||
*r == ty::ReEarlyBound(region)
|
||||
});
|
||||
let found = tcx.any_free_region_meets(&tcx.type_of(region_parent).subst_identity(), |r| {
|
||||
*r == ty::ReEarlyBound(region)
|
||||
});
|
||||
|
||||
Some(RegionName {
|
||||
name: self.synthesize_region_name(),
|
||||
|
|
|
@ -402,7 +402,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
|||
);
|
||||
}
|
||||
} else if let Some(static_def_id) = constant.check_static_ptr(tcx) {
|
||||
let unnormalized_ty = tcx.bound_type_of(static_def_id).subst_identity();
|
||||
let unnormalized_ty = tcx.type_of(static_def_id).subst_identity();
|
||||
let normalized_ty = self.cx.normalize(unnormalized_ty, locations);
|
||||
let literal_ty = constant.literal.ty().builtin_deref(true).unwrap().ty;
|
||||
|
||||
|
|
|
@ -482,11 +482,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
);
|
||||
let region =
|
||||
self.infcx.tcx.mk_re_var(self.infcx.next_nll_region_var(FR).to_region_vid());
|
||||
let va_list_ty = self
|
||||
.infcx
|
||||
.tcx
|
||||
.bound_type_of(va_list_did)
|
||||
.subst(self.infcx.tcx, &[region.into()]);
|
||||
let va_list_ty =
|
||||
self.infcx.tcx.type_of(va_list_did).subst(self.infcx.tcx, &[region.into()]);
|
||||
|
||||
unnormalized_input_tys = self.infcx.tcx.mk_type_list(
|
||||
unnormalized_input_tys.iter().copied().chain(iter::once(va_list_ty)),
|
||||
|
@ -529,7 +526,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
match tcx.hir().body_owner_kind(self.mir_def.did) {
|
||||
BodyOwnerKind::Closure | BodyOwnerKind::Fn => {
|
||||
let defining_ty = if self.mir_def.did.to_def_id() == typeck_root_def_id {
|
||||
tcx.bound_type_of(typeck_root_def_id).subst_identity()
|
||||
tcx.type_of(typeck_root_def_id).subst_identity()
|
||||
} else {
|
||||
let tables = tcx.typeck(self.mir_def.did);
|
||||
tables.node_type(self.mir_hir_id)
|
||||
|
@ -675,7 +672,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
// For a constant body, there are no inputs, and one
|
||||
// "output" (the type of the constant).
|
||||
assert_eq!(self.mir_def.did.to_def_id(), def_id);
|
||||
let ty = tcx.bound_type_of(self.mir_def.def_id_for_type_of()).subst_identity();
|
||||
let ty = tcx.type_of(self.mir_def.def_id_for_type_of()).subst_identity();
|
||||
let ty = indices.fold_to_region_vids(tcx, ty);
|
||||
ty::Binder::dummy(tcx.intern_type_list(&[ty]))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue