Skip to content

Commit 087f3b7

Browse files
authored
Rollup merge of rust-lang#91904 - SylvanB:remove_in_band_lifetimes_rustc_trait_selection, r=petrochenkov
Remove `in_band_lifetimes` from `rustc_trait_selection` Another one for rust-lang#91867
2 parents 20106a3 + 1ea756b commit 087f3b7

18 files changed

+63
-54
lines changed

compiler/rustc_trait_selection/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#![feature(drain_filter)]
1717
#![feature(derive_default_enum)]
1818
#![feature(hash_drain_filter)]
19-
#![feature(in_band_lifetimes)]
2019
#![feature(iter_zip)]
2120
#![feature(let_else)]
2221
#![feature(never_type)]

compiler/rustc_trait_selection/src/opaque_types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct ReverseMapper<'tcx> {
9797
span: Span,
9898
}
9999

100-
impl ReverseMapper<'tcx> {
100+
impl<'tcx> ReverseMapper<'tcx> {
101101
fn new(
102102
tcx: TyCtxt<'tcx>,
103103
tainted_by_errors: bool,
@@ -134,7 +134,7 @@ impl ReverseMapper<'tcx> {
134134
}
135135
}
136136

137-
impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
137+
impl<'tcx> TypeFolder<'tcx> for ReverseMapper<'tcx> {
138138
fn tcx(&self) -> TyCtxt<'tcx> {
139139
self.tcx
140140
}
@@ -338,7 +338,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
338338
/// Requires that trait definitions have been processed so that we can
339339
/// elaborate predicates and walk supertraits.
340340
#[instrument(skip(tcx, predicates), level = "debug")]
341-
crate fn required_region_bounds(
341+
crate fn required_region_bounds<'tcx>(
342342
tcx: TyCtxt<'tcx>,
343343
erased_self_ty: Ty<'tcx>,
344344
predicates: impl Iterator<Item = ty::Predicate<'tcx>>,

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
219219
}
220220
}
221221

222-
impl AutoTraitFinder<'tcx> {
222+
impl<'tcx> AutoTraitFinder<'tcx> {
223223
/// The core logic responsible for computing the bounds for our synthesized impl.
224224
///
225225
/// To calculate the bounds, we call `SelectionContext.select` in a loop. Like

compiler/rustc_trait_selection/src/traits/chalk_fulfill.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub struct FulfillmentContext<'tcx> {
1616
relationships: FxHashMap<ty::TyVid, ty::FoundRelationships>,
1717
}
1818

19-
impl FulfillmentContext<'tcx> {
19+
impl FulfillmentContext<'_> {
2020
crate fn new() -> Self {
2121
FulfillmentContext {
2222
obligations: FxIndexSet::default(),
@@ -25,7 +25,7 @@ impl FulfillmentContext<'tcx> {
2525
}
2626
}
2727

28-
impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
28+
impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
2929
fn normalize_projection_type(
3030
&mut self,
3131
infcx: &InferCtxt<'_, 'tcx>,

compiler/rustc_trait_selection/src/traits/codegen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn codegen_fulfill_obligation<'tcx>(
107107
/// type inference variables that appear in `result` to be
108108
/// unified, and hence we need to process those obligations to get
109109
/// the complete picture of the type.
110-
fn drain_fulfillment_cx_or_panic<T>(
110+
fn drain_fulfillment_cx_or_panic<'tcx, T>(
111111
infcx: &InferCtxt<'_, 'tcx>,
112112
fulfill_cx: &mut FulfillmentContext<'tcx>,
113113
result: T,

compiler/rustc_trait_selection/src/traits/coherence.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,24 @@ fn overlap<'cx, 'tcx>(
154154
})
155155
}
156156

