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.)
This commit is contained in:
Scott McMurray 2021-12-05 20:17:35 -08:00
parent 2a9e0831d6
commit 308fd59f42
9 changed files with 13 additions and 15 deletions

View File

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

View File

@ -79,7 +79,7 @@ where
visited: BitSet<G::Node>, visited: BitSet<G::Node>,
} }
impl<G> DepthFirstSearch<'graph, G> impl<'graph, G> DepthFirstSearch<'graph, G>
where where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors, G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
{ {
@ -209,7 +209,7 @@ where
settled: BitSet<G::Node>, settled: BitSet<G::Node>,
} }
impl<G> TriColorDepthFirstSearch<'graph, G> impl<'graph, G> TriColorDepthFirstSearch<'graph, G>
where where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors, G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
{ {
@ -276,7 +276,7 @@ where
} }
} }
impl<G> TriColorDepthFirstSearch<'graph, G> impl<G> TriColorDepthFirstSearch<'_, G>
where where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode, G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode,
{ {

View File

@ -97,7 +97,7 @@ impl<N: Idx, S: Idx> WithNumEdges for Sccs<N, S> {
} }
} }
impl<N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> { impl<'graph, N: Idx, S: Idx> GraphSuccessors<'graph> for Sccs<N, S> {
type Item = S; type Item = S;
type Iter = std::iter::Cloned<std::slice::Iter<'graph, S>>; type Iter = std::iter::Cloned<std::slice::Iter<'graph, S>>;

View File

@ -94,7 +94,7 @@ impl<N: Idx> WithNumEdges for VecGraph<N> {
} }
} }
impl<N: Idx> GraphSuccessors<'graph> for VecGraph<N> { impl<'graph, N: Idx> GraphSuccessors<'graph> for VecGraph<N> {
type Item = N; type Item = N;
type Iter = std::iter::Cloned<std::slice::Iter<'graph, N>>; type Iter = std::iter::Cloned<std::slice::Iter<'graph, N>>;

View File

@ -15,13 +15,11 @@
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(extend_one)] #![feature(extend_one)]
#![feature(hash_raw_entry)] #![feature(hash_raw_entry)]
#![feature(in_band_lifetimes)]
#![feature(maybe_uninit_uninit_array)] #![feature(maybe_uninit_uninit_array)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(never_type)] #![feature(never_type)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(new_uninit)] #![feature(new_uninit)]
#![feature(nll)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(test)] #![feature(test)]
#![feature(thread_id_value)] #![feature(thread_id_value)]

View File

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

View File

@ -423,14 +423,14 @@ impl<K, V> IntoIterator for SsoHashMap<K, V> {
/// adapts Item of array reference iterator to Item of hashmap reference iterator. /// adapts Item of array reference iterator to Item of hashmap reference iterator.
#[inline(always)] #[inline(always)]
fn adapt_array_ref_it<K, V>(pair: &'a (K, V)) -> (&'a K, &'a V) { fn adapt_array_ref_it<K, V>(pair: &(K, V)) -> (&K, &V) {
let (a, b) = pair; let (a, b) = pair;
(a, b) (a, b)
} }
/// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator. /// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator.
#[inline(always)] #[inline(always)]
fn adapt_array_mut_it<K, V>(pair: &'a mut (K, V)) -> (&'a K, &'a mut V) { fn adapt_array_mut_it<K, V>(pair: &mut (K, V)) -> (&K, &mut V) {
let (a, b) = pair; let (a, b) = pair;
(a, b) (a, b)
} }

View File

@ -75,7 +75,7 @@ impl<T> SsoHashSet<T> {
/// An iterator visiting all elements in arbitrary order. /// An iterator visiting all elements in arbitrary order.
/// The iterator element type is `&'a T`. /// The iterator element type is `&'a T`.
#[inline] #[inline]
pub fn iter(&'a self) -> impl Iterator<Item = &'a T> { pub fn iter(&self) -> impl Iterator<Item = &T> {
self.into_iter() self.into_iter()
} }

View File

@ -2,8 +2,8 @@ use rustc_index::vec::{Idx, IndexVec};
pub fn iter<Ls>( pub fn iter<Ls>(
first: Option<Ls::LinkIndex>, first: Option<Ls::LinkIndex>,
links: &'a Ls, links: &Ls,
) -> impl Iterator<Item = Ls::LinkIndex> + 'a ) -> impl Iterator<Item = Ls::LinkIndex> + '_
where where
Ls: Links, Ls: Links,
{ {