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
|
@ -41,7 +41,7 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
|
|||
//
|
||||
// Here we test for this function itself whether its ABI allows
|
||||
// unwinding or not.
|
||||
let body_ty = tcx.bound_type_of(def_id).skip_binder();
|
||||
let body_ty = tcx.type_of(def_id).skip_binder();
|
||||
let body_abi = match body_ty.kind() {
|
||||
ty::FnDef(..) => body_ty.fn_sig(tcx).abi(),
|
||||
ty::Closure(..) => Abi::RustCall,
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
|||
return;
|
||||
}
|
||||
|
||||
let is_generator = tcx.bound_type_of(def_id.to_def_id()).subst_identity().is_generator();
|
||||
let is_generator = tcx.type_of(def_id.to_def_id()).subst_identity().is_generator();
|
||||
// FIXME(welseywiser) const prop doesn't work on generators because of query cycles
|
||||
// computing their layout.
|
||||
if is_generator {
|
||||
|
|
|
@ -57,7 +57,7 @@ impl<'tcx> MirLint<'tcx> for ConstProp {
|
|||
return;
|
||||
}
|
||||
|
||||
let is_generator = tcx.bound_type_of(def_id.to_def_id()).subst_identity().is_generator();
|
||||
let is_generator = tcx.type_of(def_id.to_def_id()).subst_identity().is_generator();
|
||||
// FIXME(welseywiser) const prop doesn't work on generators because of query cycles
|
||||
// computing their layout.
|
||||
if is_generator {
|
||||
|
|
|
@ -163,7 +163,7 @@ pub fn deduced_param_attrs<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Ded
|
|||
|
||||
// Codegen won't use this information for anything if all the function parameters are passed
|
||||
// directly. Detect that and bail, for compilation speed.
|
||||
let fn_ty = tcx.bound_type_of(def_id).subst_identity();
|
||||
let fn_ty = tcx.type_of(def_id).subst_identity();
|
||||
if matches!(fn_ty.kind(), ty::FnDef(..)) {
|
||||
if fn_ty
|
||||
.fn_sig(tcx)
|
||||
|
|
|
@ -18,8 +18,8 @@ pub fn build_ptr_tys<'tcx>(
|
|||
nonnull_did: DefId,
|
||||
) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>) {
|
||||
let substs = tcx.intern_substs(&[pointee.into()]);
|
||||
let unique_ty = tcx.bound_type_of(unique_did).subst(tcx, substs);
|
||||
let nonnull_ty = tcx.bound_type_of(nonnull_did).subst(tcx, substs);
|
||||
let unique_ty = tcx.type_of(unique_did).subst(tcx, substs);
|
||||
let nonnull_ty = tcx.type_of(nonnull_did).subst(tcx, substs);
|
||||
let ptr_ty = tcx.mk_imm_ptr(pointee);
|
||||
|
||||
(unique_ty, nonnull_ty, ptr_ty)
|
||||
|
@ -93,7 +93,7 @@ impl<'tcx> MirPass<'tcx> for ElaborateBoxDerefs {
|
|||
if let Some(def_id) = tcx.lang_items().owned_box() {
|
||||
let unique_did = tcx.adt_def(def_id).non_enum_variant().fields[0].did;
|
||||
|
||||
let Some(nonnull_def) = tcx.bound_type_of(unique_did).subst_identity().ty_adt_def() else {
|
||||
let Some(nonnull_def) = tcx.type_of(unique_did).subst_identity().ty_adt_def() else {
|
||||
span_bug!(tcx.def_span(unique_did), "expected Box to contain Unique")
|
||||
};
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
|||
|
||||
let body = &*tcx.mir_built(ty::WithOptConstParam::unknown(local_def_id)).borrow();
|
||||
|
||||
let body_ty = tcx.bound_type_of(def_id).skip_binder();
|
||||
let body_ty = tcx.type_of(def_id).skip_binder();
|
||||
let body_abi = match body_ty.kind() {
|
||||
ty::FnDef(..) => body_ty.fn_sig(tcx).abi(),
|
||||
ty::Closure(..) => Abi::RustCall,
|
||||
|
|
|
@ -900,7 +900,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
|
|||
|
||||
let kind = match parent_ty.ty.kind() {
|
||||
&ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
|
||||
self.tcx.bound_type_of(def_id).subst(self.tcx, substs).kind()
|
||||
self.tcx.type_of(def_id).subst(self.tcx, substs).kind()
|
||||
}
|
||||
kind => kind,
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ impl<'tcx> MirPass<'tcx> for RemoveZsts {
|
|||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
// Avoid query cycles (generators require optimized MIR for layout).
|
||||
if tcx.bound_type_of(body.source.def_id()).subst_identity().is_generator() {
|
||||
if tcx.type_of(body.source.def_id()).subst_identity().is_generator() {
|
||||
return;
|
||||
}
|
||||
let param_env = tcx.param_env(body.source.def_id());
|
||||
|
|
|
@ -692,7 +692,7 @@ fn build_call_shim<'tcx>(
|
|||
|
||||
// `FnDef` call with optional receiver.
|
||||
CallKind::Direct(def_id) => {
|
||||
let ty = tcx.bound_type_of(def_id).subst_identity();
|
||||
let ty = tcx.type_of(def_id).subst_identity();
|
||||
(
|
||||
Operand::Constant(Box::new(Constant {
|
||||
span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue