Give EarlyBinder a tcx parameter
We are gonna need it to uplift EarlyBinder
This commit is contained in:
parent
bdbbb6c6a7
commit
bbcdb4fd3e
33 changed files with 129 additions and 110 deletions
|
@ -449,7 +449,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
|
||||||
pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
impl_m_def_id: LocalDefId,
|
impl_m_def_id: LocalDefId,
|
||||||
) -> Result<&'tcx DefIdMap<ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed> {
|
) -> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed> {
|
||||||
let impl_m = tcx.opt_associated_item(impl_m_def_id.to_def_id()).unwrap();
|
let impl_m = tcx.opt_associated_item(impl_m_def_id.to_def_id()).unwrap();
|
||||||
let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap();
|
let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap();
|
||||||
let impl_trait_ref =
|
let impl_trait_ref =
|
||||||
|
|
|
@ -1278,7 +1278,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
#[instrument(level = "debug", skip(tcx))]
|
||||||
fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig<'_>> {
|
fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, ty::PolyFnSig<'_>> {
|
||||||
use rustc_hir::Node::*;
|
use rustc_hir::Node::*;
|
||||||
use rustc_hir::*;
|
use rustc_hir::*;
|
||||||
|
|
||||||
|
|
|
@ -82,14 +82,14 @@ fn opaque_type_bounds<'tcx>(
|
||||||
pub(super) fn explicit_item_bounds(
|
pub(super) fn explicit_item_bounds(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
) -> ty::EarlyBinder<&'_ [(ty::Clause<'_>, Span)]> {
|
) -> ty::EarlyBinder<'_, &'_ [(ty::Clause<'_>, Span)]> {
|
||||||
explicit_item_bounds_with_filter(tcx, def_id, PredicateFilter::All)
|
explicit_item_bounds_with_filter(tcx, def_id, PredicateFilter::All)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn explicit_item_super_predicates(
|
pub(super) fn explicit_item_super_predicates(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
) -> ty::EarlyBinder<&'_ [(ty::Clause<'_>, Span)]> {
|
) -> ty::EarlyBinder<'_, &'_ [(ty::Clause<'_>, Span)]> {
|
||||||
explicit_item_bounds_with_filter(tcx, def_id, PredicateFilter::SelfOnly)
|
explicit_item_bounds_with_filter(tcx, def_id, PredicateFilter::SelfOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ pub(super) fn explicit_item_bounds_with_filter(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
filter: PredicateFilter,
|
filter: PredicateFilter,
|
||||||
) -> ty::EarlyBinder<&'_ [(ty::Clause<'_>, Span)]> {
|
) -> ty::EarlyBinder<'_, &'_ [(ty::Clause<'_>, Span)]> {
|
||||||
match tcx.opt_rpitit_info(def_id.to_def_id()) {
|
match tcx.opt_rpitit_info(def_id.to_def_id()) {
|
||||||
// RPITIT's bounds are the same as opaque type bounds, but with
|
// RPITIT's bounds are the same as opaque type bounds, but with
|
||||||
// a projection self type.
|
// a projection self type.
|
||||||
|
@ -166,7 +166,7 @@ pub(super) fn explicit_item_bounds_with_filter(
|
||||||
ty::EarlyBinder::bind(bounds)
|
ty::EarlyBinder::bind(bounds)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn item_bounds(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<ty::Clauses<'_>> {
|
pub(super) fn item_bounds(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<'_, ty::Clauses<'_>> {
|
||||||
tcx.explicit_item_bounds(def_id).map_bound(|bounds| {
|
tcx.explicit_item_bounds(def_id).map_bound(|bounds| {
|
||||||
tcx.mk_clauses_from_iter(util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)))
|
tcx.mk_clauses_from_iter(util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)))
|
||||||
})
|
})
|
||||||
|
@ -175,7 +175,7 @@ pub(super) fn item_bounds(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<ty:
|
||||||
pub(super) fn item_super_predicates(
|
pub(super) fn item_super_predicates(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> ty::EarlyBinder<ty::Clauses<'_>> {
|
) -> ty::EarlyBinder<'_, ty::Clauses<'_>> {
|
||||||
tcx.explicit_item_super_predicates(def_id).map_bound(|bounds| {
|
tcx.explicit_item_super_predicates(def_id).map_bound(|bounds| {
|
||||||
tcx.mk_clauses_from_iter(
|
tcx.mk_clauses_from_iter(
|
||||||
util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)).filter_only_self(),
|
util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)).filter_only_self(),
|
||||||
|
@ -186,7 +186,7 @@ pub(super) fn item_super_predicates(
|
||||||
pub(super) fn item_non_self_assumptions(
|
pub(super) fn item_non_self_assumptions(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> ty::EarlyBinder<ty::Clauses<'_>> {
|
) -> ty::EarlyBinder<'_, ty::Clauses<'_>> {
|
||||||
let all_bounds: FxIndexSet<_> = tcx.item_bounds(def_id).skip_binder().iter().collect();
|
let all_bounds: FxIndexSet<_> = tcx.item_bounds(def_id).skip_binder().iter().collect();
|
||||||
let own_bounds: FxIndexSet<_> =
|
let own_bounds: FxIndexSet<_> =
|
||||||
tcx.item_super_predicates(def_id).skip_binder().iter().collect();
|
tcx.item_super_predicates(def_id).skip_binder().iter().collect();
|
||||||
|
|
|
@ -309,7 +309,7 @@ fn get_path_containing_arg_in_pat<'hir>(
|
||||||
arg_path
|
arg_path
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Ty<'_>> {
|
pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, Ty<'_>> {
|
||||||
use rustc_hir::*;
|
use rustc_hir::*;
|
||||||
use rustc_middle::ty::Ty;
|
use rustc_middle::ty::Ty;
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Ty
|
||||||
pub(super) fn type_of_opaque(
|
pub(super) fn type_of_opaque(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> Result<ty::EarlyBinder<Ty<'_>>, CyclePlaceholder> {
|
) -> Result<ty::EarlyBinder<'_, Ty<'_>>, CyclePlaceholder> {
|
||||||
if let Some(def_id) = def_id.as_local() {
|
if let Some(def_id) = def_id.as_local() {
|
||||||
use rustc_hir::*;
|
use rustc_hir::*;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ use super::utils::*;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ExplicitPredicatesMap<'tcx> {
|
pub struct ExplicitPredicatesMap<'tcx> {
|
||||||
map: FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
|
map: FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> ExplicitPredicatesMap<'tcx> {
|
impl<'tcx> ExplicitPredicatesMap<'tcx> {
|
||||||
|
@ -18,7 +18,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> &ty::EarlyBinder<RequiredPredicates<'tcx>> {
|
) -> &ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>> {
|
||||||
self.map.entry(def_id).or_insert_with(|| {
|
self.map.entry(def_id).or_insert_with(|| {
|
||||||
let predicates = if def_id.is_local() {
|
let predicates = if def_id.is_local() {
|
||||||
tcx.explicit_predicates_of(def_id)
|
tcx.explicit_predicates_of(def_id)
|
||||||
|
|
|
@ -15,7 +15,7 @@ use super::utils::*;
|
||||||
/// now be filled with inferred predicates.
|
/// now be filled with inferred predicates.
|
||||||
pub(super) fn infer_predicates(
|
pub(super) fn infer_predicates(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
) -> FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'_>>> {
|
) -> FxIndexMap<DefId, ty::EarlyBinder<'_, RequiredPredicates<'_>>> {
|
||||||
debug!("infer_predicates");
|
debug!("infer_predicates");
|
||||||
|
|
||||||
let mut explicit_map = ExplicitPredicatesMap::new();
|
let mut explicit_map = ExplicitPredicatesMap::new();
|
||||||
|
@ -101,7 +101,7 @@ fn insert_required_predicates_to_be_wf<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
global_inferred_outlives: &FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
|
global_inferred_outlives: &FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>,
|
||||||
required_predicates: &mut RequiredPredicates<'tcx>,
|
required_predicates: &mut RequiredPredicates<'tcx>,
|
||||||
explicit_map: &mut ExplicitPredicatesMap<'tcx>,
|
explicit_map: &mut ExplicitPredicatesMap<'tcx>,
|
||||||
) {
|
) {
|
||||||
|
@ -322,7 +322,7 @@ fn check_inferred_predicates<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
args: ty::GenericArgsRef<'tcx>,
|
args: ty::GenericArgsRef<'tcx>,
|
||||||
global_inferred_outlives: &FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
|
global_inferred_outlives: &FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>,
|
||||||
required_predicates: &mut RequiredPredicates<'tcx>,
|
required_predicates: &mut RequiredPredicates<'tcx>,
|
||||||
) {
|
) {
|
||||||
// Load the current set of inferred and explicit predicates from `global_inferred_outlives`
|
// Load the current set of inferred and explicit predicates from `global_inferred_outlives`
|
||||||
|
|
|
@ -270,7 +270,7 @@ fn impl_trait_ref_has_enough_non_local_candidates<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
infer_span: Span,
|
infer_span: Span,
|
||||||
trait_def_id: DefId,
|
trait_def_id: DefId,
|
||||||
binder: EarlyBinder<TraitRef<'tcx>>,
|
binder: EarlyBinder<'tcx, TraitRef<'tcx>>,
|
||||||
mut did_has_local_parent: impl FnMut(DefId) -> bool,
|
mut did_has_local_parent: impl FnMut(DefId) -> bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let infcx = tcx
|
let infcx = tcx
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||||
self,
|
self,
|
||||||
index: DefIndex,
|
index: DefIndex,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
) -> ty::EarlyBinder<&'tcx [(ty::Clause<'tcx>, Span)]> {
|
) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
|
||||||
let lazy = self.root.tables.explicit_item_bounds.get(self, index);
|
let lazy = self.root.tables.explicit_item_bounds.get(self, index);
|
||||||
let output = if lazy.is_default() {
|
let output = if lazy.is_default() {
|
||||||
&mut []
|
&mut []
|
||||||
|
@ -1088,7 +1088,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||||
self,
|
self,
|
||||||
index: DefIndex,
|
index: DefIndex,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
) -> ty::EarlyBinder<&'tcx [(ty::Clause<'tcx>, Span)]> {
|
) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
|
||||||
let lazy = self.root.tables.explicit_item_super_predicates.get(self, index);
|
let lazy = self.root.tables.explicit_item_super_predicates.get(self, index);
|
||||||
let output = if lazy.is_default() {
|
let output = if lazy.is_default() {
|
||||||
&mut []
|
&mut []
|
||||||
|
|
|
@ -418,19 +418,19 @@ define_tables! {
|
||||||
// As an optimization, we only store this for trait aliases,
|
// As an optimization, we only store this for trait aliases,
|
||||||
// since it's identical to super_predicates_of for traits.
|
// since it's identical to super_predicates_of for traits.
|
||||||
implied_predicates_of: Table<DefIndex, LazyValue<ty::GenericPredicates<'static>>>,
|
implied_predicates_of: Table<DefIndex, LazyValue<ty::GenericPredicates<'static>>>,
|
||||||
type_of: Table<DefIndex, LazyValue<ty::EarlyBinder<Ty<'static>>>>,
|
type_of: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>,
|
||||||
variances_of: Table<DefIndex, LazyArray<ty::Variance>>,
|
variances_of: Table<DefIndex, LazyArray<ty::Variance>>,
|
||||||
fn_sig: Table<DefIndex, LazyValue<ty::EarlyBinder<ty::PolyFnSig<'static>>>>,
|
fn_sig: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>,
|
||||||
codegen_fn_attrs: Table<DefIndex, LazyValue<CodegenFnAttrs>>,
|
codegen_fn_attrs: Table<DefIndex, LazyValue<CodegenFnAttrs>>,
|
||||||
impl_trait_header: Table<DefIndex, LazyValue<ty::ImplTraitHeader<'static>>>,
|
impl_trait_header: Table<DefIndex, LazyValue<ty::ImplTraitHeader<'static>>>,
|
||||||
const_param_default: Table<DefIndex, LazyValue<ty::EarlyBinder<rustc_middle::ty::Const<'static>>>>,
|
const_param_default: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, rustc_middle::ty::Const<'static>>>>,
|
||||||
object_lifetime_default: Table<DefIndex, LazyValue<ObjectLifetimeDefault>>,
|
object_lifetime_default: Table<DefIndex, LazyValue<ObjectLifetimeDefault>>,
|
||||||
optimized_mir: Table<DefIndex, LazyValue<mir::Body<'static>>>,
|
optimized_mir: Table<DefIndex, LazyValue<mir::Body<'static>>>,
|
||||||
mir_for_ctfe: Table<DefIndex, LazyValue<mir::Body<'static>>>,
|
mir_for_ctfe: Table<DefIndex, LazyValue<mir::Body<'static>>>,
|
||||||
closure_saved_names_of_captured_variables: Table<DefIndex, LazyValue<IndexVec<FieldIdx, Symbol>>>,
|
closure_saved_names_of_captured_variables: Table<DefIndex, LazyValue<IndexVec<FieldIdx, Symbol>>>,
|
||||||
mir_coroutine_witnesses: Table<DefIndex, LazyValue<mir::CoroutineLayout<'static>>>,
|
mir_coroutine_witnesses: Table<DefIndex, LazyValue<mir::CoroutineLayout<'static>>>,
|
||||||
promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
|
promoted_mir: Table<DefIndex, LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
|
||||||
thir_abstract_const: Table<DefIndex, LazyValue<ty::EarlyBinder<ty::Const<'static>>>>,
|
thir_abstract_const: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>>>,
|
||||||
impl_parent: Table<DefIndex, RawDefId>,
|
impl_parent: Table<DefIndex, RawDefId>,
|
||||||
constness: Table<DefIndex, hir::Constness>,
|
constness: Table<DefIndex, hir::Constness>,
|
||||||
defaultness: Table<DefIndex, hir::Defaultness>,
|
defaultness: Table<DefIndex, hir::Defaultness>,
|
||||||
|
@ -459,7 +459,7 @@ define_tables! {
|
||||||
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
|
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
|
||||||
proc_macro: Table<DefIndex, MacroKind>,
|
proc_macro: Table<DefIndex, MacroKind>,
|
||||||
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
|
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
|
||||||
trait_impl_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<Ty<'static>>>>>,
|
trait_impl_trait_tys: Table<DefIndex, LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>,
|
||||||
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
|
doc_link_resolutions: Table<DefIndex, LazyValue<DocLinkResMap>>,
|
||||||
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,
|
doc_link_traits_in_scope: Table<DefIndex, LazyArray<DefId>>,
|
||||||
assumed_wf_types_for_rpitit: Table<DefIndex, LazyArray<(Ty<'static>, Span)>>,
|
assumed_wf_types_for_rpitit: Table<DefIndex, LazyArray<(Ty<'static>, Span)>>,
|
||||||
|
|
|
@ -108,7 +108,7 @@ macro_rules! arena_types {
|
||||||
[decode] trait_impl_trait_tys:
|
[decode] trait_impl_trait_tys:
|
||||||
rustc_data_structures::unord::UnordMap<
|
rustc_data_structures::unord::UnordMap<
|
||||||
rustc_hir::def_id::DefId,
|
rustc_hir::def_id::DefId,
|
||||||
rustc_middle::ty::EarlyBinder<rustc_middle::ty::Ty<'tcx>>
|
rustc_middle::ty::EarlyBinder<'tcx, rustc_middle::ty::Ty<'tcx>>
|
||||||
>,
|
>,
|
||||||
[] external_constraints: rustc_middle::traits::solve::ExternalConstraintsData<'tcx>,
|
[] external_constraints: rustc_middle::traits::solve::ExternalConstraintsData<'tcx>,
|
||||||
[] predefined_opaques_in_body: rustc_middle::traits::solve::PredefinedOpaquesData<'tcx>,
|
[] predefined_opaques_in_body: rustc_middle::traits::solve::PredefinedOpaquesData<'tcx>,
|
||||||
|
|
|
@ -121,7 +121,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
LocalModDefId::new_unchecked(id)
|
LocalModDefId::new_unchecked(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn impl_subject(self, def_id: DefId) -> EarlyBinder<ImplSubject<'tcx>> {
|
pub fn impl_subject(self, def_id: DefId) -> EarlyBinder<'tcx, ImplSubject<'tcx>> {
|
||||||
match self.impl_trait_ref(def_id) {
|
match self.impl_trait_ref(def_id) {
|
||||||
Some(t) => t.map_bound(ImplSubject::Trait),
|
Some(t) => t.map_bound(ImplSubject::Trait),
|
||||||
None => self.type_of(def_id).map_bound(ImplSubject::Inherent),
|
None => self.type_of(def_id).map_bound(ImplSubject::Inherent),
|
||||||
|
|
|
@ -220,7 +220,10 @@ pub enum Const<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Const<'tcx> {
|
impl<'tcx> Const<'tcx> {
|
||||||
pub fn identity_unevaluated(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::EarlyBinder<Const<'tcx>> {
|
pub fn identity_unevaluated(
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
def_id: DefId,
|
||||||
|
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
|
||||||
ty::EarlyBinder::bind(Const::Unevaluated(
|
ty::EarlyBinder::bind(Const::Unevaluated(
|
||||||
UnevaluatedConst {
|
UnevaluatedConst {
|
||||||
def: def_id,
|
def: def_id,
|
||||||
|
|
|
@ -624,7 +624,7 @@ impl<'tcx> Body<'tcx> {
|
||||||
|
|
||||||
/// Returns the return type; it always return first element from `local_decls` array.
|
/// Returns the return type; it always return first element from `local_decls` array.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn bound_return_ty(&self) -> ty::EarlyBinder<Ty<'tcx>> {
|
pub fn bound_return_ty(&self) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
|
||||||
ty::EarlyBinder::bind(self.local_decls[RETURN_PLACE].ty)
|
ty::EarlyBinder::bind(self.local_decls[RETURN_PLACE].ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,11 @@ impl EraseType for Result<CoerceUnsizedInfo, rustc_errors::ErrorGuaranteed> {
|
||||||
type Result = [u8; size_of::<Result<CoerceUnsizedInfo, rustc_errors::ErrorGuaranteed>>()];
|
type Result = [u8; size_of::<Result<CoerceUnsizedInfo, rustc_errors::ErrorGuaranteed>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EraseType for Result<Option<ty::EarlyBinder<ty::Const<'_>>>, rustc_errors::ErrorGuaranteed> {
|
impl EraseType
|
||||||
|
for Result<Option<ty::EarlyBinder<'_, ty::Const<'_>>>, rustc_errors::ErrorGuaranteed>
|
||||||
|
{
|
||||||
type Result = [u8; size_of::<
|
type Result = [u8; size_of::<
|
||||||
Result<Option<ty::EarlyBinder<ty::Const<'static>>>, rustc_errors::ErrorGuaranteed>,
|
Result<Option<ty::EarlyBinder<'static, ty::Const<'static>>>, rustc_errors::ErrorGuaranteed>,
|
||||||
>()];
|
>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,8 +167,8 @@ impl EraseType for Result<&'_ ty::List<Ty<'_>>, ty::util::AlwaysRequiresDrop> {
|
||||||
[u8; size_of::<Result<&'static ty::List<Ty<'static>>, ty::util::AlwaysRequiresDrop>>()];
|
[u8; size_of::<Result<&'static ty::List<Ty<'static>>, ty::util::AlwaysRequiresDrop>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EraseType for Result<ty::EarlyBinder<Ty<'_>>, CyclePlaceholder> {
|
impl EraseType for Result<ty::EarlyBinder<'_, Ty<'_>>, CyclePlaceholder> {
|
||||||
type Result = [u8; size_of::<Result<ty::EarlyBinder<Ty<'_>>, CyclePlaceholder>>()];
|
type Result = [u8; size_of::<Result<ty::EarlyBinder<'static, Ty<'_>>, CyclePlaceholder>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EraseType for Option<&'_ T> {
|
impl<T> EraseType for Option<&'_ T> {
|
||||||
|
@ -185,15 +187,15 @@ impl EraseType for Option<ty::ImplTraitHeader<'_>> {
|
||||||
type Result = [u8; size_of::<Option<ty::ImplTraitHeader<'static>>>()];
|
type Result = [u8; size_of::<Option<ty::ImplTraitHeader<'static>>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EraseType for Option<ty::EarlyBinder<Ty<'_>>> {
|
impl EraseType for Option<ty::EarlyBinder<'_, Ty<'_>>> {
|
||||||
type Result = [u8; size_of::<Option<ty::EarlyBinder<Ty<'static>>>>()];
|
type Result = [u8; size_of::<Option<ty::EarlyBinder<'static, Ty<'static>>>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EraseType for rustc_hir::MaybeOwner<'_> {
|
impl EraseType for rustc_hir::MaybeOwner<'_> {
|
||||||
type Result = [u8; size_of::<rustc_hir::MaybeOwner<'static>>()];
|
type Result = [u8; size_of::<rustc_hir::MaybeOwner<'static>>()];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: EraseType> EraseType for ty::EarlyBinder<T> {
|
impl<T: EraseType> EraseType for ty::EarlyBinder<'_, T> {
|
||||||
type Result = T::Result;
|
type Result = T::Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ rustc_queries! {
|
||||||
|
|
||||||
/// Given the def_id of a const-generic parameter, computes the associated default const
|
/// Given the def_id of a const-generic parameter, computes the associated default const
|
||||||
/// parameter. e.g. `fn example<const N: usize=3>` called on `N` would return `3`.
|
/// parameter. e.g. `fn example<const N: usize=3>` called on `N` would return `3`.
|
||||||
query const_param_default(param: DefId) -> ty::EarlyBinder<ty::Const<'tcx>> {
|
query const_param_default(param: DefId) -> ty::EarlyBinder<'tcx, ty::Const<'tcx>> {
|
||||||
desc { |tcx| "computing const default for a given parameter `{}`", tcx.def_path_str(param) }
|
desc { |tcx| "computing const default for a given parameter `{}`", tcx.def_path_str(param) }
|
||||||
cache_on_disk_if { param.is_local() }
|
cache_on_disk_if { param.is_local() }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
|
@ -219,7 +219,7 @@ rustc_queries! {
|
||||||
/// to an alias, it will "skip" this alias to return the aliased type.
|
/// to an alias, it will "skip" this alias to return the aliased type.
|
||||||
///
|
///
|
||||||
/// [`DefId`]: rustc_hir::def_id::DefId
|
/// [`DefId`]: rustc_hir::def_id::DefId
|
||||||
query type_of(key: DefId) -> ty::EarlyBinder<Ty<'tcx>> {
|
query type_of(key: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
|
||||||
desc { |tcx|
|
desc { |tcx|
|
||||||
"{action} `{path}`",
|
"{action} `{path}`",
|
||||||
action = {
|
action = {
|
||||||
|
@ -240,7 +240,7 @@ rustc_queries! {
|
||||||
/// Specialized instance of `type_of` that detects cycles that are due to
|
/// Specialized instance of `type_of` that detects cycles that are due to
|
||||||
/// revealing opaque because of an auto trait bound. Unless `CyclePlaceholder` needs
|
/// revealing opaque because of an auto trait bound. Unless `CyclePlaceholder` needs
|
||||||
/// to be handled separately, call `type_of` instead.
|
/// to be handled separately, call `type_of` instead.
|
||||||
query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<Ty<'tcx>>, CyclePlaceholder> {
|
query type_of_opaque(key: DefId) -> Result<ty::EarlyBinder<'tcx, Ty<'tcx>>, CyclePlaceholder> {
|
||||||
desc { |tcx|
|
desc { |tcx|
|
||||||
"computing type of opaque `{path}`",
|
"computing type of opaque `{path}`",
|
||||||
path = tcx.def_path_str(key),
|
path = tcx.def_path_str(key),
|
||||||
|
@ -257,7 +257,7 @@ rustc_queries! {
|
||||||
}
|
}
|
||||||
|
|
||||||
query collect_return_position_impl_trait_in_trait_tys(key: DefId)
|
query collect_return_position_impl_trait_in_trait_tys(key: DefId)
|
||||||
-> Result<&'tcx DefIdMap<ty::EarlyBinder<Ty<'tcx>>>, ErrorGuaranteed>
|
-> Result<&'tcx DefIdMap<ty::EarlyBinder<'tcx, Ty<'tcx>>>, ErrorGuaranteed>
|
||||||
{
|
{
|
||||||
desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
|
desc { "comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process" }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { key.is_local() }
|
||||||
|
@ -363,7 +363,7 @@ rustc_queries! {
|
||||||
/// `key` is the `DefId` of the associated type or opaque type.
|
/// `key` is the `DefId` of the associated type or opaque type.
|
||||||
///
|
///
|
||||||
/// Bounds from the parent (e.g. with nested impl trait) are not included.
|
/// Bounds from the parent (e.g. with nested impl trait) are not included.
|
||||||
query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<&'tcx [(ty::Clause<'tcx>, Span)]> {
|
query explicit_item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
|
||||||
desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { key.is_local() }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
|
@ -373,7 +373,7 @@ rustc_queries! {
|
||||||
/// share the `Self` type of the item. These are a subset of the bounds
|
/// share the `Self` type of the item. These are a subset of the bounds
|
||||||
/// that may explicitly be used for things like closure signature
|
/// that may explicitly be used for things like closure signature
|
||||||
/// deduction.
|
/// deduction.
|
||||||
query explicit_item_super_predicates(key: DefId) -> ty::EarlyBinder<&'tcx [(ty::Clause<'tcx>, Span)]> {
|
query explicit_item_super_predicates(key: DefId) -> ty::EarlyBinder<'tcx, &'tcx [(ty::Clause<'tcx>, Span)]> {
|
||||||
desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "finding item bounds for `{}`", tcx.def_path_str(key) }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { key.is_local() }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
|
@ -399,15 +399,15 @@ rustc_queries! {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Bounds from the parent (e.g. with nested impl trait) are not included.
|
/// Bounds from the parent (e.g. with nested impl trait) are not included.
|
||||||
query item_bounds(key: DefId) -> ty::EarlyBinder<ty::Clauses<'tcx>> {
|
query item_bounds(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
|
||||||
desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "elaborating item bounds for `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
query item_super_predicates(key: DefId) -> ty::EarlyBinder<ty::Clauses<'tcx>> {
|
query item_super_predicates(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
|
||||||
desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
query item_non_self_assumptions(key: DefId) -> ty::EarlyBinder<ty::Clauses<'tcx>> {
|
query item_non_self_assumptions(key: DefId) -> ty::EarlyBinder<'tcx, ty::Clauses<'tcx>> {
|
||||||
desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "elaborating item assumptions for `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ rustc_queries! {
|
||||||
/// Try to build an abstract representation of the given constant.
|
/// Try to build an abstract representation of the given constant.
|
||||||
query thir_abstract_const(
|
query thir_abstract_const(
|
||||||
key: DefId
|
key: DefId
|
||||||
) -> Result<Option<ty::EarlyBinder<ty::Const<'tcx>>>, ErrorGuaranteed> {
|
) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
|
||||||
desc {
|
desc {
|
||||||
|tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
|
|tcx| "building an abstract representation for `{}`", tcx.def_path_str(key),
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ rustc_queries! {
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
}
|
}
|
||||||
|
|
||||||
query adt_sized_constraint(key: DefId) -> Option<ty::EarlyBinder<Ty<'tcx>>> {
|
query adt_sized_constraint(key: DefId) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
|
||||||
desc { |tcx| "computing the `Sized` constraint for `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "computing the `Sized` constraint for `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ rustc_queries! {
|
||||||
|
|
||||||
query self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
|
query self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
|
||||||
key: DefId
|
key: DefId
|
||||||
) -> Option<ty::EarlyBinder<ty::Ty<'tcx>>> {
|
) -> Option<ty::EarlyBinder<'tcx, ty::Ty<'tcx>>> {
|
||||||
desc { |tcx| "computing self type wrt issue #33140 `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "computing self type wrt issue #33140 `{}`", tcx.def_path_str(key) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ rustc_queries! {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the signature of the function.
|
/// Computes the signature of the function.
|
||||||
query fn_sig(key: DefId) -> ty::EarlyBinder<ty::PolyFnSig<'tcx>> {
|
query fn_sig(key: DefId) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
|
||||||
desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
|
desc { |tcx| "computing function signature of `{}`", tcx.def_path_str(key) }
|
||||||
cache_on_disk_if { key.is_local() }
|
cache_on_disk_if { key.is_local() }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
|
|
|
@ -752,7 +752,7 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx UnordSet<LocalDefId>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>>
|
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>>
|
||||||
for &'tcx UnordMap<DefId, ty::EarlyBinder<Ty<'tcx>>>
|
for &'tcx UnordMap<DefId, ty::EarlyBinder<'tcx, Ty<'tcx>>>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Self {
|
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Self {
|
||||||
|
|
|
@ -30,7 +30,8 @@ impl From<ErrorGuaranteed> for NotConstEvaluatable {
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! { NotConstEvaluatable }
|
TrivialTypeTraversalImpls! { NotConstEvaluatable }
|
||||||
|
|
||||||
pub type BoundAbstractConst<'tcx> = Result<Option<EarlyBinder<ty::Const<'tcx>>>, ErrorGuaranteed>;
|
pub type BoundAbstractConst<'tcx> =
|
||||||
|
Result<Option<EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed>;
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
impl<'tcx> TyCtxt<'tcx> {
|
||||||
pub fn expand_abstract_consts<T: TypeFoldable<TyCtxt<'tcx>>>(self, ac: T) -> T {
|
pub fn expand_abstract_consts<T: TypeFoldable<TyCtxt<'tcx>>>(self, ac: T) -> T {
|
||||||
|
|
|
@ -579,7 +579,7 @@ impl<'tcx> AdtDef<'tcx> {
|
||||||
|
|
||||||
/// Returns a type such that `Self: Sized` if and only if that type is `Sized`,
|
/// Returns a type such that `Self: Sized` if and only if that type is `Sized`,
|
||||||
/// or `None` if the type is always sized.
|
/// or `None` if the type is always sized.
|
||||||
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> Option<ty::EarlyBinder<Ty<'tcx>>> {
|
pub fn sized_constraint(self, tcx: TyCtxt<'tcx>) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
|
||||||
if self.is_struct() { tcx.adt_sized_constraint(self.did()) } else { None }
|
if self.is_struct() { tcx.adt_sized_constraint(self.did()) } else { None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -486,7 +486,10 @@ impl<'tcx> Const<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn const_param_default(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Const<'_>> {
|
pub fn const_param_default<'tcx>(
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
def_id: LocalDefId,
|
||||||
|
) -> ty::EarlyBinder<'tcx, Const<'tcx>> {
|
||||||
let default_def_id = match tcx.hir_node_by_def_id(def_id) {
|
let default_def_id = match tcx.hir_node_by_def_id(def_id) {
|
||||||
hir::Node::GenericParam(hir::GenericParam {
|
hir::Node::GenericParam(hir::GenericParam {
|
||||||
kind: hir::GenericParamKind::Const { default: Some(ac), .. },
|
kind: hir::GenericParamKind::Const { default: Some(ac), .. },
|
||||||
|
|
|
@ -681,7 +681,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
/// In order to break cycles involving `AnonConst`, we need to set the expected type by side
|
/// In order to break cycles involving `AnonConst`, we need to set the expected type by side
|
||||||
/// effect. However, we do not want this as a general capability, so this interface restricts
|
/// effect. However, we do not want this as a general capability, so this interface restricts
|
||||||
/// to the only allowed case.
|
/// to the only allowed case.
|
||||||
pub fn feed_anon_const_type(self, key: LocalDefId, value: ty::EarlyBinder<Ty<'tcx>>) {
|
pub fn feed_anon_const_type(self, key: LocalDefId, value: ty::EarlyBinder<'tcx, Ty<'tcx>>) {
|
||||||
debug_assert_eq!(self.def_kind(key), DefKind::AnonConst);
|
debug_assert_eq!(self.def_kind(key), DefKind::AnonConst);
|
||||||
TyCtxtFeed { tcx: self, key }.type_of(value)
|
TyCtxtFeed { tcx: self, key }.type_of(value)
|
||||||
}
|
}
|
||||||
|
@ -2746,7 +2746,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
pub fn impl_trait_ref(
|
pub fn impl_trait_ref(
|
||||||
self,
|
self,
|
||||||
def_id: impl IntoQueryParam<DefId>,
|
def_id: impl IntoQueryParam<DefId>,
|
||||||
) -> Option<ty::EarlyBinder<ty::TraitRef<'tcx>>> {
|
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
|
||||||
Some(self.impl_trait_header(def_id)?.trait_ref)
|
Some(self.impl_trait_header(def_id)?.trait_ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -584,48 +584,49 @@ impl<'tcx, T: TypeVisitable<TyCtxt<'tcx>>> TypeVisitable<TyCtxt<'tcx>> for &'tcx
|
||||||
/// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder).
|
/// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder).
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[derive(Encodable, Decodable, HashStable)]
|
#[derive(Encodable, Decodable, HashStable)]
|
||||||
pub struct EarlyBinder<T> {
|
pub struct EarlyBinder<'tcx, T> {
|
||||||
value: T,
|
value: T,
|
||||||
|
_tcx: PhantomData<&'tcx ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For early binders, you should first call `instantiate` before using any visitors.
|
/// For early binders, you should first call `instantiate` before using any visitors.
|
||||||
impl<'tcx, T> !TypeFoldable<TyCtxt<'tcx>> for ty::EarlyBinder<T> {}
|
impl<'tcx, T> !TypeFoldable<TyCtxt<'tcx>> for ty::EarlyBinder<'tcx, T> {}
|
||||||
impl<'tcx, T> !TypeVisitable<TyCtxt<'tcx>> for ty::EarlyBinder<T> {}
|
impl<'tcx, T> !TypeVisitable<TyCtxt<'tcx>> for ty::EarlyBinder<'tcx, T> {}
|
||||||
|
|
||||||
impl<T> EarlyBinder<T> {
|
impl<'tcx, T> EarlyBinder<'tcx, T> {
|
||||||
pub fn bind(value: T) -> EarlyBinder<T> {
|
pub fn bind(value: T) -> EarlyBinder<'tcx, T> {
|
||||||
EarlyBinder { value }
|
EarlyBinder { value, _tcx: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_ref(&self) -> EarlyBinder<&T> {
|
pub fn as_ref(&self) -> EarlyBinder<'tcx, &T> {
|
||||||
EarlyBinder { value: &self.value }
|
EarlyBinder { value: &self.value, _tcx: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<U>
|
pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<'tcx, U>
|
||||||
where
|
where
|
||||||
F: FnOnce(&T) -> U,
|
F: FnOnce(&T) -> U,
|
||||||
{
|
{
|
||||||
self.as_ref().map_bound(f)
|
self.as_ref().map_bound(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<U>
|
pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<'tcx, U>
|
||||||
where
|
where
|
||||||
F: FnOnce(T) -> U,
|
F: FnOnce(T) -> U,
|
||||||
{
|
{
|
||||||
let value = f(self.value);
|
let value = f(self.value);
|
||||||
EarlyBinder { value }
|
EarlyBinder { value, _tcx: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<U>, E>
|
pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<'tcx, U>, E>
|
||||||
where
|
where
|
||||||
F: FnOnce(T) -> Result<U, E>,
|
F: FnOnce(T) -> Result<U, E>,
|
||||||
{
|
{
|
||||||
let value = f(self.value)?;
|
let value = f(self.value)?;
|
||||||
Ok(EarlyBinder { value })
|
Ok(EarlyBinder { value, _tcx: PhantomData })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rebind<U>(&self, value: U) -> EarlyBinder<U> {
|
pub fn rebind<U>(&self, value: U) -> EarlyBinder<'tcx, U> {
|
||||||
EarlyBinder { value }
|
EarlyBinder { value, _tcx: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Skips the binder and returns the "bound" value.
|
/// Skips the binder and returns the "bound" value.
|
||||||
|
@ -634,7 +635,7 @@ impl<T> EarlyBinder<T> {
|
||||||
/// arguments of an `FnSig`). Otherwise, consider using
|
/// arguments of an `FnSig`). Otherwise, consider using
|
||||||
/// [`instantiate_identity`](EarlyBinder::instantiate_identity).
|
/// [`instantiate_identity`](EarlyBinder::instantiate_identity).
|
||||||
///
|
///
|
||||||
/// To skip the binder on `x: &EarlyBinder<T>` to obtain `&T`, leverage
|
/// To skip the binder on `x: &EarlyBinder<'tcx, T>` to obtain `&T`, leverage
|
||||||
/// [`EarlyBinder::as_ref`](EarlyBinder::as_ref): `x.as_ref().skip_binder()`.
|
/// [`EarlyBinder::as_ref`](EarlyBinder::as_ref): `x.as_ref().skip_binder()`.
|
||||||
///
|
///
|
||||||
/// See also [`Binder::skip_binder`](super::Binder::skip_binder), which is
|
/// See also [`Binder::skip_binder`](super::Binder::skip_binder), which is
|
||||||
|
@ -644,13 +645,13 @@ impl<T> EarlyBinder<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EarlyBinder<Option<T>> {
|
impl<'tcx, T> EarlyBinder<'tcx, Option<T>> {
|
||||||
pub fn transpose(self) -> Option<EarlyBinder<T>> {
|
pub fn transpose(self) -> Option<EarlyBinder<'tcx, T>> {
|
||||||
self.value.map(|value| EarlyBinder { value })
|
self.value.map(|value| EarlyBinder { value, _tcx: PhantomData })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>
|
impl<'tcx, 's, I: IntoIterator> EarlyBinder<'tcx, I>
|
||||||
where
|
where
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
|
@ -682,7 +683,10 @@ where
|
||||||
type Item = I::Item;
|
type Item = I::Item;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
Some(EarlyBinder { value: self.it.next()? }.instantiate(self.tcx, self.args))
|
Some(
|
||||||
|
EarlyBinder { value: self.it.next()?, _tcx: PhantomData }
|
||||||
|
.instantiate(self.tcx, self.args),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
@ -696,7 +700,10 @@ where
|
||||||
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
I::Item: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
Some(EarlyBinder { value: self.it.next_back()? }.instantiate(self.tcx, self.args))
|
Some(
|
||||||
|
EarlyBinder { value: self.it.next_back()?, _tcx: PhantomData }
|
||||||
|
.instantiate(self.tcx, self.args),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,7 +714,7 @@ where
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>
|
impl<'tcx, 's, I: IntoIterator> EarlyBinder<'tcx, I>
|
||||||
where
|
where
|
||||||
I::Item: Deref,
|
I::Item: Deref,
|
||||||
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -743,7 +750,9 @@ where
|
||||||
type Item = <I::Item as Deref>::Target;
|
type Item = <I::Item as Deref>::Target;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.it.next().map(|value| EarlyBinder { value: *value }.instantiate(self.tcx, self.args))
|
self.it.next().map(|value| {
|
||||||
|
EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.tcx, self.args)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
@ -758,9 +767,9 @@ where
|
||||||
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
<I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
|
||||||
{
|
{
|
||||||
fn next_back(&mut self) -> Option<Self::Item> {
|
fn next_back(&mut self) -> Option<Self::Item> {
|
||||||
self.it
|
self.it.next_back().map(|value| {
|
||||||
.next_back()
|
EarlyBinder { value: *value, _tcx: PhantomData }.instantiate(self.tcx, self.args)
|
||||||
.map(|value| EarlyBinder { value: *value }.instantiate(self.tcx, self.args))
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,21 +781,22 @@ where
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EarlyBinderIter<T> {
|
pub struct EarlyBinderIter<'tcx, T> {
|
||||||
t: T,
|
t: T,
|
||||||
|
_tcx: PhantomData<&'tcx ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: IntoIterator> EarlyBinder<T> {
|
impl<'tcx, T: IntoIterator> EarlyBinder<'tcx, T> {
|
||||||
pub fn transpose_iter(self) -> EarlyBinderIter<T::IntoIter> {
|
pub fn transpose_iter(self) -> EarlyBinderIter<'tcx, T::IntoIter> {
|
||||||
EarlyBinderIter { t: self.value.into_iter() }
|
EarlyBinderIter { t: self.value.into_iter(), _tcx: PhantomData }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator> Iterator for EarlyBinderIter<T> {
|
impl<'tcx, T: Iterator> Iterator for EarlyBinderIter<'tcx, T> {
|
||||||
type Item = EarlyBinder<T::Item>;
|
type Item = EarlyBinder<'tcx, T::Item>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.t.next().map(|value| EarlyBinder { value })
|
self.t.next().map(|value| EarlyBinder { value, _tcx: PhantomData })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
@ -794,7 +804,7 @@ impl<T: Iterator> Iterator for EarlyBinderIter<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> ty::EarlyBinder<T> {
|
impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> ty::EarlyBinder<'tcx, T> {
|
||||||
pub fn instantiate(self, tcx: TyCtxt<'tcx>, args: &[GenericArg<'tcx>]) -> T {
|
pub fn instantiate(self, tcx: TyCtxt<'tcx>, args: &[GenericArg<'tcx>]) -> T {
|
||||||
let mut folder = ArgFolder { tcx, args, binders_passed: 0 };
|
let mut folder = ArgFolder { tcx, args, binders_passed: 0 };
|
||||||
self.value.fold_with(&mut folder)
|
self.value.fold_with(&mut folder)
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl GenericParamDef {
|
||||||
pub fn default_value<'tcx>(
|
pub fn default_value<'tcx>(
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
) -> Option<EarlyBinder<ty::GenericArg<'tcx>>> {
|
) -> Option<EarlyBinder<'tcx, ty::GenericArg<'tcx>>> {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
GenericParamDefKind::Type { has_default, .. } if has_default => {
|
GenericParamDefKind::Type { has_default, .. } if has_default => {
|
||||||
Some(tcx.type_of(self.def_id).map_bound(|t| t.into()))
|
Some(tcx.type_of(self.def_id).map_bound(|t| t.into()))
|
||||||
|
|
|
@ -764,7 +764,7 @@ impl<'tcx> Instance<'tcx> {
|
||||||
self.def.has_polymorphic_mir_body().then_some(self.args)
|
self.def.has_polymorphic_mir_body().then_some(self.args)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instantiate_mir<T>(&self, tcx: TyCtxt<'tcx>, v: EarlyBinder<&T>) -> T
|
pub fn instantiate_mir<T>(&self, tcx: TyCtxt<'tcx>, v: EarlyBinder<'tcx, &T>) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
|
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
|
||||||
{
|
{
|
||||||
|
@ -782,7 +782,7 @@ impl<'tcx> Instance<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
v: EarlyBinder<T>,
|
v: EarlyBinder<'tcx, T>,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -800,7 +800,7 @@ impl<'tcx> Instance<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
v: EarlyBinder<T>,
|
v: EarlyBinder<'tcx, T>,
|
||||||
) -> Result<T, NormalizationError<'tcx>>
|
) -> Result<T, NormalizationError<'tcx>>
|
||||||
where
|
where
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
|
|
@ -266,7 +266,7 @@ pub struct ImplHeader<'tcx> {
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
|
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
|
||||||
pub struct ImplTraitHeader<'tcx> {
|
pub struct ImplTraitHeader<'tcx> {
|
||||||
pub trait_ref: ty::EarlyBinder<ty::TraitRef<'tcx>>,
|
pub trait_ref: ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>,
|
||||||
pub polarity: ImplPolarity,
|
pub polarity: ImplPolarity,
|
||||||
pub safety: hir::Safety,
|
pub safety: hir::Safety,
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self,
|
self,
|
||||||
param_args: GenericArgsRef<'tcx>,
|
param_args: GenericArgsRef<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
value: EarlyBinder<T>,
|
value: EarlyBinder<'tcx, T>,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
@ -143,7 +143,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self,
|
self,
|
||||||
param_args: GenericArgsRef<'tcx>,
|
param_args: GenericArgsRef<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
value: EarlyBinder<T>,
|
value: EarlyBinder<'tcx, T>,
|
||||||
) -> Result<T, NormalizationError<'tcx>>
|
) -> Result<T, NormalizationError<'tcx>>
|
||||||
where
|
where
|
||||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||||
|
|
|
@ -33,8 +33,8 @@ impl<T: ParameterizedOverTcx> ParameterizedOverTcx for ty::Binder<'static, T> {
|
||||||
type Value<'tcx> = ty::Binder<'tcx, T::Value<'tcx>>;
|
type Value<'tcx> = ty::Binder<'tcx, T::Value<'tcx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ParameterizedOverTcx> ParameterizedOverTcx for ty::EarlyBinder<T> {
|
impl<T: ParameterizedOverTcx> ParameterizedOverTcx for ty::EarlyBinder<'static, T> {
|
||||||
type Value<'tcx> = ty::EarlyBinder<T::Value<'tcx>>;
|
type Value<'tcx> = ty::EarlyBinder<'tcx, T::Value<'tcx>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
|
@ -2055,7 +2055,7 @@ impl<'tcx> Ty<'tcx> {
|
||||||
fn async_destructor_combinator(
|
fn async_destructor_combinator(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
lang_item: LangItem,
|
lang_item: LangItem,
|
||||||
) -> ty::EarlyBinder<Ty<'tcx>> {
|
) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
|
||||||
tcx.fn_sig(tcx.require_lang_item(lang_item, None))
|
tcx.fn_sig(tcx.require_lang_item(lang_item, None))
|
||||||
.map_bound(|fn_sig| fn_sig.output().no_bound_vars().unwrap())
|
.map_bound(|fn_sig| fn_sig.output().no_bound_vars().unwrap())
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
pub fn coroutine_hidden_types(
|
pub fn coroutine_hidden_types(
|
||||||
self,
|
self,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> impl Iterator<Item = ty::EarlyBinder<Ty<'tcx>>> {
|
) -> impl Iterator<Item = ty::EarlyBinder<'tcx, Ty<'tcx>>> {
|
||||||
let coroutine_layout = self.mir_coroutine_witnesses(def_id);
|
let coroutine_layout = self.mir_coroutine_witnesses(def_id);
|
||||||
coroutine_layout
|
coroutine_layout
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -709,7 +709,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
pub fn bound_coroutine_hidden_types(
|
pub fn bound_coroutine_hidden_types(
|
||||||
self,
|
self,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> impl Iterator<Item = ty::EarlyBinder<ty::Binder<'tcx, Ty<'tcx>>>> {
|
) -> impl Iterator<Item = ty::EarlyBinder<'tcx, ty::Binder<'tcx, Ty<'tcx>>>> {
|
||||||
let coroutine_layout = self.mir_coroutine_witnesses(def_id);
|
let coroutine_layout = self.mir_coroutine_witnesses(def_id);
|
||||||
coroutine_layout
|
coroutine_layout
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
@ -23,7 +23,7 @@ impl<'tcx> Value<TyCtxt<'tcx>> for Ty<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Value<TyCtxt<'tcx>> for Result<ty::EarlyBinder<Ty<'_>>, CyclePlaceholder> {
|
impl<'tcx> Value<TyCtxt<'tcx>> for Result<ty::EarlyBinder<'_, Ty<'_>>, CyclePlaceholder> {
|
||||||
fn from_cycle_error(_tcx: TyCtxt<'tcx>, _: &CycleError, guar: ErrorGuaranteed) -> Self {
|
fn from_cycle_error(_tcx: TyCtxt<'tcx>, _: &CycleError, guar: ErrorGuaranteed) -> Self {
|
||||||
Err(CyclePlaceholder(guar))
|
Err(CyclePlaceholder(guar))
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ impl<'tcx> Value<TyCtxt<'tcx>> for Representability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<Ty<'_>> {
|
impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<'_, Ty<'_>> {
|
||||||
fn from_cycle_error(
|
fn from_cycle_error(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
cycle_error: &CycleError,
|
cycle_error: &CycleError,
|
||||||
|
@ -121,7 +121,7 @@ impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<Ty<'_>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<ty::Binder<'_, ty::FnSig<'_>>> {
|
impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<'_, ty::Binder<'_, ty::FnSig<'_>>> {
|
||||||
fn from_cycle_error(
|
fn from_cycle_error(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
cycle_error: &CycleError,
|
cycle_error: &CycleError,
|
||||||
|
|
|
@ -194,7 +194,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, S, V> Stable<'tcx> for ty::EarlyBinder<S>
|
impl<'tcx, S, V> Stable<'tcx> for ty::EarlyBinder<'tcx, S>
|
||||||
where
|
where
|
||||||
S: Stable<'tcx, T = V>,
|
S: Stable<'tcx, T = V>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -2097,7 +2097,7 @@ fn confirm_impl_candidate<'cx, 'tcx>(
|
||||||
let args = translate_args(selcx.infcx, param_env, impl_def_id, args, assoc_ty.defining_node);
|
let args = translate_args(selcx.infcx, param_env, impl_def_id, args, assoc_ty.defining_node);
|
||||||
let ty = tcx.type_of(assoc_ty.item.def_id);
|
let ty = tcx.type_of(assoc_ty.item.def_id);
|
||||||
let is_const = matches!(tcx.def_kind(assoc_ty.item.def_id), DefKind::AssocConst);
|
let is_const = matches!(tcx.def_kind(assoc_ty.item.def_id), DefKind::AssocConst);
|
||||||
let term: ty::EarlyBinder<ty::Term<'tcx>> = if is_const {
|
let term: ty::EarlyBinder<'tcx, ty::Term<'tcx>> = if is_const {
|
||||||
let did = assoc_ty.item.def_id;
|
let did = assoc_ty.item.def_id;
|
||||||
let identity_args = crate::traits::GenericArgs::identity_for_item(tcx, did);
|
let identity_args = crate::traits::GenericArgs::identity_for_item(tcx, did);
|
||||||
let uv = ty::UnevaluatedConst::new(did, identity_args);
|
let uv = ty::UnevaluatedConst::new(did, identity_args);
|
||||||
|
|
|
@ -398,10 +398,10 @@ impl<'a, 'tcx> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead.
|
/// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead.
|
||||||
fn thir_abstract_const(
|
fn thir_abstract_const<'tcx>(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def: LocalDefId,
|
def: LocalDefId,
|
||||||
) -> Result<Option<ty::EarlyBinder<ty::Const<'_>>>, ErrorGuaranteed> {
|
) -> Result<Option<ty::EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed> {
|
||||||
if !tcx.features().generic_const_exprs {
|
if !tcx.features().generic_const_exprs {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn defaultness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Defaultness {
|
||||||
fn adt_sized_constraint<'tcx>(
|
fn adt_sized_constraint<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> Option<ty::EarlyBinder<Ty<'tcx>>> {
|
) -> Option<ty::EarlyBinder<'tcx, Ty<'tcx>>> {
|
||||||
if let Some(def_id) = def_id.as_local() {
|
if let Some(def_id) = def_id.as_local() {
|
||||||
if let ty::Representability::Infinite(_) = tcx.representability(def_id) {
|
if let ty::Representability::Infinite(_) = tcx.representability(def_id) {
|
||||||
return None;
|
return None;
|
||||||
|
@ -253,7 +253,7 @@ fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamE
|
||||||
fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
|
fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
) -> Option<EarlyBinder<Ty<'_>>> {
|
) -> Option<EarlyBinder<'_, Ty<'_>>> {
|
||||||
let impl_ =
|
let impl_ =
|
||||||
tcx.impl_trait_header(def_id).unwrap_or_else(|| bug!("called on inherent impl {def_id:?}"));
|
tcx.impl_trait_header(def_id).unwrap_or_else(|| bug!("called on inherent impl {def_id:?}"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue