Add bound_type_of

This commit is contained in:
Jack Huey
2022-05-08 15:12:56 -04:00
parent 319575ae8c
commit c92248ab9f
30 changed files with 90 additions and 83 deletions

View File

@@ -10,7 +10,7 @@ use crate::ty::codec::{TyDecoder, TyEncoder};
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeVisitor};
use crate::ty::print::{FmtPrinter, Printer};
use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
use crate::ty::{self, EarlyBinder, List, Ty, TyCtxt};
use crate::ty::{self, List, Ty, TyCtxt};
use crate::ty::{AdtDef, InstanceDef, Region, ScalarInt, UserTypeAnnotationIndex};
use rustc_errors::ErrorGuaranteed;
@@ -2387,7 +2387,7 @@ impl<'tcx> Operand<'tcx> {
substs: SubstsRef<'tcx>,
span: Span,
) -> Self {
let ty = EarlyBinder(tcx.type_of(def_id)).subst(tcx, substs);
let ty = tcx.bound_type_of(def_id).subst(tcx, substs);
Operand::Constant(Box::new(Constant {
span,
user_ty: None,

View File

@@ -5,7 +5,7 @@
use crate::mir::*;
use crate::ty::subst::Subst;
use crate::ty::{self, EarlyBinder, Ty, TyCtxt};
use crate::ty::{self, Ty, TyCtxt};
use rustc_hir as hir;
use rustc_target::abi::VariantIdx;
@@ -203,7 +203,7 @@ impl<'tcx> Rvalue<'tcx> {
AggregateKind::Array(ty) => tcx.mk_array(ty, ops.len() as u64),
AggregateKind::Tuple => tcx.mk_tup(ops.iter().map(|op| op.ty(local_decls, tcx))),
AggregateKind::Adt(did, _, substs, _, _) => {
EarlyBinder(tcx.type_of(did)).subst(tcx, substs)
tcx.bound_type_of(did).subst(tcx, substs)
}
AggregateKind::Closure(did, substs) => tcx.mk_closure(did, substs),
AggregateKind::Generator(did, substs, movability) => {