Skip to content

Commit

Permalink
Stop enabling in_band_lifetimes in rustc_data_structures
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
scottmcm committed Dec 6, 2021
1 parent 2a9e083 commit 308fd59
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod tests;
/// 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
/// 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
K: Ord,
{
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_data_structures/src/graph/iterate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
visited: BitSet<G::Node>,
}

impl<G> DepthFirstSearch<'graph, G>
impl<'graph, G> DepthFirstSearch<'graph, G>
where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
{
Expand Down Expand Up @@ -209,7 +209,7 @@ where
settled: BitSet<G::Node>,
}

impl<G> TriColorDepthFirstSearch<'graph, G>
impl<'graph, G> TriColorDepthFirstSearch<'graph, G>
where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
{
Expand Down Expand Up @@ -276,7 +276,7 @@ where
}
}

impl<G> TriColorDepthFirstSearch<'graph, G>
impl<G> TriColorDepthFirstSearch<'_, G>
where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors + WithStartNode,
{
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 @@ -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 Iter = std::iter::Cloned<std::slice::Iter<'graph, S>>;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/graph/vec_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 Iter = std::iter::Cloned<std::slice::Iter<'graph, N>>;
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#![feature(core_intrinsics)]
#![feature(extend_one)]
#![feature(hash_raw_entry)]
#![feature(in_band_lifetimes)]
#![feature(maybe_uninit_uninit_array)]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(type_alias_impl_trait)]
#![feature(new_uninit)]
#![feature(nll)]
#![feature(once_cell)]
#![feature(test)]
#![feature(thread_id_value)]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/sorted_map/index_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// insertion order.
#[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)
}

Expand All @@ -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
/// insertion order.
#[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);
self.idx_sorted_by_item_key[lower_bound..].iter().map_while(move |&i| {
let (k, v) = &self.items[i];
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/sso/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ impl<K, V> IntoIterator for SsoHashMap<K, V> {

/// adapts Item of array reference iterator to Item of hashmap reference iterator.
#[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;
(a, b)
}

/// adapts Item of array mut reference iterator to Item of hashmap mut reference iterator.
#[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;
(a, b)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sso/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<T> SsoHashSet<T> {
/// An iterator visiting all elements in arbitrary order.
/// The iterator element type is `&'a T`.
#[inline]
pub fn iter(&'a self) -> impl Iterator<Item = &'a T> {
pub fn iter(&self) -> impl Iterator<Item = &T> {
self.into_iter()
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/vec_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use rustc_index::vec::{Idx, IndexVec};

pub fn iter<Ls>(
first: Option<Ls::LinkIndex>,
links: &'a Ls,
) -> impl Iterator<Item = Ls::LinkIndex> + 'a
links: &Ls,
) -> impl Iterator<Item = Ls::LinkIndex> + '_
where
Ls: Links,
{
Expand Down

0 comments on commit 308fd59

Please sign in to comment.