Skip to content

Commit 308fd59

Browse files
committed
Stop enabling in_band_lifetimes in rustc_data_structures
There's a conversation in the tracking issue about possibly unaccepting `in_band_lifetimes`, but it's used heavily in the compiler, and thus there'd need to be a bunch of PRs like this if that were to happen. So here's one to see how much of an impact it has. (Oh, and I removed `nll` while I was here too, since it didn't seem needed. Let me know if I should put that back.)
1 parent 2a9e083 commit 308fd59

File tree

9 files changed

+13
-15
lines changed

9 files changed

+13
-15
lines changed

compiler/rustc_data_structures/src/binary_search_util/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod tests;
66
/// function finds the range of elements that match the key. `data`
77
/// must have been sorted as if by a call to `sort_by_key` for this to
88
/// work.
9-
pub fn binary_search_slice<E, K>(data: &'d [E], key_fn: impl Fn(&E) -> K, key: &K) -> &'d [E]
9+
pub fn binary_search_slice<'d, E, K>(data: &'d [E], key_fn: impl Fn(&E) -> K, key: &K) -> &'d [E]
1010
where
1111
K: Ord,
1212
{

compiler/rustc_data_structures/src/graph/iterate/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ where
7979
visited: BitSet<G::Node>,
8080
}
8181

82-
impl<G> DepthFirstSearch<'graph, G>
82+
impl<'graph, G> DepthFirstSearch<'graph, G>
8383
where
8484
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
8585
{
@@ -209,7 +209,7 @@ where
209209
settled: BitSet<G::Node>,
210210
}
211211

212-
impl<G> TriColorDepthFirstSearch<'graph, G>
212+
impl<'graph, G> TriColorDepthFirstSearch<'graph, G>
213213
where
214214
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
215215
{
@@ -276,7 +276,7 @@ where
276276
}
277277
}
278278

279-
impl<G> TriColorDepthFirstSearch<'graph, G>
279+
impl<G> TriColorDepthFirstSearch<'_, G>
280280
where
281281
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode,
282282
{

compiler/rustc_data_structures/src/graph/scc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<N: Idx, S: Idx> WithNumEdges for Sccs<N, S> {
9797
}
9898
}
9999

100-
impl<N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> {
100+
impl<'graph, N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> {
101101
type Item = S;
102102

103103
type Iter = std::iter::Cloned<std::slice::Iter<'graph, S>>;

compiler/rustc_data_structures/src/graph/vec_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<N: Idx> WithNumEdges for VecGraph<N> {
9494
}
9595
}
9696

97-
impl<N: Idx> GraphSuccessors<'graph> for VecGraph<N> {
97+
impl<'graph, N: Idx> GraphSuccessors<'graph> for VecGraph<N> {
9898
type Item = N;
9999

100100
type Iter = std::iter::Cloned<std::slice::Iter<'graph, N>>;

compiler/rustc_data_structures/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
#![feature(core_intrinsics)]
1616
#![feature(extend_one)]
1717
#![feature(hash_raw_entry)]
18-
#![feature(in_band_lifetimes)]
1918
#![feature(maybe_uninit_uninit_array)]
2019
#![feature(min_specialization)]
2120
#![feature(never_type)]
2221
#![feature(type_alias_impl_trait)]
2322
#![feature(new_uninit)]
24-
#![feature(nll)]
2523
#![feature(once_cell)]
2624
#![feature(test)]
2725
#![feature(thread_id_value)]

compiler/rustc_data_structures/src/sorted_map/index_map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<I: Idx, K: Ord, V> SortedIndexMultiMap<I, K, V> {
8484
/// If there are multiple items that are equivalent to `key`, they will be yielded in
8585
/// insertion order.
8686
#[inline]
87-
pub fn get_by_key(&'a self, key: K) -> impl 'a + Iterator<Item = &'a V> {
87+
pub fn get_by_key(&self, key: K) -> impl Iterator<Item = &V> + '_ {
8888
self.get_by_key_enumerated(key).map(|(_, v)| v)
8989
}
9090

@@ -94,7 +94,7 @@ impl<I: Idx, K: Ord, V> SortedIndexMultiMap<I, K, V> {
9494
/// If there are multiple items that are equivalent to `key`, they will be yielded in
9595
/// insertion order.
9696
#[inline]
97-
pub fn get_by_key_enumerated(&'a self, key: K) -> impl '_ + Iterator<Item = (I, &V)> {
97+
pub fn get_by_key_enumerated(&self, key: K) -> impl Iterator<Item = (I, &V)> + '_ {
9898
let lower_bound = self.idx_sorted_by_item_key.partition_point(|&i| self.items[i].0 < key);
9999
self.idx_sorted_by_item_key[lower_bound..].iter().map_while(move |&i| {
100100
let (k, v) = &self.items[i];

compiler/rustc_data_structures/src/sso/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,14 @@ impl<K, V> IntoIterator for SsoHashMap<K, V> {
423423

424424
/// adapts Item of array reference iterator to Item of hashmap reference iterator.
425425
#[inline(always)]
426-
fn adapt_array_ref_it<K, V>(pair: &'a (K, V)) -> (&'a K, &'a V) {
426+
fn adapt_array_ref_it<K, V>(pair: &(K, V)) -> (&K, &V) {
427427
let (a, b) = pair;
428428
(a, b)
429429
}
430430

431431
/// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator.
432432
#[inline(always)]
433-
fn adapt_array_mut_it<K, V>(pair: &'a mut (K, V)) -> (&'a K, &'a mut V) {
433+
fn adapt_array_mut_it<K, V>(pair: &mut (K, V)) -> (&K, &mut V) {
434434
let (a, b) = pair;
435435
(a, b)
436436
}

compiler/rustc_data_structures/src/sso/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<T> SsoHashSet<T> {
7575
/// An iterator visiting all elements in arbitrary order.
7676
/// The iterator element type is `&'a T`.
7777
#[inline]
78-
pub fn iter(&'a self) -> impl Iterator<Item = &'a T> {
78+
pub fn iter(&self) -> impl Iterator<Item = &T> {
7979
self.into_iter()
8080
}
8181

compiler/rustc_data_structures/src/vec_linked_list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use rustc_index::vec::{Idx, IndexVec};
22

33
pub fn iter<Ls>(
44
first: Option<Ls::LinkIndex>,
5-
links: &'a Ls,
6-
) -> impl Iterator<Item = Ls::LinkIndex> + 'a
5+
links: &Ls,
6+
) -> impl Iterator<Item = Ls::LinkIndex> + '_
77
where
88
Ls: Links,
99
{

0 commit comments

Comments
 (0)