Skip to content

Commit 1805b33

Browse files
committed
Auto merge of rust-lang#137466 - jhpratt:rollup-spyi02y, r=jhpratt
Rollup of 9 pull requests Successful merges: - rust-lang#135354 ([Debuginfo] Add MSVC Synthetic and Summary providers to LLDB) - rust-lang#136826 (Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in Unix) - rust-lang#137194 (More const {} init in thread_local) - rust-lang#137334 (Greatly simplify lifetime captures in edition 2024) - rust-lang#137382 (bootstrap: add doc for vendor build step) - rust-lang#137423 (Improve a bit HIR pretty printer) - rust-lang#137435 (Fix "missing match arm body" suggestion involving `!`) - rust-lang#137448 (Fix bugs due to unhandled `ControlFlow` in compiler) - rust-lang#137458 (Fix missing self subst when rendering `impl Fn*<T>` with no output type) r? `@ghost` `@rustbot` modify labels: rollup
2 parents bb2cc59 + d415200 commit 1805b33

File tree

117 files changed

+1151
-420
lines changed

Some content is hidden

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

117 files changed

+1151
-420
lines changed

compiler/rustc_abi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ impl<FieldIdx: Idx> FieldsShape<FieldIdx> {
13491349

13501350
/// Gets source indices of the fields by increasing offsets.
13511351
#[inline]
1352-
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> + '_ {
1352+
pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize> {
13531353
let mut inverse_small = [0u8; 64];
13541354
let mut inverse_big = IndexVec::new();
13551355
let use_small = self.count() <= inverse_small.len();

compiler/rustc_ast_lowering/src/lib.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use std::sync::Arc;
4545

4646
use rustc_ast::node_id::NodeMap;
4747
use rustc_ast::{self as ast, *};
48-
use rustc_data_structures::captures::Captures;
4948
use rustc_data_structures::fingerprint::Fingerprint;
5049
use rustc_data_structures::sorted_map::SortedMap;
5150
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -1821,11 +1820,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18211820
self.new_named_lifetime_with_res(new_id, ident, res)
18221821
}
18231822

1824-
fn lower_generic_params_mut<'s>(
1825-
&'s mut self,
1826-
params: &'s [GenericParam],
1823+
fn lower_generic_params_mut(
1824+
&mut self,
1825+
params: &[GenericParam],
18271826
source: hir::GenericParamSource,
1828-
) -> impl Iterator<Item = hir::GenericParam<'hir>> + Captures<'a> + Captures<'s> {
1827+
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
18291828
params.iter().map(move |param| self.lower_generic_param(param, source))
18301829
}
18311830

@@ -1986,11 +1985,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19861985
self.arena.alloc_from_iter(self.lower_param_bounds_mut(bounds, itctx))
19871986
}
19881987

1989-
fn lower_param_bounds_mut<'s>(
1990-
&'s mut self,
1991-
bounds: &'s [GenericBound],
1988+
fn lower_param_bounds_mut(
1989+
&mut self,
1990+
bounds: &[GenericBound],
19921991
itctx: ImplTraitContext,
1993-
) -> impl Iterator<Item = hir::GenericBound<'hir>> + Captures<'s> + Captures<'a> {
1992+
) -> impl Iterator<Item = hir::GenericBound<'hir>> {
19941993
bounds.iter().map(move |bound| self.lower_param_bound(bound, itctx))
19951994
}
19961995

compiler/rustc_ast_passes/src/errors.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,14 @@ pub(crate) struct NegativeBoundWithParentheticalNotation {
804804
pub(crate) struct MatchArmWithNoBody {
805805
#[primary_span]
806806
pub span: Span,
807-
#[suggestion(code = " => todo!(),", applicability = "has-placeholders")]
807+
// We include the braces around `todo!()` so that a comma is optional, and we don't have to have
808+
// any logic looking at the arm being replaced if there was a comma already or not for the
809+
// resulting code to be correct.
810+
#[suggestion(
811+
code = " => {{ todo!() }}",
812+
applicability = "has-placeholders",
813+
style = "verbose"
814+
)]
808815
pub suggestion: Span,
809816
}
810817

compiler/rustc_ast_pretty/src/pprust/state.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -424,20 +424,23 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
424424
self.ann_post(ident)
425425
}
426426

