Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e2d6334
Add `Ipv6Addr::is_benchmarking`
CDirkx Jun 18, 2021
cbaccc1
Add `IpAddr::is_benchmarking`
CDirkx Jun 18, 2021
e394bb7
BTree: refine some comments
ssomers Aug 1, 2021
22112e4
Remove unnecessary unsafe block in `process_unix`
LeSeulArtichaut Aug 24, 2021
848a38a
Manual Debug for Unix ExitCode ExitStatus ExitStatusError
ijackson Aug 24, 2021
905c2ba
Partially stabilize `array_methods`
jhpratt Aug 26, 2021
ca88f10
Add missing # Panics section to `Vec` method
Seppel3210 Aug 26, 2021
10ddabc
const fn for option copied, take & replace + tests
Jul 2, 2021
74c4c01
Mark unsafe NonZero*::unchecked_(add|mul) as const
iago-lito Aug 10, 2021
a993d7d
Fix link in Ipv6Addr::to_ipv4 docs
newpavlov Sep 21, 2021
e8e7f6e
Add truncate note to Vec::resize
owengage Sep 30, 2021
e017e45
Fix typos in rustdoc/lints
tniessen Oct 2, 2021
83ddedf
Remove various unused feature gates
bjorn3 Aug 29, 2021
998753c
Swap out unboxed_closures feature gate for min_specialization
bjorn3 Aug 29, 2021
e98f289
Turn a module non-doc comment into a doc comment
bjorn3 Aug 29, 2021
9a6f2e6
Only register `WSACleanup` if `WSAStartup` is actually ever called
CDirkx May 24, 2021
b7d2b46
Add test for checking if WS2_32.dll is linked
CDirkx May 24, 2021
5b4873a
Run the #85441 regression test on MSVC only
nagisa Oct 2, 2021
9f4cb86
Replace Fn impls with RPIT impls in rustc_index
bjorn3 Oct 2, 2021
5b66048
Add regression test for spurious const error with NLL
Aaron1011 Oct 3, 2021
22714ed
Rollup merge of #86434 - CDirkx:ipv6-benchmarking, r=joshtriplett
Manishearth Oct 4, 2021
287af04
Rollup merge of #86828 - lambinoo:67441-const-fn-copied-take-replace,…
Manishearth Oct 4, 2021
0f9e960
Rollup merge of #87679 - ssomers:btree_comments, r=joshtriplett
Manishearth Oct 4, 2021
e500f1c
Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as…
Manishearth Oct 4, 2021
f2ec71f
Rollup merge of #88286 - LeSeulArtichaut:unnecessary-unsafe-block-std…
Manishearth Oct 4, 2021
e4d257e
Rollup merge of #88305 - ijackson:exitstatus-debug, r=dtolnay
Manishearth Oct 4, 2021
70d82e0
Rollup merge of #88353 - jhpratt:stabilize-array-as-ref, r=joshtriplett
Manishearth Oct 4, 2021
5e66ba7
Rollup merge of #88370 - Seppel3210:master, r=dtolnay
Manishearth Oct 4, 2021
5215b85
Rollup merge of #88481 - bjorn3:remove_feature_gates, r=cjgillot
Manishearth Oct 4, 2021
c167eee
Rollup merge of #89138 - newpavlov:patch-2, r=dtolnay
Manishearth Oct 4, 2021
d236c04
Rollup merge of #89401 - owengage:master, r=joshtriplett
Manishearth Oct 4, 2021
8c7c689
Rollup merge of #89467 - tniessen:rustdoc-unecessary, r=jyn514
Manishearth Oct 4, 2021
e021a10
Rollup merge of #89472 - nagisa:nagisa/wsa-cleanup, r=dtolnay
Manishearth Oct 4, 2021
5c5dde8
Rollup merge of #89505 - Aaron1011:nll-const-test, r=Mark-Simulacrum
Manishearth Oct 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace Fn impls with RPIT impls in rustc_index
This is cleaner and removes an unstable feature usage
  • Loading branch information
bjorn3 committed Oct 3, 2021
commit 9f4cb862caf936858450721b548b303fb3eec351
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/member_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl<R> MemberConstraintSet<'tcx, R>
where
R: Copy + Hash + Eq,
{
crate fn all_indices(&self) -> impl Iterator<Item = NllMemberConstraintIndex> {
crate fn all_indices(&self) -> impl Iterator<Item = NllMemberConstraintIndex> + '_ {
self.constraints.indices()
}

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

/// Returns an iterator over all the region indices.
pub fn regions(&self) -> impl Iterator<Item = RegionVid> {
pub fn regions(&self) -> impl Iterator<Item = RegionVid> + '_ {
self.definitions.indices()
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(iter_zip)]
#![feature(min_specialization)]
#![feature(test)]
#![feature(fn_traits)]

pub mod bit_set;
pub mod vec;
Expand Down
61 changes: 17 additions & 44 deletions compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use std::fmt;
use std::fmt::Debug;
use std::hash::Hash;
use std::iter::{self, FromIterator};
use std::iter::FromIterator;
use std::marker::PhantomData;
use std::ops::{Index, IndexMut, Range, RangeBounds};
use std::ops::{Index, IndexMut, RangeBounds};
use std::slice;
use std::vec;

Expand Down Expand Up @@ -518,8 +518,6 @@ impl<I: Idx, T: fmt::Debug> fmt::Debug for IndexVec<I, T> {
}
}

