EarlyBinder nits
This commit is contained in:
parent
b96d9e0e20
commit
5dea1d1c6e
@ -26,11 +26,9 @@ use rustc_hir::intravisit::{walk_generics, Visitor as _};
|
||||
use rustc_hir::{GenericArg, GenericArgs, OpaqueTyOrigin};
|
||||
use rustc_middle::middle::stability::AllowUnstable;
|
||||
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, SubstsRef};
|
||||
use rustc_middle::ty::DynKind;
|
||||
use rustc_middle::ty::GenericParamDefKind;
|
||||
use rustc_middle::ty::{
|
||||
self, Const, DefIdTree, EarlyBinder, IsSuggestable, Ty, TyCtxt, TypeVisitable,
|
||||
};
|
||||
use rustc_middle::ty::{self, Const, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeVisitable};
|
||||
use rustc_middle::ty::{DynKind, EarlyBinder};
|
||||
use rustc_session::lint::builtin::{AMBIGUOUS_ASSOCIATED_ITEMS, BARE_TRAIT_OBJECTS};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::lev_distance::find_best_match_for_name;
|
||||
@ -490,7 +488,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
self.astconv
|
||||
.normalize_ty(
|
||||
self.span,
|
||||
EarlyBinder(tcx.at(self.span).type_of(param.def_id))
|
||||
tcx.at(self.span)
|
||||
.bound_type_of(param.def_id)
|
||||
.subst(tcx, substs),
|
||||
)
|
||||
.into()
|
||||
@ -1258,10 +1257,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
item_segment: &hir::PathSegment<'_>,
|
||||
) -> Ty<'tcx> {
|
||||
let substs = self.ast_path_substs_for_ty(span, did, item_segment);
|
||||
self.normalize_ty(
|
||||
span,
|
||||
EarlyBinder(self.tcx().at(span).type_of(did)).subst(self.tcx(), substs),
|
||||
)
|
||||
self.normalize_ty(span, self.tcx().at(span).bound_type_of(did).subst(self.tcx(), substs))
|
||||
}
|
||||
|
||||
fn conv_object_ty_poly_trait_ref(
|
||||
|
@ -336,6 +336,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// Basically whenever we are converting from a type scheme into
|
||||
/// the fn body space, we always want to normalize associated
|
||||
/// types as well. This function combines the two.
|
||||
// FIXME(compiler-errors): Remove this.
|
||||
fn instantiate_type_scheme<T>(&self, span: Span, substs: SubstsRef<'tcx>, value: T) -> T
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
|
@ -5,7 +5,7 @@ use crate::infer::{GenericKind, VerifyBound};
|
||||
use rustc_data_structures::sso::SsoHashSet;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::GenericArg;
|
||||
use rustc_middle::ty::{self, EarlyBinder, OutlivesPredicate, SubstsRef, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, OutlivesPredicate, SubstsRef, Ty, TyCtxt};
|
||||
|
||||
use smallvec::smallvec;
|
||||
|
||||
@ -304,14 +304,13 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> impl Iterator<Item = ty::Region<'tcx>> {
|
||||
let tcx = self.tcx;
|
||||
let bounds = tcx.item_bounds(def_id);
|
||||
trace!("{:#?}", bounds);
|
||||
let bounds = tcx.bound_item_bounds(def_id);
|
||||
trace!("{:#?}", bounds.0);
|
||||
bounds
|
||||
.into_iter()
|
||||
.subst_iter(tcx, substs)
|
||||
.filter_map(|p| p.to_opt_type_outlives())
|
||||
.filter_map(|p| p.no_bound_vars())
|
||||
.map(|b| b.1)
|
||||
.map(move |r| EarlyBinder(r).subst(tcx, substs))
|
||||
.map(|OutlivesPredicate(_, r)| r)
|
||||
}
|
||||
|
||||
/// Searches through a predicate list for a predicate `T: 'a`.
|
||||
|
@ -4,9 +4,10 @@ use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use crate::mir;
|
||||
use crate::ty::layout::IntegerExt;
|
||||
use crate::ty::{
|
||||
self, DefIdTree, FallibleTypeFolder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
TypeVisitable,
|
||||
self, DefIdTree, FallibleTypeFolder, Ty, TyCtxt, TypeFoldable, TypeFolder,
|
||||
TypeSuperFoldable, TypeVisitable,
|
||||
};
|
||||
use crate::ty::query::TyCtxtAt;
|
||||
use crate::ty::{GenericArgKind, SubstsRef};
|
||||
use rustc_apfloat::Float as _;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
@ -770,6 +771,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxtAt<'tcx> {
|
||||
pub fn bound_type_of(self, def_id: DefId) -> ty::EarlyBinder<Ty<'tcx>> {
|
||||
ty::EarlyBinder(self.type_of(def_id))
|
||||
}
|
||||
}
|
||||
|
||||
struct OpaqueTypeExpander<'tcx> {
|
||||
// Contains the DefIds of the opaque types that are currently being
|
||||
// expanded. When we expand an opaque type we insert the DefId of
|
||||
|
Loading…
x
Reference in New Issue
Block a user