Skip to content

Commit 0c594f8

Browse files
committed
Remove in_band_lifetimes from borrowck
1 parent b9a37ad commit 0c594f8

15 files changed

+32
-33
lines changed

compiler/rustc_borrowck/src/borrow_set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub enum LocalsStateAtExit {
8484
}
8585

8686
impl LocalsStateAtExit {
87-
fn build(
87+
fn build<'tcx>(
8888
locals_are_invalidated_at_exit: bool,
8989
body: &Body<'tcx>,
9090
move_data: &MoveData<'tcx>,

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum UniverseInfoInner<'tcx> {
3131
Other,
3232
}
3333

34-
impl UniverseInfo<'tcx> {
34+
impl<'tcx> UniverseInfo<'tcx> {
3535
crate fn other() -> UniverseInfo<'tcx> {
3636
UniverseInfo(UniverseInfoInner::Other)
3737
}
@@ -191,7 +191,7 @@ struct PredicateQuery<'tcx> {
191191
base_universe: ty::UniverseIndex,
192192
}
193193

194-
impl TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
194+
impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
195195
fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
196196
let mut err = tcx.sess.struct_span_err(span, "higher-ranked lifetime error");
197197
err.note(&format!("could not prove {}", self.canonical_query.value.value.predicate));
@@ -231,7 +231,7 @@ struct NormalizeQuery<'tcx, T> {
231231
base_universe: ty::UniverseIndex,
232232
}
233233

234-
impl<T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T>
234+
impl<'tcx, T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T>
235235
where
236236
T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx,
237237
{
@@ -291,7 +291,7 @@ struct AscribeUserTypeQuery<'tcx> {
291291
base_universe: ty::UniverseIndex,
292292
}
293293

