Skip to content

Commit bbcdb4f

Browse files
Give EarlyBinder a tcx parameter
We are gonna need it to uplift EarlyBinder
1 parent bdbbb6c commit bbcdb4f

33 files changed

Lines changed: 129 additions & 110 deletions

File tree

‎compiler/rustc_hir_analysis/src/check/compare_impl_item.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
449449
pub(super)fncollect_return_position_impl_trait_in_trait_tys<'tcx>(
450450
tcx:TyCtxt<'tcx>,
451451
impl_m_def_id:LocalDefId,
452-
) -> Result<&'tcxDefIdMap<ty::EarlyBinder<Ty<'tcx>>>,ErrorGuaranteed>{
452+
) -> Result<&'tcxDefIdMap<ty::EarlyBinder<'tcx,Ty<'tcx>>>,ErrorGuaranteed>{
453453
let impl_m = tcx.opt_associated_item(impl_m_def_id.to_def_id()).unwrap();
454454
let trait_m = tcx.opt_associated_item(impl_m.trait_item_def_id.unwrap()).unwrap();
455455
let impl_trait_ref =

‎compiler/rustc_hir_analysis/src/collect.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
12781278
}
12791279

12801280
#[instrument(level = "debug", skip(tcx))]
1281-
fnfn_sig(tcx:TyCtxt<'_>,def_id:LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig<'_>>{
1281+
fnfn_sig(tcx:TyCtxt<'_>,def_id:LocalDefId) -> ty::EarlyBinder<'_,ty::PolyFnSig<'_>>{
12821282
use rustc_hir::Node::*;
12831283
use rustc_hir::*;
12841284

‎compiler/rustc_hir_analysis/src/collect/item_bounds.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,22 @@ fn opaque_type_bounds<'tcx>(
8282
pub(super)fnexplicit_item_bounds(
8383
tcx:TyCtxt<'_>,
8484
def_id:LocalDefId,
85-
) -> ty::EarlyBinder<&'_[(ty::Clause<'_>,Span)]>{
85+
) -> ty::EarlyBinder<'_,&'_[(ty::Clause<'_>,Span)]>{
8686
explicit_item_bounds_with_filter(tcx, def_id,PredicateFilter::All)
8787
}
8888

8989
pub(super)fnexplicit_item_super_predicates(
9090
tcx:TyCtxt<'_>,
9191
def_id:LocalDefId,
92-
) -> ty::EarlyBinder<&'_[(ty::Clause<'_>,Span)]>{
92+
) -> ty::EarlyBinder<'_,&'_[(ty::Clause<'_>,Span)]>{
9393
explicit_item_bounds_with_filter(tcx, def_id,PredicateFilter::SelfOnly)
9494
}
9595

9696
pub(super)fnexplicit_item_bounds_with_filter(
9797
tcx:TyCtxt<'_>,
9898
def_id:LocalDefId,
9999
filter:PredicateFilter,
100-
) -> ty::EarlyBinder<&'_[(ty::Clause<'_>,Span)]>{
100+
) -> ty::EarlyBinder<'_,&'_[(ty::Clause<'_>,Span)]>{
101101
match tcx.opt_rpitit_info(def_id.to_def_id()){
102102
// RPITIT's bounds are the same as opaque type bounds, but with
103103
// a projection self type.
@@ -166,7 +166,7 @@ pub(super) fn explicit_item_bounds_with_filter(
166166
ty::EarlyBinder::bind(bounds)
167167
}
168168

169-
pub(super)fnitem_bounds(tcx:TyCtxt<'_>,def_id:DefId) -> ty::EarlyBinder<ty::Clauses<'_>>{
169+
pub(super)fnitem_bounds(tcx:TyCtxt<'_>,def_id:DefId) -> ty::EarlyBinder<'_,ty::Clauses<'_>>{
170170
tcx.explicit_item_bounds(def_id).map_bound(|bounds| {
171171
tcx.mk_clauses_from_iter(util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)))
172172
})
@@ -175,7 +175,7 @@ pub(super) fn item_bounds(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<ty:
175175
pub(super)fnitem_super_predicates(
176176
tcx:TyCtxt<'_>,
177177
def_id:DefId,
178-
) -> ty::EarlyBinder<ty::Clauses<'_>>{
178+
) -> ty::EarlyBinder<'_,ty::Clauses<'_>>{
179179
tcx.explicit_item_super_predicates(def_id).map_bound(|bounds| {
180180
tcx.mk_clauses_from_iter(
181181
util::elaborate(tcx, bounds.iter().map(|&(bound, _span)| bound)).filter_only_self(),
@@ -186,7 +186,7 @@ pub(super) fn item_super_predicates(
186186
pub(super)fnitem_non_self_assumptions(
187187
tcx:TyCtxt<'_>,
188188
def_id:DefId,
189-
) -> ty::EarlyBinder<ty::Clauses<'_>>{
189+
) -> ty::EarlyBinder<'_,ty::Clauses<'_>>{
190190
let all_bounds:FxIndexSet<_> = tcx.item_bounds(def_id).skip_binder().iter().collect();
191191
let own_bounds:FxIndexSet<_> =
192192
tcx.item_super_predicates(def_id).skip_binder().iter().collect();

‎compiler/rustc_hir_analysis/src/collect/type_of.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ fn get_path_containing_arg_in_pat<'hir>(
309309
arg_path
310310
}
311311

312-
pub(super)fntype_of(tcx:TyCtxt<'_>,def_id:LocalDefId) -> ty::EarlyBinder<Ty<'_>>{
312+
pub(super)fntype_of(tcx:TyCtxt<'_>,def_id:LocalDefId) -> ty::EarlyBinder<'_,Ty<'_>>{
313313
use rustc_hir::*;
314314
use rustc_middle::ty::Ty;
315315

@@ -512,7 +512,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Ty
512512
pub(super)fntype_of_opaque(
513513
tcx:TyCtxt<'_>,
514514
def_id:DefId,
515-
) -> Result<ty::EarlyBinder<Ty<'_>>,CyclePlaceholder>{
515+
) -> Result<ty::EarlyBinder<'_,Ty<'_>>,CyclePlaceholder>{
516516
ifletSome(def_id) = def_id.as_local(){
517517
use rustc_hir::*;
518518

‎compiler/rustc_hir_analysis/src/outlives/explicit.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use super::utils::*;
66

77
#[derive(Debug)]
88
pubstructExplicitPredicatesMap<'tcx>{
9-
map:FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
9+
map:FxIndexMap<DefId, ty::EarlyBinder<'tcx,RequiredPredicates<'tcx>>>,
1010
}
1111

1212
impl<'tcx>ExplicitPredicatesMap<'tcx>{
@@ -18,7 +18,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
1818
&mutself,
1919
tcx:TyCtxt<'tcx>,
2020
def_id:DefId,
21-
) -> &ty::EarlyBinder<RequiredPredicates<'tcx>>{
21+
) -> &ty::EarlyBinder<'tcx,RequiredPredicates<'tcx>>{
2222
self.map.entry(def_id).or_insert_with(|| {
2323
let predicates = if def_id.is_local(){
2424
tcx.explicit_predicates_of(def_id)

‎compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use super::utils::*;
1515
/// now be filled with inferred predicates.
1616
pub(super)fninfer_predicates(
1717
tcx:TyCtxt<'_>,
18-
) -> FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'_>>>{
18+
) -> FxIndexMap<DefId, ty::EarlyBinder<'_,RequiredPredicates<'_>>>{
1919
debug!("infer_predicates");
2020

2121
letmut explicit_map = ExplicitPredicatesMap::new();
@@ -101,7 +101,7 @@ fn insert_required_predicates_to_be_wf<'tcx>(
101101
tcx:TyCtxt<'tcx>,
102102
ty:Ty<'tcx>,
103103
span:Span,
104-
global_inferred_outlives:&FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
104+
global_inferred_outlives:&FxIndexMap<DefId, ty::EarlyBinder<'tcx,RequiredPredicates<'tcx>>>,
105105
required_predicates:&mutRequiredPredicates<'tcx>,
106106
explicit_map:&mutExplicitPredicatesMap<'tcx>,
107107
){
@@ -322,7 +322,7 @@ fn check_inferred_predicates<'tcx>(
322322
tcx:TyCtxt<'tcx>,
323323
def_id:DefId,
324324
args: ty::GenericArgsRef<'tcx>,
325-
global_inferred_outlives:&FxIndexMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>>,
325+
global_inferred_outlives:&FxIndexMap<DefId, ty::EarlyBinder<'tcx,RequiredPredicates<'tcx>>>,
326326
required_predicates:&mutRequiredPredicates<'tcx>,
327327
){
328328
// Load the current set of inferred and explicit predicates from `global_inferred_outlives`

‎compiler/rustc_lint/src/non_local_def.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn impl_trait_ref_has_enough_non_local_candidates<'tcx>(
270270
tcx:TyCtxt<'tcx>,
271271
infer_span:Span,
272272
trait_def_id:DefId,
273-
binder:EarlyBinder<TraitRef<'tcx>>,
273+
binder:EarlyBinder<'tcx,TraitRef<'tcx>>,
274274
mutdid_has_local_parent:implFnMut(DefId) -> bool,
275275
) -> bool{
276276
let infcx = tcx

‎compiler/rustc_metadata/src/rmeta/decoder.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10741074
self,
10751075
index:DefIndex,
10761076
tcx:TyCtxt<'tcx>,
1077-
) -> ty::EarlyBinder<&'tcx[(ty::Clause<'tcx>,Span)]>{
1077+
) -> ty::EarlyBinder<'tcx,&'tcx[(ty::Clause<'tcx>,Span)]>{
10781078
let lazy = self.root.tables.explicit_item_bounds.get(self, index);
10791079
let output = if lazy.is_default(){
10801080
&mut[]
@@ -1088,7 +1088,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10881088
self,
10891089
index:DefIndex,
10901090
tcx:TyCtxt<'tcx>,
1091-
) -> ty::EarlyBinder<&'tcx[(ty::Clause<'tcx>,Span)]>{
1091+
) -> ty::EarlyBinder<'tcx,&'tcx[(ty::Clause<'tcx>,Span)]>{
10921092
let lazy = self.root.tables.explicit_item_super_predicates.get(self, index);
10931093
let output = if lazy.is_default(){
10941094
&mut[]

‎compiler/rustc_metadata/src/rmeta/mod.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,19 +418,19 @@ define_tables! {
418418
// As an optimization, we only store this for trait aliases,
419419
// since it's identical to super_predicates_of for traits.
420420
implied_predicates_of:Table<DefIndex,LazyValue<ty::GenericPredicates<'static>>>,
421-
type_of:Table<DefIndex,LazyValue<ty::EarlyBinder<Ty<'static>>>>,
421+
type_of:Table<DefIndex,LazyValue<ty::EarlyBinder<'static,Ty<'static>>>>,
422422
variances_of:Table<DefIndex,LazyArray<ty::Variance>>,
423-
fn_sig:Table<DefIndex,LazyValue<ty::EarlyBinder<ty::PolyFnSig<'static>>>>,
423+
fn_sig:Table<DefIndex,LazyValue<ty::EarlyBinder<'static,ty::PolyFnSig<'static>>>>,
424424
codegen_fn_attrs:Table<DefIndex,LazyValue<CodegenFnAttrs>>,
425425
impl_trait_header:Table<DefIndex,LazyValue<ty::ImplTraitHeader<'static>>>,
426-
const_param_default:Table<DefIndex,LazyValue<ty::EarlyBinder<rustc_middle::ty::Const<'static>>>>,
426+
const_param_default:Table<DefIndex,LazyValue<ty::EarlyBinder<'static,rustc_middle::ty::Const<'static>>>>,
427427
object_lifetime_default:Table<DefIndex,LazyValue<ObjectLifetimeDefault>>,
428428
optimized_mir:Table<DefIndex,LazyValue<mir::Body<'static>>>,
429429
mir_for_ctfe:Table<DefIndex,LazyValue<mir::Body<'static>>>,
430430
closure_saved_names_of_captured_variables:Table<DefIndex,LazyValue<IndexVec<FieldIdx,Symbol>>>,
431431
mir_coroutine_witnesses:Table<DefIndex,LazyValue<mir::CoroutineLayout<'static>>>,
432432
promoted_mir:Table<DefIndex,LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
433-
thir_abstract_const:Table<DefIndex,LazyValue<ty::EarlyBinder<ty::Const<'static>>>>,
433+
thir_abstract_const:Table<DefIndex,LazyValue<ty::EarlyBinder<'static,ty::Const<'static>>>>,
434434
impl_parent:Table<DefIndex,RawDefId>,
435435
constness:Table<DefIndex, hir::Constness>,
436436
defaultness:Table<DefIndex, hir::Defaultness>,
@@ -459,7 +459,7 @@ define_tables! {
459459
macro_definition:Table<DefIndex,LazyValue<ast::DelimArgs>>,
460460
proc_macro:Table<DefIndex,MacroKind>,
461461
deduced_param_attrs:Table<DefIndex,LazyArray<DeducedParamAttrs>>,
462-
trait_impl_trait_tys:Table<DefIndex,LazyValue<DefIdMap<ty::EarlyBinder<Ty<'static>>>>>,
462+
trait_impl_trait_tys:Table<DefIndex,LazyValue<DefIdMap<ty::EarlyBinder<'static,Ty<'static>>>>>,
463463
doc_link_resolutions:Table<DefIndex,LazyValue<DocLinkResMap>>,
464464
doc_link_traits_in_scope:Table<DefIndex,LazyArray<DefId>>,
465465
assumed_wf_types_for_rpitit:Table<DefIndex,LazyArray<(Ty<'static>,Span)>>,

‎compiler/rustc_middle/src/arena.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ macro_rules! arena_types {
108108
[decode] trait_impl_trait_tys:
109109
rustc_data_structures::unord::UnordMap<
110110
rustc_hir::def_id::DefId,
111-
rustc_middle::ty::EarlyBinder<rustc_middle::ty::Ty<'tcx>>
111+
rustc_middle::ty::EarlyBinder<'tcx,rustc_middle::ty::Ty<'tcx>>
112112
>,
113113
[] external_constraints: rustc_middle::traits::solve::ExternalConstraintsData<'tcx>,
114114
[] predefined_opaques_in_body: rustc_middle::traits::solve::PredefinedOpaquesData<'tcx>,

0 commit comments

Comments
 (0)