Skip to content

Commit 5fe0e40

Browse files
committed
Auto merge of rust-lang#130357 - fmease:rollup-j3ej4q0, r=fmease
Rollup of 6 pull requests Successful merges: - rust-lang#130017 (coverage: Extract `executor::block_on` from several async coverage tests) - rust-lang#130268 (simd_shuffle: require index argument to be a vector) - rust-lang#130290 (Stabilize entry_insert) - rust-lang#130294 (Lifetime cleanups) - rust-lang#130343 (docs: Enable required feature for 'closure_returning_async_block' lint) - rust-lang#130349 (Fix `Parser::break_up_float`'s right span) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e7386b3 + 2b40fdb commit 5fe0e40

File tree

94 files changed

+645
-874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+645
-874
lines changed

compiler/rustc_arena/src/lib.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -614,34 +614,34 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
614614

615615
pub trait ArenaAllocatable<'tcx, C = rustc_arena::IsNotCopy>: Sized {
616616
#[allow(clippy::mut_from_ref)]
617-
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self;
617+
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut Self;
618618
#[allow(clippy::mut_from_ref)]
619-
fn allocate_from_iter<'a>(
620-
arena: &'a Arena<'tcx>,
619+
fn allocate_from_iter(
620+
arena: &'tcx Arena<'tcx>,
621621
iter: impl ::std::iter::IntoIterator<Item = Self>,
622-
) -> &'a mut [Self];
622+
) -> &'tcx mut [Self];
623623
}
624624