157-
fn overlap_within_probe(
157+
fn overlap_within_probe<'cx, 'tcx>(
158158
selcx: &mut SelectionContext<'cx, 'tcx>,
159159
skip_leak_check: SkipLeakCheck,
160160
a_def_id: DefId,
161161
b_def_id: DefId,
162162
snapshot: &CombinedSnapshot<'_, 'tcx>,
163163
) -> Option<OverlapResult<'tcx>> {
164-
fn loose_check(selcx: &mut SelectionContext<'cx, 'tcx>, o: &PredicateObligation<'tcx>) -> bool {
164+
fn loose_check<'cx, 'tcx>(
165+
selcx: &mut SelectionContext<'cx, 'tcx>,
166+
o: &PredicateObligation<'tcx>,
167+
) -> bool {
165168
!selcx.predicate_may_hold_fatal(o)
166169
}
167170

168-
fn strict_check(selcx: &SelectionContext<'cx, 'tcx>, o: &PredicateObligation<'tcx>) -> bool {
171+
fn strict_check<'cx, 'tcx>(
172+
selcx: &SelectionContext<'cx, 'tcx>,
173+
o: &PredicateObligation<'tcx>,
174+
) -> bool {
169175
let infcx = selcx.infcx();
170176
let tcx = infcx.tcx;
171177
o.flip_polarity(tcx)
@@ -518,7 +524,11 @@ fn orphan_check_trait_ref<'tcx>(
518524
/// - for `Foo<u32>`, where `Foo` is a local type, this returns `[]`.
519525
/// - `&mut u32` returns `[u32]`, as `&mut` is a fundamental type, similar to `Box`.
520526
/// - `Box<Foo<u32>>` returns `[]`, as `Box` is a fundamental type and `Foo` is local.
521-
fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
527+
fn contained_non_local_types<'tcx>(
528+
tcx: TyCtxt<'tcx>,
529+
ty: Ty<'tcx>,
530+
in_crate: InCrate,
531+
) -> Vec<Ty<'tcx>> {
522532
if ty_is_local_constructor(ty, in_crate) {
523533
Vec::new()
524534
} else {
@@ -534,7 +544,7 @@ fn contained_non_local_types(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate)
534544
/// For `#[fundamental]` ADTs and `&T` / `&mut T`, returns `Some` with the
535545
/// type parameters of the ADT, or `T`, respectively. For non-fundamental
536546
/// types, returns `None`.
537-
fn fundamental_ty_inner_tys(
547+
fn fundamental_ty_inner_tys<'tcx>(
538548
tcx: TyCtxt<'tcx>,
539549
ty: Ty<'tcx>,
540550
) -> Option<impl Iterator<Item = Ty<'tcx>>> {

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
10631063
}
10641064
}
10651065

1066-
trait InferCtxtPrivExt<'tcx> {
1066+
trait InferCtxtPrivExt<'hir, 'tcx> {
10671067
// returns if `cond` not occurring implies that `error` does not occur - i.e., that
10681068
// `error` occurring implies that `cond` occurs.
10691069
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool;
@@ -1174,7 +1174,7 @@ trait InferCtxtPrivExt<'tcx> {
11741174
) -> bool;
11751175
}
11761176

1177-
impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
1177+
impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
11781178
// returns if `cond` not occurring implies that `error` does not occur - i.e., that
11791179
// `error` occurring implies that `cond` occurs.
11801180
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool {
@@ -2024,7 +2024,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
20242024
self.maybe_suggest_unsized_generics(err, span, node);
20252025
}
20262026

2027-
fn maybe_suggest_unsized_generics(
2027+
fn maybe_suggest_unsized_generics<'hir>(
20282028
&self,
20292029
err: &mut DiagnosticBuilder<'tcx>,
20302030
span: Span,
@@ -2091,7 +2091,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
20912091
);
20922092
}
20932093