pub type Enumerated<I, J> = iter::Map<iter::Enumerate<J>, IntoIdx<I>>;

impl<I: Idx, T> IndexVec<I, T> {
#[inline]
pub fn new() -> Self {
Expand Down Expand Up @@ -596,8 +594,10 @@ impl<I: Idx, T> IndexVec<I, T> {
}

#[inline]
pub fn into_iter_enumerated(self) -> Enumerated<I, vec::IntoIter<T>> {
self.raw.into_iter().enumerate().map(IntoIdx { _marker: PhantomData })
pub fn into_iter_enumerated(
self,
) -> impl DoubleEndedIterator<Item = (I, T)> + ExactSizeIterator {
self.raw.into_iter().enumerate().map(|(n, t)| (I::new(n), t))
}

#[inline]
Expand All @@ -606,13 +606,15 @@ impl<I: Idx, T> IndexVec<I, T> {
}

#[inline]
pub fn iter_enumerated(&self) -> Enumerated<I, slice::Iter<'_, T>> {
self.raw.iter().enumerate().map(IntoIdx { _marker: PhantomData })
pub fn iter_enumerated(
&self,
) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator + '_ {
self.raw.iter().enumerate().map(|(n, t)| (I::new(n), t))
}

#[inline]
pub fn indices(&self) -> iter::Map<Range<usize>, IntoIdx<I>> {
(0..self.len()).map(IntoIdx { _marker: PhantomData })
pub fn indices(&self) -> impl DoubleEndedIterator<Item = I> + ExactSizeIterator + 'static {
(0..self.len()).map(|n| I::new(n))
}

#[inline]
Expand All @@ -621,8 +623,10 @@ impl<I: Idx, T> IndexVec<I, T> {
}

#[inline]
pub fn iter_enumerated_mut(&mut self) -> Enumerated<I, slice::IterMut<'_, T>> {
self.raw.iter_mut().enumerate().map(IntoIdx { _marker: PhantomData })
pub fn iter_enumerated_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = (I, &mut T)> + ExactSizeIterator + '_ {
self.raw.iter_mut().enumerate().map(|(n, t)| (I::new(n), t))
}

#[inline]
Expand All @@ -638,7 +642,7 @@ impl<I: Idx, T> IndexVec<I, T> {
&'a mut self,
range: R,
) -> impl Iterator<Item = (I, T)> + 'a {
self.raw.drain(range).enumerate().map(IntoIdx { _marker: PhantomData })
self.raw.drain(range).enumerate().map(|(n, t)| (I::new(n), t))
}

#[inline]
Expand Down Expand Up @@ -832,36 +836,5 @@ impl<'a, I: Idx, T> IntoIterator for &'a mut IndexVec<I, T> {
}
}

pub struct IntoIdx<I: Idx> {
_marker: PhantomData<fn(&I)>,
}
impl<I: Idx, T> FnOnce<((usize, T),)> for IntoIdx<I> {
type Output = (I, T);

extern "rust-call" fn call_once(self, ((n, t),): ((usize, T),)) -> Self::Output {
(I::new(n), t)
}
}

impl<I: Idx, T> FnMut<((usize, T),)> for IntoIdx<I> {
extern "rust-call" fn call_mut(&mut self, ((n, t),): ((usize, T),)) -> Self::Output {
(I::new(n), t)
}
}

impl<I: Idx> FnOnce<(usize,)> for IntoIdx<I> {
type Output = I;

extern "rust-call" fn call_once(self, (n,): (usize,)) -> Self::Output {
I::new(n)
}
}

impl<I: Idx> FnMut<(usize,)> for IntoIdx<I> {
extern "rust-call" fn call_mut(&mut self, (n,): (usize,)) -> Self::Output {
I::new(n)
}
}

#[cfg(test)]
mod tests;
7 changes: 4 additions & 3 deletions compiler/rustc_mir_dataflow/src/move_paths/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::slice::Iter;
use rustc_data_structures::fx::FxHashMap;
use rustc_index::vec::{Enumerated, IndexVec};
use rustc_index::vec::IndexVec;
use rustc_middle::mir::*;
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_span::Span;
Expand Down Expand Up @@ -337,7 +336,9 @@ impl MovePathLookup {

/// An enumerated iterator of `local`s and their associated
/// `MovePathIndex`es.
pub fn iter_locals_enumerated(&self) -> Enumerated<Local, Iter<'_, MovePathIndex>> {
pub fn iter_locals_enumerated(
&self,
) -> impl DoubleEndedIterator<Item = (Local, &MovePathIndex)> + ExactSizeIterator {
self.locals.iter_enumerated()
}
}
Expand Down