427-
fn strsep<T, F>(
427+
fn strsep<'x, T: 'x, F, I>(
428428
&mut self,
429429
sep: &'static str,
430430
space_before: bool,
431431
b: Breaks,
432-
elts: &[T],
432+
elts: I,
433433
mut op: F,
434434
) where
435435
F: FnMut(&mut Self, &T),
436+
I: IntoIterator<Item = &'x T>,
436437
{
438+
let mut it = elts.into_iter();
439+
437440
self.rbox(0, b);
438-
if let Some((first, rest)) = elts.split_first() {
441+
if let Some(first) = it.next() {
439442
op(self, first);
440-
for elt in rest {
443+
for elt in it {
441444
if space_before {
442445
self.space();
443446
}
@@ -448,9 +451,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
448451
self.end();
449452
}
450453

451-
fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], op: F)
454+
fn commasep<'x, T: 'x, F, I>(&mut self, b: Breaks, elts: I, op: F)
452455
where
453456
F: FnMut(&mut Self, &T),
457+
I: IntoIterator<Item = &'x T>,
454458
{
455459
self.strsep(",", false, b, elts, op)
456460
}

compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ use rustc_span::{Symbol, sym};
44

55
use crate::session_diagnostics;
66

7-
pub fn allow_internal_unstable<'a>(
8-
sess: &'a Session,
9-
attrs: &'a [impl AttributeExt],
10-
) -> impl Iterator<Item = Symbol> + 'a {
7+
pub fn allow_internal_unstable(
8+
sess: &Session,
9+
attrs: &[impl AttributeExt],
10+
) -> impl Iterator<Item = Symbol> {
1111
allow_unstable(sess, attrs, sym::allow_internal_unstable)
1212
}
1313

14-
pub fn rustc_allow_const_fn_unstable<'a>(
15-
sess: &'a Session,
16-
attrs: &'a [impl AttributeExt],
17-
) -> impl Iterator<Item = Symbol> + 'a {
14+
pub fn rustc_allow_const_fn_unstable(
15+
sess: &Session,
16+
attrs: &[impl AttributeExt],
17+
) -> impl Iterator<Item = Symbol> {
1818
allow_unstable(sess, attrs, sym::rustc_allow_const_fn_unstable)
1919
}
2020

21-
fn allow_unstable<'a>(
22-
sess: &'a Session,
23-
attrs: &'a [impl AttributeExt],
21+
fn allow_unstable(
22+
sess: &Session,
23+
attrs: &[impl AttributeExt],
2424
symbol: Symbol,
25-
) -> impl Iterator<Item = Symbol> + 'a {
25+
) -> impl Iterator<Item = Symbol> {
2626
let attrs = filter_by_name(attrs, symbol);
2727
let list = attrs
2828
.filter_map(move |attr| {

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::ops::ControlFlow;
88

99
use either::Either;
1010
use hir::{ClosureKind, Path};
11-
use rustc_data_structures::captures::Captures;
1211
use rustc_data_structures::fx::FxIndexSet;
1312
use rustc_errors::codes::*;
1413
use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err};
@@ -3530,10 +3529,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
35303529
location: Location,
35313530
mpi: MovePathIndex,
35323531
) -> (Vec<MoveSite>, Vec<Location>) {
3533-
fn predecessor_locations<'a, 'tcx>(
3534-
body: &'a mir::Body<'tcx>,
3532+
fn predecessor_locations<'tcx>(
3533+
body: &mir::Body<'tcx>,
35353534
location: Location,
3536-
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {
3535+
) -> impl Iterator<Item = Location> {
35373536
if location.statement_index == 0 {
35383537
let predecessors = body.basic_blocks.predecessors()[location.block].to_vec();
35393538
Either::Left(predecessors.into_iter().map(move |bb| body.terminator_loc(bb)))

compiler/rustc_borrowck/src/member_constraints.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::hash::Hash;
22
use std::ops::Index;
33

4-
use rustc_data_structures::captures::Captures;
54
use rustc_data_structures::fx::FxIndexMap;
65
use rustc_index::{IndexSlice, IndexVec};
76
use rustc_middle::ty::{self, Ty};
@@ -147,9 +146,7 @@ impl<'tcx, R> MemberConstraintSet<'tcx, R>
147146
where
148147
R: Copy + Hash + Eq,
149148
{
150-
pub(crate) fn all_indices(
151-
&self,
152-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
149+
pub(crate) fn all_indices(&self) -> impl Iterator<Item = NllMemberConstraintIndex> {
153150
self.constraints.indices()
154151
}
155152

@@ -159,7 +156,7 @@ where
159156
pub(crate) fn indices(
160157
&self,
161158
member_region_vid: R,
162-
) -> impl Iterator<Item = NllMemberConstraintIndex> + Captures<'tcx> + '_ {
159+
) -> impl Iterator<Item = NllMemberConstraintIndex> {
163160
let mut next = self.first_constraints.get(&member_region_vid).cloned();
164161
std::iter::from_fn(move || -> Option<NllMemberConstraintIndex> {
165162
if let Some(current) = next {

compiler/rustc_borrowck/src/polonius/loan_liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl LocalizedConstraintGraph {
175175
}
176176

177177
/// Returns the outgoing edges of a given node, not its transitive closure.
178-
fn outgoing_edges(&self, node: LocalizedNode) -> impl Iterator<Item = LocalizedNode> + use<'_> {
178+
fn outgoing_edges(&self, node: LocalizedNode) -> impl Iterator<Item = LocalizedNode> {
179179
// The outgoing edges are:
180180
// - the physical edges present at this node,
181181
// - the materialized logical edges that exist virtually at all points for this node's

compiler/rustc_borrowck/src/region_infer/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
576576
}
577577

578578
/// Returns an iterator over all the outlives constraints.
579-
pub(crate) fn outlives_constraints(
580-
&self,
581-
) -> impl Iterator<Item = OutlivesConstraint<'tcx>> + '_ {
579+
pub(crate) fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> {
582580
self.constraints.outlives().iter().copied()
583581
}
584582

@@ -615,10 +613,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
615613
self.scc_values.region_value_str(scc)
616614
}
617615

618-
pub(crate) fn placeholders_contained_in<'a>(
619-
&'a self,
616+
pub(crate) fn placeholders_contained_in(
617+
&self,
620618
r: RegionVid,
621-
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
619+
) -> impl Iterator<Item = ty::PlaceholderRegion> {
622620
let scc = self.constraint_sccs.scc(r);
623621
self.scc_values.placeholders_contained_in(scc)
624622
}

compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ pub(crate) struct ReverseSccGraph {
2020

2121
impl ReverseSccGraph {
2222
/// Find all universal regions that are required to outlive the given SCC.
23-
pub(super) fn upper_bounds<'a>(
24-
&'a self,
25-
scc0: ConstraintSccIndex,
26-
) -> impl Iterator<Item = RegionVid> + 'a {
23+
pub(super) fn upper_bounds(&self, scc0: ConstraintSccIndex) -> impl Iterator<Item = RegionVid> {
2724
let mut duplicates = FxIndexSet::default();
2825
graph::depth_first_search(&self.graph, scc0)
2926
.flat_map(move |scc1| {

compiler/rustc_borrowck/src/region_infer/values.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ impl LivenessValues {
8888
}
8989

9090
/// Iterate through each region that has a value in this set.
91-
pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> + '_ {
91+
pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> {
9292
self.points.as_ref().expect("use with_specific_points").rows()
9393
}
9494

9595
/// Iterate through each region that has a value in this set.
9696
// We are passing query instability implications to the caller.
9797
#[rustc_lint_query_instability]
9898
#[allow(rustc::potential_query_instability)]
99-
pub(crate) fn live_regions_unordered(&self) -> impl Iterator<Item = RegionVid> + '_ {
99+
pub(crate) fn live_regions_unordered(&self) -> impl Iterator<Item = RegionVid> {
100100
self.live_regions.as_ref().unwrap().iter().copied()
101101
}
102102

@@ -143,7 +143,7 @@ impl LivenessValues {
143143
}
144144

145145
/// Returns an iterator of all the points where `region` is live.
146-
fn live_points(&self, region: RegionVid) -> impl Iterator<Item = PointIndex> + '_ {
146+
fn live_points(&self, region: RegionVid) -> impl Iterator<Item = PointIndex> {
147147
let Some(points) = &self.points else {
148148
unreachable!(
149149
"Should be using LivenessValues::with_specific_points to ask whether live at a location"
@@ -340,7 +340,7 @@ impl<N: Idx> RegionValues<N> {
340340
}
341341

342342
/// Returns the locations contained within a given region `r`.
343-
pub(crate) fn locations_outlived_by<'a>(&'a self, r: N) -> impl Iterator<Item = Location> + 'a {
343+
pub(crate) fn locations_outlived_by(&self, r: N) -> impl Iterator<Item = Location> {
344344
self.points.row(r).into_iter().flat_map(move |set| {
345345
set.iter()
346346
.take_while(move |&p| self.location_map.point_in_range(p))
@@ -349,18 +349,15 @@ impl<N: Idx> RegionValues<N> {
349349
}
350350

351351
/// Returns just the universal regions that are contained in a given region's value.
352-
pub(crate) fn universal_regions_outlived_by<'a>(
353-
&'a self,
354-
r: N,
355-
) -> impl Iterator<Item = RegionVid> + 'a {
352+
pub(crate) fn universal_regions_outlived_by(&self, r: N) -> impl Iterator<Item = RegionVid> {
356353
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
357354
}
358355

359356
/// Returns all the elements contained in a given region's value.
360-
pub(crate) fn placeholders_contained_in<'a>(
361-
&'a self,
357+
pub(crate) fn placeholders_contained_in(
358+
&self,
362359
r: N,
363-
) -> impl Iterator<Item = ty::PlaceholderRegion> + 'a {
360+
) -> impl Iterator<Item = ty::PlaceholderRegion> {
364361
self.placeholders
365362
.row(r)
366363
.into_iter()
@@ -369,10 +366,7 @@ impl<N: Idx> RegionValues<N> {
369366
}
370367

371368
/// Returns all the elements contained in a given region's value.
372-
pub(crate) fn elements_contained_in<'a>(
373-
&'a self,
374-
r: N,
375-
) -> impl Iterator<Item = RegionElement> + 'a {
369+
pub(crate) fn elements_contained_in(&self, r: N) -> impl Iterator<Item = RegionElement> {
376370
let points_iter = self.locations_outlived_by(r).map(RegionElement::Location);
377371

378372
let free_regions_iter =

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl UniversalRegionRelations<'_> {
172172
}
173173

174174
/// Returns the _non-transitive_ set of known `outlives` constraints between free regions.
175-
pub(crate) fn known_outlives(&self) -> impl Iterator<Item = (RegionVid, RegionVid)> + '_ {
175+
pub(crate) fn known_outlives(&self) -> impl Iterator<Item = (RegionVid, RegionVid)> {
176176
self.outlives.base_edges()
177177
}
178178
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ rustc_index::newtype_index! {
5454
fn appearances_iter(
5555
first: Option<AppearanceIndex>,
5656
appearances: &Appearances,
57-
) -> impl Iterator<Item = AppearanceIndex> + '_ {
57+
) -> impl Iterator<Item = AppearanceIndex> {
5858
AppearancesIter { appearances, current: first }
5959
}
6060

@@ -107,17 +107,17 @@ impl LocalUseMap {
107107
local_use_map
108108
}
109109

110-
pub(crate) fn defs(&self, local: Local) -> impl Iterator<Item = PointIndex> + '_ {
110+
pub(crate) fn defs(&self, local: Local) -> impl Iterator<Item = PointIndex> {
111111
appearances_iter(self.first_def_at[local], &self.appearances)
112112
.map(move |aa| self.appearances[aa].point_index)
113113
}
114114

115-
pub(crate) fn uses(&self, local: Local) -> impl Iterator<Item = PointIndex> + '_ {
115+
pub(crate) fn uses(&self, local: Local) -> impl Iterator<Item = PointIndex> {
116116
appearances_iter(self.first_use_at[local], &self.appearances)
117117
.map(move |aa| self.appearances[aa].point_index)
118118
}
119119

120-
pub(crate) fn drops(&self, local: Local) -> impl Iterator<Item = PointIndex> + '_ {
120+
pub(crate) fn drops(&self, local: Local) -> impl Iterator<Item = PointIndex> {
121121
appearances_iter(self.first_drop_at[local], &self.appearances)
122122
.map(move |aa| self.appearances[aa].point_index)
123123
}

compiler/rustc_borrowck/src/universal_regions.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'tcx> UniversalRegions<'tcx> {
318318

319319
/// Returns an iterator over all the RegionVids corresponding to
320320
/// universally quantified free regions.
321-
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> + use<> {
321+
pub(crate) fn universal_regions_iter(&self) -> impl Iterator<Item = RegionVid> + 'static {
322322
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
323323
}
324324

@@ -342,9 +342,9 @@ impl<'tcx> UniversalRegions<'tcx> {
342342
}
343343

344344
/// Gets an iterator over all the early-bound regions that have names.
345-
pub(crate) fn named_universal_regions_iter<'s>(
346-
&'s self,
347-
) -> impl Iterator<Item = (ty::Region<'tcx>, ty::RegionVid)> + 's {
345+
pub(crate) fn named_universal_regions_iter(
346+
&self,
347+
) -> impl Iterator<Item = (ty::Region<'tcx>, ty::RegionVid)> {
348348
self.indices.indices.iter().map(|(&r, &v)| (r, v))
349349
}
350350

compiler/rustc_const_eval/src/interpret/intern.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ impl HasStaticRootDefId for const_eval::CompileTimeMachine<'_> {
6161
/// already mutable (as a sanity check).
6262
///
6363
/// Returns an iterator over all relocations referred to by this allocation.
64-
fn intern_shallow<'rt, 'tcx, T, M: CompileTimeMachine<'tcx, T>>(
65-
ecx: &'rt mut InterpCx<'tcx, M>,
64+
fn intern_shallow<'tcx, T, M: CompileTimeMachine<'tcx, T>>(
65+
ecx: &mut InterpCx<'tcx, M>,
6666
alloc_id: AllocId,
6767
mutability: Mutability,
6868
) -> Result<impl Iterator<Item = CtfeProvenance> + 'tcx, ()> {

0 commit comments

Comments
 (0)