2094-
fn maybe_indirection_for_unsized(
2094+
fn maybe_indirection_for_unsized<'hir>(
20952095
&self,
20962096
err: &mut DiagnosticBuilder<'tcx>,
20972097
item: &'hir Item<'hir>,
@@ -2205,7 +2205,7 @@ impl<'v> Visitor<'v> for FindTypeParam {
22052205
}
22062206

22072207
pub fn recursive_type_with_infinite_size_error(
2208-
tcx: TyCtxt<'tcx>,
2208+
tcx: TyCtxt<'_>,
22092209
type_def_id: DefId,
22102210
spans: Vec<Span>,
22112211
) {

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ fn predicate_constraint(generics: &hir::Generics<'_>, pred: String) -> (Span, St
198198
/// Type parameter needs more bounds. The trivial case is `T` `where T: Bound`, but
199199
/// it can also be an `impl Trait` param that needs to be decomposed to a type
200200
/// param for cleaner code.
201-
fn suggest_restriction(
201+
fn suggest_restriction<'tcx>(
202202
tcx: TyCtxt<'tcx>,
203203
generics: &hir::Generics<'tcx>,
204204
msg: &str,

compiler/rustc_trait_selection/src/traits/fulfill.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ struct FulfillProcessor<'a, 'b, 'tcx> {
252252
register_region_obligations: bool,
253253
}
254254

255-
fn mk_pending(os: Vec<PredicateObligation<'tcx>>) -> Vec<PendingPredicateObligation<'tcx>> {
255+
fn mk_pending(os: Vec<PredicateObligation<'_>>) -> Vec<PendingPredicateObligation<'_>> {
256256
os.into_iter()
257257
.map(|o| PendingPredicateObligation { obligation: o, stalled_on: vec![] })
258258
.collect()

compiler/rustc_trait_selection/src/traits/misc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum CopyImplementationError<'tcx> {
1616
HasDestructor,
1717
}
1818

19-
pub fn can_type_implement_copy(
19+
pub fn can_type_implement_copy<'tcx>(
2020
tcx: TyCtxt<'tcx>,
2121
param_env: ty::ParamEnv<'tcx>,
2222
self_type: Ty<'tcx>,

compiler/rustc_trait_selection/src/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ fn vtable_trait_first_method_offset<'tcx>(
801801
}
802802

803803
/// Find slot offset for trait vptr within vtable entries of another trait
804-
pub fn vtable_trait_upcasting_coercion_new_vptr_slot(
804+
pub fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
805805
tcx: TyCtxt<'tcx>,
806806
key: (
807807
Ty<'tcx>, // trait object type whose trait owning vtable

compiler/rustc_trait_selection/src/traits/object_safety.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ pub fn astconv_object_safety_violations(
5050
violations
5151
}
5252

53-
fn object_safety_violations(
54-
tcx: TyCtxt<'tcx>,
55-
trait_def_id: DefId,
56-
) -> &'tcx [ObjectSafetyViolation] {
53+
fn object_safety_violations(tcx: TyCtxt<'_>, trait_def_id: DefId) -> &'_ [ObjectSafetyViolation] {
5754
debug_assert!(tcx.generics_of(trait_def_id).has_self);
5855
debug!("object_safety_violations: {:?}", trait_def_id);
5956

@@ -272,7 +269,7 @@ fn bounds_reference_self(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SmallVec<[Span
272269
.collect()
273270
}
274271

275-
fn predicate_references_self(
272+
fn predicate_references_self<'tcx>(
276273
tcx: TyCtxt<'tcx>,
277274
(predicate, sp): (ty::Predicate<'tcx>, Span),
278275
) -> Option<Span> {

compiler/rustc_trait_selection/src/traits/project.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
570570
}
571571
}
572572

573-
impl TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
573+
impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
574574
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
575575
self.infcx.tcx
576576
}
@@ -678,7 +678,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
678678
}
679679
}
680680

681-
impl TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> {
681+
impl<'tcx> TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> {
682682
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
683683
self.infcx.tcx
684684
}
@@ -1937,14 +1937,14 @@ fn assoc_ty_def(
19371937
}
19381938
}
19391939

1940-
crate trait ProjectionCacheKeyExt<'tcx>: Sized {
1940+
crate trait ProjectionCacheKeyExt<'cx, 'tcx>: Sized {
19411941
fn from_poly_projection_predicate(
19421942
selcx: &mut SelectionContext<'cx, 'tcx>,
19431943
predicate: ty::PolyProjectionPredicate<'tcx>,
19441944
) -> Option<Self>;
19451945
}
19461946

1947-
impl<'tcx> ProjectionCacheKeyExt<'tcx> for ProjectionCacheKey<'tcx> {
1947+
impl<'cx, 'tcx> ProjectionCacheKeyExt<'cx, 'tcx> for ProjectionCacheKey<'tcx> {
19481948
fn from_poly_projection_predicate(
19491949
selcx: &mut SelectionContext<'cx, 'tcx>,
19501950
predicate: ty::PolyProjectionPredicate<'tcx>,

compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait Normalizable<'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'tcx> + Cop
3131
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self>>;
3232
}
3333

34-
impl Normalizable<'tcx> for Ty<'tcx> {
34+
impl<'tcx> Normalizable<'tcx> for Ty<'tcx> {
3535
fn type_op_method(
3636
tcx: TyCtxt<'tcx>,
3737
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
@@ -40,7 +40,7 @@ impl Normalizable<'tcx> for Ty<'tcx> {
4040
}
4141
}
4242

43-
impl Normalizable<'tcx> for ty::Predicate<'tcx> {
43+
impl<'tcx> Normalizable<'tcx> for ty::Predicate<'tcx> {
4444
fn type_op_method(
4545
tcx: TyCtxt<'tcx>,
4646
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
@@ -49,7 +49,7 @@ impl Normalizable<'tcx> for ty::Predicate<'tcx> {
4949
}
5050
}
5151

52-
impl Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
52+
impl<'tcx> Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
5353
fn type_op_method(
5454
tcx: TyCtxt<'tcx>,
5555
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,
@@ -58,7 +58,7 @@ impl Normalizable<'tcx> for ty::PolyFnSig<'tcx> {
5858
}
5959
}
6060

61-
impl Normalizable<'tcx> for ty::FnSig<'tcx> {
61+
impl<'tcx> Normalizable<'tcx> for ty::FnSig<'tcx> {
6262
fn type_op_method(
6363
tcx: TyCtxt<'tcx>,
6464
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Normalize<Self>>>,

compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<'tcx> DropckOutlives<'tcx> {
1414
}
1515
}
1616

17-
impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
17+
impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
1818
type QueryResponse = DropckOutlivesResult<'tcx>;
1919

2020
fn try_fast_path(

compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum Inserted {
3232
ShouldRecurseOn(DefId),
3333
}
3434

35-
trait ChildrenExt {
35+
trait ChildrenExt<'tcx> {
3636
fn insert_blindly(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId);
3737
fn remove_existing(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId);
3838

@@ -44,9 +44,9 @@ trait ChildrenExt {
4444
) -> Result<Inserted, OverlapError>;
4545
}
4646

47-
impl ChildrenExt for Children {
47+
impl ChildrenExt<'_> for Children {
4848
/// Insert an impl into this set of children without comparing to any existing impls.
49-
fn insert_blindly(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
49+
fn insert_blindly(&mut self, tcx: TyCtxt<'_>, impl_def_id: DefId) {
5050
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
5151
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
5252
debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st);
@@ -60,7 +60,7 @@ impl ChildrenExt for Children {
6060
/// Removes an impl from this set of children. Used when replacing
6161
/// an impl with a parent. The impl must be present in the list of
6262
/// children already.
63-
fn remove_existing(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
63+
fn remove_existing(&mut self, tcx: TyCtxt<'_>, impl_def_id: DefId) {
6464
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
6565
let vec: &mut Vec<DefId>;
6666
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
@@ -79,7 +79,7 @@ impl ChildrenExt for Children {
7979
/// specialization relationships.
8080
fn insert(
8181
&mut self,
82-
tcx: TyCtxt<'tcx>,
82+
tcx: TyCtxt<'_>,
8383
impl_def_id: DefId,
8484
simplified_self: Option<SimplifiedType>,
8585
) -> Result<Inserted, OverlapError> {
@@ -261,12 +261,12 @@ pub trait GraphExt {
261261
/// information about the area of overlap is returned in the `Err`.
262262
fn insert(
263263
&mut self,
264-
tcx: TyCtxt<'tcx>,
264+
tcx: TyCtxt<'_>,
265265
impl_def_id: DefId,
266266
) -> Result<Option<FutureCompatOverlapError>, OverlapError>;
267267

268268
/// Insert cached metadata mapping from a child impl back to its parent.
269-
fn record_impl_from_cstore(&mut self, tcx: TyCtxt<'tcx>, parent: DefId, child: DefId);
269+
fn record_impl_from_cstore(&mut self, tcx: TyCtxt<'_>, parent: DefId, child: DefId);
270270
}
271271

272272
impl GraphExt for Graph {
@@ -275,7 +275,7 @@ impl GraphExt for Graph {
275275
/// information about the area of overlap is returned in the `Err`.
276276
fn insert(
277277
&mut self,
278-
tcx: TyCtxt<'tcx>,
278+
tcx: TyCtxt<'_>,
279279
impl_def_id: DefId,
280280
) -> Result<Option<FutureCompatOverlapError>, OverlapError> {
281281
assert!(impl_def_id.is_local());
@@ -370,7 +370,7 @@ impl GraphExt for Graph {
370370
}
371371

372372
/// Insert cached metadata mapping from a child impl back to its parent.
373-
fn record_impl_from_cstore(&mut self, tcx: TyCtxt<'tcx>, parent: DefId, child: DefId) {
373+
fn record_impl_from_cstore(&mut self, tcx: TyCtxt<'_>, parent: DefId, child: DefId) {
374374
if self.parent.insert(child, parent).is_some() {
375375
bug!(
376376
"When recording an impl from the crate store, information about its parent \

compiler/rustc_trait_selection/src/traits/structural_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn search_for_structural_match_violation<'tcx>(
6666
///
6767
/// Note that this does *not* recursively check if the substructure of `adt_ty`
6868
/// implements the traits.
69-
fn type_marked_structural(
69+
fn type_marked_structural<'tcx>(
7070
infcx: &InferCtxt<'_, 'tcx>,
7171
adt_ty: Ty<'tcx>,
7272
cause: ObligationCause<'tcx>,
@@ -119,7 +119,7 @@ struct Search<'a, 'tcx> {
119119
seen: FxHashSet<hir::def_id::DefId>,
120120
}
121121

122-
impl Search<'a, 'tcx> {
122+
impl<'a, 'tcx> Search<'a, 'tcx> {
123123
fn tcx(&self) -> TyCtxt<'tcx> {
124124
self.infcx.tcx
125125
}

0 commit comments

Comments
 (0)