294-
impl TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> {
294+
impl<'tcx> TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> {
295295
fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
296296
// FIXME: This error message isn't great, but it doesn't show up in the existing UI tests,
297297
// and is only the fallback when the nice error fails. Consider improving this some more.

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1513,8 +1513,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
15131513
location: Location,
15141514
mpi: MovePathIndex,
15151515
) -> (Vec<MoveSite>, Vec<Location>) {
1516-
fn predecessor_locations(
1517-
body: &'a mir::Body<'tcx>,
1516+
fn predecessor_locations<'a>(
1517+
body: &'a mir::Body<'_>,
15181518
location: Location,
15191519
) -> impl Iterator<Item = Location> + 'a {
15201520
if location.statement_index == 0 {

compiler/rustc_borrowck/src/diagnostics/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
408408
/// Add a note that a type does not implement `Copy`
409409
pub(super) fn note_type_does_not_implement_copy(
410410
&self,
411-
err: &mut DiagnosticBuilder<'a>,
411+
err: &mut DiagnosticBuilder<'_>,
412412
place_desc: &str,
413413
ty: Ty<'tcx>,
414414
span: Option<Span>,
@@ -732,7 +732,7 @@ pub(super) enum BorrowedContentSource<'tcx> {
732732
OverloadedIndex(Ty<'tcx>),
733733
}
734734

735-
impl BorrowedContentSource<'tcx> {
735+
impl<'tcx> BorrowedContentSource<'tcx> {
736736
pub(super) fn describe_for_unnamed_place(&self, tcx: TyCtxt<'_>) -> String {
737737
match *self {
738738
BorrowedContentSource::DerefRawPointer => "a raw pointer".to_string(),

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
747747
HirId, ImplItem, ImplItemKind, Item, ItemKind,
748748
};
749749

750-
fn maybe_body_id_of_fn(hir_map: &Map<'tcx>, id: HirId) -> Option<BodyId> {
750+
fn maybe_body_id_of_fn(hir_map: &Map<'_>, id: HirId) -> Option<BodyId> {
751751
match hir_map.find(id) {
752752
Some(Node::Item(Item { kind: ItemKind::Fn(_, _, body_id), .. }))
753753
| Some(Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(_, body_id), .. })) => {
@@ -1066,7 +1066,7 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool {
10661066
/// LL | s: &'a String
10671067
/// | ---------- use `&'a mut String` here to make mutable
10681068
/// ```
1069-
fn annotate_struct_field(
1069+
fn annotate_struct_field<'tcx>(
10701070
tcx: TyCtxt<'tcx>,
10711071
ty: Ty<'tcx>,
10721072
field: &mir::Field,

compiler/rustc_borrowck/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(bool_to_option)]
44
#![feature(box_patterns)]
55
#![feature(crate_visibility_modifier)]
6-
#![feature(in_band_lifetimes)]
76
#![feature(iter_zip)]
87
#![feature(let_else)]
98
#![feature(min_specialization)]

compiler/rustc_borrowck/src/member_constraints.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ rustc_index::newtype_index! {
5353
}
5454
}
5555

56-
impl Default for MemberConstraintSet<'tcx, ty::RegionVid> {
56+
impl Default for MemberConstraintSet<'_, ty::RegionVid> {
5757
fn default() -> Self {
5858
Self {
5959
first_constraints: Default::default(),
@@ -97,7 +97,7 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
9797
}
9898
}
9999

100-
impl<R1> MemberConstraintSet<'tcx, R1>
100+
impl<'tcx, R1> MemberConstraintSet<'tcx, R1>
101101
where
102102
R1: Copy + Hash + Eq,
103103
{
@@ -140,7 +140,7 @@ where
140140
}
141141
}
142142

143-
impl<R> MemberConstraintSet<'tcx, R>
143+
impl<R> MemberConstraintSet<'_, R>
144144
where
145145
R: Copy + Hash + Eq,
146146
{

compiler/rustc_borrowck/src/path_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub(super) fn borrow_of_local_data(place: Place<'_>) -> bool {
141141
/// then returns the index of the field being projected. Note that this closure will always
142142
/// be `self` in the current MIR, because that is the only time we directly access the fields
143143
/// of a closure type.
144-
pub(crate) fn is_upvar_field_projection(
144+
pub(crate) fn is_upvar_field_projection<'tcx>(
145145
tcx: TyCtxt<'tcx>,
146146
upvars: &[Upvar<'tcx>],
147147
place_ref: PlaceRef<'tcx>,

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ crate struct CreateResult<'tcx> {
5858
crate normalized_inputs_and_output: NormalizedInputsAndOutput<'tcx>,
5959
}
6060

61-
crate fn create(
61+
crate fn create<'tcx>(
6262
infcx: &InferCtxt<'_, 'tcx>,
6363
param_env: ty::ParamEnv<'tcx>,
6464
implicit_region_bound: Option<ty::Region<'tcx>>,
@@ -81,7 +81,7 @@ crate fn create(
8181
.create()
8282
}
8383

84-
impl UniversalRegionRelations<'tcx> {
84+
impl UniversalRegionRelations<'_> {
8585
/// Records in the `outlives_relation` (and
8686
/// `inverse_outlives_relation`) that `fr_a: fr_b`. Invoked by the
8787
/// builder below.
@@ -110,7 +110,7 @@ impl UniversalRegionRelations<'tcx> {
110110
/// outlives `fr` and (b) is not local.
111111
///
112112
/// (*) If there are multiple competing choices, we return all of them.
113-
crate fn non_local_upper_bounds(&'a self, fr: &'a RegionVid) -> Vec<&'a RegionVid> {
113+
crate fn non_local_upper_bounds<'a>(&'a self, fr: &'a RegionVid) -> Vec<&'a RegionVid> {
114114
debug!("non_local_upper_bound(fr={:?})", fr);
115115
let res = self.non_local_bounds(&self.inverse_outlives, fr);
116116
assert!(!res.is_empty(), "can't find an upper bound!?");
@@ -232,7 +232,7 @@ struct UniversalRegionRelationsBuilder<'this, 'tcx> {
232232
region_bound_pairs: RegionBoundPairs<'tcx>,
233233
}
234234

235-
impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
235+
impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
236236
crate fn create(mut self) -> CreateResult<'tcx> {
237237
let unnormalized_input_output_tys = self
238238
.universal_regions

compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl LocalUseMapBuild<'_> {
152152
}
153153
}
154154

155-
impl Visitor<'tcx> for LocalUseMapBuild<'_> {
155+
impl Visitor<'_> for LocalUseMapBuild<'_> {
156156
fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) {
157157
if self.locals_with_use_data[local] {
158158
match def_use::categorize(context) {

compiler/rustc_borrowck/src/type_check/liveness/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub(super) fn generate<'mir, 'tcx>(
7474
// to compute whether a variable `X` is live if that variable contains
7575
// some region `R` in its type where `R` is not known to outlive a free
7676
// region (i.e., where `R` may be valid for just a subset of the fn body).
77-
fn compute_live_locals(
77+
fn compute_live_locals<'tcx>(
7878
tcx: TyCtxt<'tcx>,
7979
free_regions: &FxHashSet<RegionVid>,
8080
body: &Body<'tcx>,
@@ -104,7 +104,7 @@ fn compute_live_locals(
104104
/// regions. For these regions, we do not need to compute
105105
/// liveness, since the outlives constraints will ensure that they
106106
/// are live over the whole fn body anyhow.
107-
fn regions_that_outlive_free_regions(
107+
fn regions_that_outlive_free_regions<'tcx>(
108108
num_region_vars: usize,
109109
universal_regions: &UniversalRegions<'tcx>,
110110
constraint_set: &OutlivesConstraintSet<'tcx>,

compiler/rustc_borrowck/src/type_check/liveness/polonius.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl UseFactsExtractor<'_> {
5353
}
5454
}
5555

56-
impl Visitor<'tcx> for UseFactsExtractor<'_> {
56+
impl Visitor<'_> for UseFactsExtractor<'_> {
5757
fn visit_local(&mut self, &local: &Local, context: PlaceContext, location: Location) {
5858
match def_use::categorize(context) {
5959
Some(DefUse::Def) => self.insert_def(local, location),
@@ -63,7 +63,7 @@ impl Visitor<'tcx> for UseFactsExtractor<'_> {
6363
}
6464
}
6565

66-
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
66+
fn visit_place(&mut self, place: &Place<'_>, context: PlaceContext, location: Location) {
6767
self.super_place(place, context, location);
6868
match context {
6969
PlaceContext::NonMutatingUse(_) => {
@@ -82,7 +82,7 @@ impl Visitor<'tcx> for UseFactsExtractor<'_> {
8282
}
8383
}
8484

85-
pub(super) fn populate_access_facts(
85+
pub(super) fn populate_access_facts<'tcx>(
8686
typeck: &mut TypeChecker<'_, 'tcx>,
8787
body: &Body<'tcx>,
8888
location_table: &LocationTable,
@@ -123,7 +123,7 @@ pub(super) fn populate_access_facts(
123123

124124
// For every potentially drop()-touched region `region` in `local`'s type
125125
// (`kind`), emit a Polonius `use_of_var_derefs_origin(local, origin)` fact.
126-
pub(super) fn add_drop_of_var_derefs_origin(
126+
pub(super) fn add_drop_of_var_derefs_origin<'tcx>(
127127
typeck: &mut TypeChecker<'_, 'tcx>,
128128
local: Local,
129129
kind: &GenericArg<'tcx>,

compiler/rustc_borrowck/src/type_check/liveness/trace.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::{
3434
/// DROP-LIVE set are to the liveness sets for regions found in the
3535
/// `dropck_outlives` result of the variable's type (in particular,
3636
/// this respects `#[may_dangle]` annotations).
37-
pub(super) fn trace(
37+
pub(super) fn trace<'mir, 'tcx>(
3838
typeck: &mut TypeChecker<'_, 'tcx>,
3939
body: &Body<'tcx>,
4040
elements: &Rc<RegionValueElements>,
@@ -119,7 +119,7 @@ struct LivenessResults<'me, 'typeck, 'flow, 'tcx> {
119119
stack: Vec<PointIndex>,
120120
}
121121

122-
impl LivenessResults<'me, 'typeck, 'flow, 'tcx> {
122+
impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> {
123123
fn new(cx: LivenessContext<'me, 'typeck, 'flow, 'tcx>) -> Self {
124124
let num_points = cx.elements.num_points();
125125
LivenessResults {
@@ -418,7 +418,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'tcx> {
418418
}
419419
}
420420

421-
impl LivenessContext<'_, '_, '_, 'tcx> {
421+
impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
422422
/// Returns `true` if the local variable (or some part of it) is initialized at the current
423423
/// cursor position. Callers should call one of the `seek` methods immediately before to point
424424
/// the cursor to the desired location.

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ crate struct MirTypeckRegionConstraints<'tcx> {
945945
crate type_tests: Vec<TypeTest<'tcx>>,
946946
}
947947

948-
impl MirTypeckRegionConstraints<'tcx> {
948+
impl<'tcx> MirTypeckRegionConstraints<'tcx> {
949949
fn placeholder_region(
950950
&mut self,
951951
infcx: &InferCtxt<'_, 'tcx>,

compiler/rustc_borrowck/src/type_check/relate_tys.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
5151
universe_info: UniverseInfo<'tcx>,
5252
}
5353

54-
impl NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
54+
impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
5555
fn new(
5656
type_checker: &'me mut TypeChecker<'bccx, 'tcx>,
5757
locations: Locations,
@@ -62,7 +62,7 @@ impl NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
6262
}
6363
}
6464

65-
impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
65+
impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
6666
fn param_env(&self) -> ty::ParamEnv<'tcx> {
6767
self.type_checker.param_env
6868
}

0 commit comments

Comments
 (0)