625625
// Any type that impls `Copy` can be arena-allocated in the `DroplessArena`.
626626
impl<'tcx, T: Copy> ArenaAllocatable<'tcx, rustc_arena::IsCopy> for T {
627627
#[inline]
628628
#[allow(clippy::mut_from_ref)]
629-
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
629+
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut Self {
630630
arena.dropless.alloc(self)
631631
}
632632
#[inline]
633633
#[allow(clippy::mut_from_ref)]
634-
fn allocate_from_iter<'a>(
635-
arena: &'a Arena<'tcx>,
634+
fn allocate_from_iter(
635+
arena: &'tcx Arena<'tcx>,
636636
iter: impl ::std::iter::IntoIterator<Item = Self>,
637-
) -> &'a mut [Self] {
637+
) -> &'tcx mut [Self] {
638638
arena.dropless.alloc_from_iter(iter)
639639
}
640640
}
641641
$(
642642
impl<'tcx> ArenaAllocatable<'tcx, rustc_arena::IsNotCopy> for $ty {
643643
#[inline]
644-
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
644+
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut Self {
645645
if !::std::mem::needs_drop::<Self>() {
646646
arena.dropless.alloc(self)
647647
} else {
@@ -651,10 +651,10 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
651651

652652
#[inline]
653653
#[allow(clippy::mut_from_ref)]
654-
fn allocate_from_iter<'a>(
655-
arena: &'a Arena<'tcx>,
654+
fn allocate_from_iter(
655+
arena: &'tcx Arena<'tcx>,
656656
iter: impl ::std::iter::IntoIterator<Item = Self>,
657-
) -> &'a mut [Self] {
657+
) -> &'tcx mut [Self] {
658658
if !::std::mem::needs_drop::<Self>() {
659659
arena.dropless.alloc_from_iter(iter)
660660
} else {
@@ -667,7 +667,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
667667
impl<'tcx> Arena<'tcx> {
668668
#[inline]
669669
#[allow(clippy::mut_from_ref)]
670-
pub fn alloc<T: ArenaAllocatable<'tcx, C>, C>(&self, value: T) -> &mut T {
670+
pub fn alloc<T: ArenaAllocatable<'tcx, C>, C>(&'tcx self, value: T) -> &mut T {
671671
value.allocate_on(self)
672672
}
673673

@@ -691,7 +691,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
691691

692692
#[allow(clippy::mut_from_ref)]
693693
pub fn alloc_from_iter<T: ArenaAllocatable<'tcx, C>, C>(
694-
&self,
694+
&'tcx self,
695695
iter: impl ::std::iter::IntoIterator<Item = T>,
696696
) -> &mut [T] {
697697
T::allocate_from_iter(self, iter)

compiler/rustc_borrowck/src/constraints/graph.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
9797
/// Given the constraint set from which this graph was built
9898
/// creates a region graph so that you can iterate over *regions*
9999
/// and not constraints.
100-
pub(crate) fn region_graph<'rg, 'tcx>(
101-
&'rg self,
102-
set: &'rg OutlivesConstraintSet<'tcx>,
100+
pub(crate) fn region_graph<'a, 'tcx>(
101+
&'a self,
102+
set: &'a OutlivesConstraintSet<'tcx>,
103103
static_region: RegionVid,
104-
) -> RegionGraph<'rg, 'tcx, D> {
104+
) -> RegionGraph<'a, 'tcx, D> {
105105
RegionGraph::new(set, self, static_region)
106106
}
107107

@@ -130,15 +130,15 @@ impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
130130
}
131131
}
132132

133-
pub(crate) struct Edges<'s, 'tcx, D: ConstraintGraphDirection> {
134-
graph: &'s ConstraintGraph<D>,
135-
constraints: &'s OutlivesConstraintSet<'tcx>,
133+
pub(crate) struct Edges<'a, 'tcx, D: ConstraintGraphDirection> {
134+
graph: &'a ConstraintGraph<D>,
135+
constraints: &'a OutlivesConstraintSet<'tcx>,
136136
pointer: Option<OutlivesConstraintIndex>,
137137
next_static_idx: Option<usize>,
138138
static_region: RegionVid,
139139
}
140140

141-
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'s, 'tcx, D> {
141+
impl<'a, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'a, 'tcx, D> {
142142
type Item = OutlivesConstraint<'tcx>;
143143

144144
fn next(&mut self) -> Option<Self::Item> {
@@ -171,55 +171,55 @@ impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'s, 'tcx, D> {
171171
/// This struct brings together a constraint set and a (normal, not
172172
/// reverse) constraint graph. It implements the graph traits and is
173173
/// usd for doing the SCC computation.
174-
pub(crate) struct RegionGraph<'s, 'tcx, D: ConstraintGraphDirection> {
175-
set: &'s OutlivesConstraintSet<'tcx>,
176-
constraint_graph: &'s ConstraintGraph<D>,
174+
pub(crate) struct RegionGraph<'a, 'tcx, D: ConstraintGraphDirection> {
175+
set: &'a OutlivesConstraintSet<'tcx>,
176+
constraint_graph: &'a ConstraintGraph<D>,
177177
static_region: RegionVid,
178178
}
179179

180-
impl<'s, 'tcx, D: ConstraintGraphDirection> RegionGraph<'s, 'tcx, D> {
180+
impl<'a, 'tcx, D: ConstraintGraphDirection> RegionGraph<'a, 'tcx, D> {
181181
/// Creates a "dependency graph" where each region constraint `R1:
182182
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
183183
/// construct SCCs for region inference but also for error
184184
/// reporting.
185185
pub(crate) fn new(
186-
set: &'s OutlivesConstraintSet<'tcx>,
187-
constraint_graph: &'s ConstraintGraph<D>,
186+
set: &'a OutlivesConstraintSet<'tcx>,
187+
constraint_graph: &'a ConstraintGraph<D>,
188188
static_region: RegionVid,
189189
) -> Self {
190190
Self { set, constraint_graph, static_region }
191191
}
192192

193193
/// Given a region `R`, iterate over all regions `R1` such that
194194
/// there exists a constraint `R: R1`.
195-
pub(crate) fn outgoing_regions(&self, region_sup: RegionVid) -> Successors<'s, 'tcx, D> {
195+
pub(crate) fn outgoing_regions(&self, region_sup: RegionVid) -> Successors<'a, 'tcx, D> {
196196
Successors {
197197
edges: self.constraint_graph.outgoing_edges(region_sup, self.set, self.static_region),
198198
}
199199
}
200200
}
201201

202-
pub(crate) struct Successors<'s, 'tcx, D: ConstraintGraphDirection> {
203-
edges: Edges<'s, 'tcx, D>,
202+
pub(crate) struct Successors<'a, 'tcx, D: ConstraintGraphDirection> {
203+
edges: Edges<'a, 'tcx, D>,
204204
}
205205

206-
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'s, 'tcx, D> {
206+
impl<'a, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'a, 'tcx, D> {
207207
type Item = RegionVid;
208208

209209
fn next(&mut self) -> Option<Self::Item> {
210210
self.edges.next().map(|c| D::end_region(&c))
211211
}
212212
}
213213

214-
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph<'s, 'tcx, D> {
214+
impl<'a, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph<'a, 'tcx, D> {
215215
type Node = RegionVid;
216216

217217
fn num_nodes(&self) -> usize {
218218
self.constraint_graph.first_constraints.len()
219219
}
220220
}
221221

222-
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::Successors for RegionGraph<'s, 'tcx, D> {
222+
impl<'a, 'tcx, D: ConstraintGraphDirection> graph::Successors for RegionGraph<'a, 'tcx, D> {
223223
fn successors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> {
224224
self.outgoing_regions(node)
225225
}

compiler/rustc_borrowck/src/dataflow.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ pub struct Borrows<'a, 'tcx> {
112112
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
113113
}
114114

115-
struct OutOfScopePrecomputer<'mir, 'tcx> {
115+
struct OutOfScopePrecomputer<'a, 'tcx> {
116116
visited: BitSet<mir::BasicBlock>,
117117
visit_stack: Vec<mir::BasicBlock>,
118-
body: &'mir Body<'tcx>,
119-
regioncx: &'mir RegionInferenceContext<'tcx>,
118+
body: &'a Body<'tcx>,
119+
regioncx: &'a RegionInferenceContext<'tcx>,
120120
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
121121
}
122122

123-
impl<'mir, 'tcx> OutOfScopePrecomputer<'mir, 'tcx> {
124-
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
123+
impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> {
124+
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
125125
OutOfScopePrecomputer {
126126
visited: BitSet::new_empty(body.basic_blocks.len()),
127127
visit_stack: vec![],
@@ -224,17 +224,17 @@ pub fn calculate_borrows_out_of_scope_at_location<'tcx>(
224224
prec.borrows_out_of_scope_at_location
225225
}
226226

227-
struct PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
227+
struct PoloniusOutOfScopePrecomputer<'a, 'tcx> {
228228
visited: BitSet<mir::BasicBlock>,
229229
visit_stack: Vec<mir::BasicBlock>,
230-
body: &'mir Body<'tcx>,
231-
regioncx: &'mir RegionInferenceContext<'tcx>,
230+
body: &'a Body<'tcx>,
231+
regioncx: &'a RegionInferenceContext<'tcx>,
232232

233233
loans_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
234234
}
235235

236-
impl<'mir, 'tcx> PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
237-
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
236+
impl<'a, 'tcx> PoloniusOutOfScopePrecomputer<'a, 'tcx> {
237+
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
238238
Self {
239239
visited: BitSet::new_empty(body.basic_blocks.len()),
240240
visit_stack: vec![],

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3553,7 +3553,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
35533553
location: Location,
35543554
mpi: MovePathIndex,
35553555
) -> (Vec<MoveSite>, Vec<Location>) {
3556-
fn predecessor_locations<'tcx, 'a>(
3556+
fn predecessor_locations<'a, 'tcx>(
35573557
body: &'a mir::Body<'tcx>,
35583558
location: Location,
35593559
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {

compiler/rustc_borrowck/src/diagnostics/find_use.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ pub(crate) fn find<'tcx>(
2121
uf.find()
2222
}
2323

24-
struct UseFinder<'cx, 'tcx> {
25-
body: &'cx Body<'tcx>,
26-
regioncx: &'cx Rc<RegionInferenceContext<'tcx>>,
24+
struct UseFinder<'a, 'tcx> {
25+
body: &'a Body<'tcx>,
26+
regioncx: &'a Rc<RegionInferenceContext<'tcx>>,
2727
tcx: TyCtxt<'tcx>,
2828
region_vid: RegionVid,
2929
start_point: Location,
3030
}
3131

32-
impl<'cx, 'tcx> UseFinder<'cx, 'tcx> {
32+
impl<'a, 'tcx> UseFinder<'a, 'tcx> {
3333
fn find(&mut self) -> Option<Cause> {
3434
let mut queue = VecDeque::new();
3535
let mut visited = FxIndexSet::default();
@@ -93,8 +93,8 @@ impl<'cx, 'tcx> UseFinder<'cx, 'tcx> {
9393
}
9494
}
9595

96-
struct DefUseVisitor<'cx, 'tcx> {
97-
body: &'cx Body<'tcx>,
96+
struct DefUseVisitor<'a, 'tcx> {
97+
body: &'a Body<'tcx>,
9898
tcx: TyCtxt<'tcx>,
9999
region_vid: RegionVid,
100100
def_use_result: Option<DefUseResult>,
@@ -106,7 +106,7 @@ enum DefUseResult {
106106
UseDrop { local: Local },
107107
}
108108

109-
impl<'cx, 'tcx> Visitor<'tcx> for DefUseVisitor<'cx, 'tcx> {
109+
impl<'a, 'tcx> Visitor<'tcx> for DefUseVisitor<'a, 'tcx> {
110110
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
111111
let local_ty = self.body.local_decls[local].ty;
112112

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
558558
ty: Ty<'tcx>,
559559
suggested: bool,
560560
}
561-
impl<'a, 'cx, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'cx, 'tcx> {
561+
impl<'a, 'infcx, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'infcx, 'tcx> {
562562
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
563563
hir::intravisit::walk_stmt(self, stmt);
564564
let expr = match stmt.kind {

compiler/rustc_borrowck/src/polonius/loan_invalidations.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ pub(super) fn emit_loan_invalidations<'tcx>(
3232
visitor.visit_body(body);
3333
}
3434

35-
struct LoanInvalidationsGenerator<'cx, 'tcx> {
35+
struct LoanInvalidationsGenerator<'a, 'tcx> {
3636
tcx: TyCtxt<'tcx>,
37-
all_facts: &'cx mut AllFacts,
38-
location_table: &'cx LocationTable,
39-
body: &'cx Body<'tcx>,
40-
dominators: &'cx Dominators<BasicBlock>,
41-
borrow_set: &'cx BorrowSet<'tcx>,
37+
all_facts: &'a mut AllFacts,
38+
location_table: &'a LocationTable,
39+
body: &'a Body<'tcx>,
40+
dominators: &'a Dominators<BasicBlock>,
41+
borrow_set: &'a BorrowSet<'tcx>,
4242
}
4343

4444
/// Visits the whole MIR and generates `invalidates()` facts.
4545
/// Most of the code implementing this was stolen from `borrow_check/mod.rs`.
46-
impl<'cx, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'cx, 'tcx> {
46+
impl<'a, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'a, 'tcx> {
4747
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
4848
self.check_activations(location);
4949

@@ -212,7 +212,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'cx, 'tcx> {
212212
}
213213
}
214214

215-
impl<'cx, 'tcx> LoanInvalidationsGenerator<'cx, 'tcx> {
215+
impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
216216
/// Simulates mutation of a place.
217217
fn mutate_place(&mut self, location: Location, place: Place<'tcx>, kind: AccessDepth) {
218218
self.access_place(

compiler/rustc_borrowck/src/polonius/loan_kills.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ pub(super) fn emit_loan_kills<'tcx>(
2525
}
2626
}
2727

28-
struct LoanKillsGenerator<'cx, 'tcx> {
28+
struct LoanKillsGenerator<'a, 'tcx> {
2929
tcx: TyCtxt<'tcx>,
30-
all_facts: &'cx mut AllFacts,
31-
location_table: &'cx LocationTable,
32-
borrow_set: &'cx BorrowSet<'tcx>,
33-
body: &'cx Body<'tcx>,
30+
all_facts: &'a mut AllFacts,
31+
location_table: &'a LocationTable,
32+
borrow_set: &'a BorrowSet<'tcx>,
33+
body: &'a Body<'tcx>,
3434
}
3535

36-
impl<'cx, 'tcx> Visitor<'tcx> for LoanKillsGenerator<'cx, 'tcx> {
36+
impl<'a, 'tcx> Visitor<'tcx> for LoanKillsGenerator<'a, 'tcx> {
3737
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
3838
// Also record CFG facts here.
3939
self.all_facts.cfg_edge.push((

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ impl UniversalRegionRelations<'_> {
181181
}
182182
}
183183

184-
struct UniversalRegionRelationsBuilder<'this, 'tcx> {
185-
infcx: &'this InferCtxt<'tcx>,
184+
struct UniversalRegionRelationsBuilder<'a, 'tcx> {
185+
infcx: &'a InferCtxt<'tcx>,
186186
param_env: ty::ParamEnv<'tcx>,
187187
universal_regions: Rc<UniversalRegions<'tcx>>,
188188
implicit_region_bound: ty::Region<'tcx>,
189-
constraints: &'this mut MirTypeckRegionConstraints<'tcx>,
189+
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
190190

191191
// outputs:
192192
outlives: TransitiveRelationBuilder<RegionVid>,

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ fn record_regular_live_regions<'tcx>(
148148
}
149149

150150
/// Visitor looking for regions that should be live within rvalues or calls.
151-
struct LiveVariablesVisitor<'cx, 'tcx> {
151+
struct LiveVariablesVisitor<'a, 'tcx> {
152152
tcx: TyCtxt<'tcx>,
153-
liveness_constraints: &'cx mut LivenessValues,
153+
liveness_constraints: &'a mut LivenessValues,
154154
}
155155

156-
impl<'cx, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'cx, 'tcx> {
156+
impl<'a, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'a, 'tcx> {
157157
/// We sometimes have `args` within an rvalue, or within a
158158
/// call. Make them live at the location where they appear.
159159
fn visit_args(&mut self, args: &GenericArgsRef<'tcx>, location: Location) {
@@ -188,7 +188,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'cx, 'tcx> {
188188
}
189189
}
190190

191-
impl<'cx, 'tcx> LiveVariablesVisitor<'cx, 'tcx> {
191+
impl<'a, 'tcx> LiveVariablesVisitor<'a, 'tcx> {
192192
/// Some variable is "regular live" at `location` -- i.e., it may be used later. This means that
193193
/// all regions appearing in the type of `value` must be live at `location`.
194194
fn record_regions_live_at<T>(&mut self, value: T, location: Location)

0 commit comments

Comments
 (0)