Skip to content

Commit

Permalink
Actually use precise capturing in favor of outlives
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Sep 18, 2024
1 parent 10b8c30 commit b760a0b
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/borrow_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl<'tcx> BorrowSet<'tcx> {
self.location_map.len()
}

pub(crate) fn indices(&self) -> impl Iterator<Item = BorrowIndex> + 'static {
pub(crate) fn indices(&self) -> impl Iterator<Item = BorrowIndex> + use<> {
BorrowIndex::ZERO..BorrowIndex::from_usize(self.len())
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl<'tcx> UniversalRegions<'tcx> {

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

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ impl<'tcx, V> Locals<'tcx, V> {
Locals { values: IndexVec::default() }
}

pub(super) fn indices(&self) -> impl DoubleEndedIterator<Item = mir::Local> + Clone + 'static {
pub(super) fn indices(
&self,
) -> impl DoubleEndedIterator<Item = mir::Local> + Clone + use<'tcx, V> {
self.values.indices()
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/graph/scc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<N: Idx, S: Idx + Ord, A: Annotation> Sccs<N, S, A> {
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
/// This is convenient when the edges represent dependencies: when you visit
/// `S1`, the value for `S2` will already have been computed.
pub fn all_sccs(&self) -> impl Iterator<Item = S> + 'static {
pub fn all_sccs(&self) -> impl Iterator<Item = S> + use<N, S, A> {
(0..self.scc_data.len()).map(S::new)
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ fn build_single_delegations<'a, Node: InvocationCollectorNode>(
suffixes: &'a [(Ident, Option<Ident>)],
item_span: Span,
from_glob: bool,
) -> impl Iterator<Item = ast::Item<Node::ItemKind>> + 'a {
) -> impl Iterator<Item = ast::Item<Node::ItemKind>> + use<'a, Node> {
if suffixes.is_empty() {
// Report an error for now, to avoid keeping stem for resolution and
// stability checks.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/proc_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<T> pm::bridge::server::MessagePipe<T> for MessagePipe<T> {
}
}

fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy + 'static {
fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy + use<> {
pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new(
ecx.sess.opts.unstable_opts.proc_macro_execution_strategy
== ProcMacroExecutionStrategy::CrossThread,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_index/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<I: Idx, T> IndexSlice<I, T> {
#[inline]
pub fn indices(
&self,
) -> impl DoubleEndedIterator<Item = I> + ExactSizeIterator + Clone + 'static {
) -> impl DoubleEndedIterator<Item = I> + ExactSizeIterator + Clone + use<I, T> {
(0..self.len()).map(|n| I::new(n))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
&self,
path: &'tcx hir::Path<'tcx>,
args: GenericArgsRef<'tcx>,
) -> impl Iterator<Item = InsertableGenericArgs<'tcx>> + 'tcx {
) -> impl Iterator<Item = InsertableGenericArgs<'tcx>> + use<'tcx> {
let tcx = self.tecx.tcx;
let have_turbofish = path.segments.iter().any(|segment| {
segment.args.is_some_and(|args| args.args.iter().any(|arg| arg.is_ty_or_const()))
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_trait_selection/src/solve/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ impl<'tcx> ObligationStorage<'tcx> {
obligations
}

fn unstalled_for_select(&mut self) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'tcx {
fn unstalled_for_select(
&mut self,
) -> impl Iterator<Item = PredicateObligation<'tcx>> + use<'tcx> {
mem::take(&mut self.pending).into_iter()
}

Expand Down

0 comments on commit b760a0b

Please sign in to comment.