Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 24 pull requests #79057

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
3dd0a7d
Do not call `unwrap` with `signatures` option enabled
JohnTitor Oct 25, 2020
459dae9
fix #72680 by explicitly checking for or-pattern before test
mark-i-m Nov 7, 2020
43e4783
address reviewer comments
mark-i-m Nov 9, 2020
659aa77
test: add `()=()=()=...` to weird-exprs.rs
slanterns Nov 11, 2020
f5e67b5
Add a test for r# identifiers
poliorcetics Nov 12, 2020
9c70696
Ignore tidy linelength
poliorcetics Nov 12, 2020
bd0eb07
Added some unit tests as requested
richkadel Nov 3, 2020
ecfeac5
Use intradoc-links for the whole test, add a @has check
poliorcetics Nov 12, 2020
562d50e
Include llvm-as in llvm-tools-preview component
zec Nov 12, 2020
e4a43fc
Merge changes from rust-lang/rust
zec Nov 12, 2020
38fa66a
Rename empty_tuple_assignment to monkey_barrel
slanterns Nov 12, 2020
eb9f2bb
Overcome Sync issues with non-parallel compiler
richkadel Nov 12, 2020
775f1e5
fix pretty print for qpath
gui1117 Nov 12, 2020
f8a32e9
Bumped minimal tested LLVM version to 9
DevJPM Nov 7, 2020
6323565
explicitly add llvm-9-dev in dockerfile
DevJPM Nov 7, 2020
6830f1c
Bump the minimal supported LLVM version in the bootstrapping code to 9.0
DevJPM Nov 7, 2020
b51bcc7
fully exploited the dropped support of LLVM 8
DevJPM Nov 7, 2020
8236830
Removed an unused function now that LLVM 9 is the minimal supported v…
DevJPM Nov 7, 2020
7e443c4
Dropped Support for Bidirectional Custom Target Definition Emulation
DevJPM Nov 10, 2020
86193ca
fixed a re-format due to removed chain call
DevJPM Nov 10, 2020
3747df7
Avoid installing external LLVM dylibs
Mark-Simulacrum Nov 12, 2020
010265a
Fix an intrinsic invocation on threaded wasm
alexcrichton Nov 12, 2020
dd682cb
rustc_target: Fix dash vs underscore mismatches in option names
petrochenkov Nov 12, 2020
0b4af16
Never inline when `no_sanitize` attributes differ
tmiasko Nov 11, 2020
ae43326
Never inline cold functions
tmiasko Nov 11, 2020
9bb3d6b
Remove check for impossible condition
tmiasko Nov 11, 2020
66cadec
Fix generator inlining by checking for rust-call abi and spread arg
tmiasko Nov 11, 2020
79d853e
Never inline C variadic functions
tmiasko Nov 11, 2020
2a010dd
./x.py test --bless
tmiasko Nov 11, 2020
d486bfc
Normalize function type during validation
tmiasko Nov 12, 2020
99be78d
Always use param_env_reveal_all_normalized in validator
tmiasko Nov 12, 2020
cc6baf7
rustc_expand: Mark inner `#![test]` attributes as soft-unstable
petrochenkov Nov 12, 2020
31741aa
Add `--color` support to bootstrap
jyn514 Nov 12, 2020
8766c04
cleanup: Remove `ParseSess::injected_crate_name`
petrochenkov Nov 12, 2020
c131063
Added a unit test for BcbCounters
richkadel Nov 13, 2020
309d863
Fix wrong XPath
poliorcetics Nov 13, 2020
894b1f7
extract closures into a separate trait
lcnr Nov 13, 2020
b4b0ef3
Addressed feedback
richkadel Nov 13, 2020
75dfc71
refactor: vec_deque ignore-tidy-filelength
DeveloperC286 Nov 13, 2020
bf6902c
Add BTreeMap::retain and BTreeSet::retain
mbrubeck Nov 13, 2020
7eb1a1a
Validate that locals have a corresponding `LocalDecl`
camelid Nov 13, 2020
ac4c1f5
rustc_resolve: Make `macro_rules` scope chain compression lazy
petrochenkov Nov 13, 2020
41c44b4
Move Steal to rustc_data_structures.
cjgillot Nov 14, 2020
03cbee8
Rename ItemEnum -> ItemKind, inner -> kind
jyn514 Nov 14, 2020
b825ae7
Style nit
mark-i-m Nov 14, 2020
8cf3564
Add underscore expressions for destructuring assignments
fanzier Nov 11, 2020
3ae1a3a
Rollup merge of #78352 - JohnTitor:issue-75229, r=Dylan-DPC
jonas-schievink Nov 14, 2020
b1a3a09
Rollup merge of #78590 - DeveloperC286:issue_60302, r=varkor
jonas-schievink Nov 14, 2020
a8d6c47
Rollup merge of #78848 - DevJPM:ci-llvm-9, r=nikic
jonas-schievink Nov 14, 2020
4319f8c
Rollup merge of #78856 - mark-i-m:fix-or-pat-ice, r=matthewjasper
jonas-schievink Nov 14, 2020
ddb4850
Rollup merge of #78948 - slanterns:master, r=varkor
jonas-schievink Nov 14, 2020
e7b2849
Rollup merge of #78962 - poliorcetics:rustdoc-raw-ident-test, r=jyn514
jonas-schievink Nov 14, 2020
8d38921
Rollup merge of #78963 - richkadel:llvm-coverage-counters-2.0.4, r=tm…
jonas-schievink Nov 14, 2020
43d3afa
Rollup merge of #78966 - tmiasko:inline-never, r=oli-obk
jonas-schievink Nov 14, 2020
07d508c
Rollup merge of #78968 - zec:add-llvm-as, r=Mark-Simulacrum
jonas-schievink Nov 14, 2020
ad2e901
Rollup merge of #78969 - tmiasko:normalize, r=davidtwco
jonas-schievink Nov 14, 2020
177755f
Rollup merge of #78980 - thiolliere:gui-fix-qpath, r=estebank
jonas-schievink Nov 14, 2020
b636385
Rollup merge of #78986 - Mark-Simulacrum:fix-llvm, r=alexcrichton
jonas-schievink Nov 14, 2020
d1ae8db
Rollup merge of #78988 - alexcrichton:one-more-intrinsic, r=sfackler
jonas-schievink Nov 14, 2020
c7546bb
Rollup merge of #78993 - petrochenkov:specdash, r=oli-obk
jonas-schievink Nov 14, 2020
423fccc
Rollup merge of #79003 - petrochenkov:innertest, r=estebank
jonas-schievink Nov 14, 2020
4b4cfdc
Rollup merge of #79004 - jyn514:bacon, r=Mark-Simulacrum
jonas-schievink Nov 14, 2020
cffb7d5
Rollup merge of #79005 - petrochenkov:noinjected, r=davidtwco
jonas-schievink Nov 14, 2020
86842af
Rollup merge of #79016 - fanzier:underscore-expressions, r=petrochenkov
jonas-schievink Nov 14, 2020
8f47ccf
Rollup merge of #79019 - lcnr:generic-arg-validation, r=petrochenkov
jonas-schievink Nov 14, 2020
81acd2a
Rollup merge of #79026 - mbrubeck:btree_retain, r=m-ou-se
jonas-schievink Nov 14, 2020
96d4f77
Rollup merge of #79031 - camelid:mir-validate-local-decl, r=jonas-sch…
jonas-schievink Nov 14, 2020
68bcb6f
Rollup merge of #79034 - petrochenkov:mrscopes3, r=eddyb
jonas-schievink Nov 14, 2020
94528fe
Rollup merge of #79036 - cjgillot:steal, r=oli-obk
jonas-schievink Nov 14, 2020
a0a619f
Rollup merge of #79041 - jyn514:inner-to-kind, r=petrochenkov
jonas-schievink Nov 14, 2020
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
refactor: vec_deque ignore-tidy-filelength
commit c547d5fabcd756515afa7263ee5304965bb4c497
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 11:22:23 2020 +0000

    test: updating ui/hygiene/panic-location.rs expected

commit 2af03769c4ffdbbbad75197a1ad0df8c599186be
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 10:43:30 2020 +0000

    fix: documentation unresolved link

commit c4b0df361ce27d7392d8016229f2e0265af32086
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:58:31 2020 +0000

    style: compiling with Rust's style guidelines

commit bdd2de5f3c09b49a18e3293f2457fcab25557c96
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:56:31 2020 +0000

    refactor: removing ignore-tidy-filelength

commit fcc4b3bc41f57244c65ebb8e4efe4cbc9460b5a9
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:51:35 2020 +0000

    refactor: moving trait RingSlices to ring_slices.rs

commit 2f0cc539c06d8841baf7f675168f68ca7c21e68e
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:46:09 2020 +0000

    refactor: moving struct PairSlices to pair_slices.rs

commit a55d3ef1dab4c3d85962b3a601ff8d1f7497faf2
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:31:45 2020 +0000

    refactor: moving struct Iter to iter.rs

commit 76ab33a12442a03726f36f606b4e0fe70f8f246b
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:24:32 2020 +0000

    refactor: moving struct IntoIter into into_iter.rs

commit abe0d9eea2933881858c3b1bc09df67cedc5ada5
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 02:19:07 2020 +0000

    refactor: moving struct IterMut into iter_mut.rs

commit 70ebd6420335e1895e2afa2763a0148897963e24
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 01:49:15 2020 +0000

    refactor: moved macros into macros.rs

commit b08dd2add994b04ae851aa065800bd8bd6326134
Author: C <DeveloperC@protonmail.com>
Date:   Sat Oct 31 01:05:36 2020 +0000

    refactor: moving vec_deque.rs to vec_deque/mod.rs
  • Loading branch information
DeveloperC286 committed Nov 13, 2020
commit 75dfc711da035ab8cc29a2dc32644f47e9d16ed8
57 changes: 57 additions & 0 deletions library/alloc/src/collections/vec_deque/into_iter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
use core::fmt;
use core::iter::FusedIterator;

use super::VecDeque;

/// An owning iterator over the elements of a `VecDeque`.
///
/// This `struct` is created by the [`into_iter`] method on [`VecDeque`]
/// (provided by the `IntoIterator` trait). See its documentation for more.
///
/// [`into_iter`]: VecDeque::into_iter
#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> {
pub(crate) inner: VecDeque<T>,
}

#[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("IntoIter").field(&self.inner).finish()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Iterator for IntoIter<T> {
type Item = T;

#[inline]
fn next(&mut self) -> Option<T> {
self.inner.pop_front()
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.inner.len();
(len, Some(len))
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> DoubleEndedIterator for IntoIter<T> {
#[inline]
fn next_back(&mut self) -> Option<T> {
self.inner.pop_back()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IntoIter<T> {
fn is_empty(&self) -> bool {
self.inner.is_empty()
}
}

#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IntoIter<T> {}
159 changes: 159 additions & 0 deletions library/alloc/src/collections/vec_deque/iter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
use core::fmt;
use core::iter::FusedIterator;
use core::ops::Try;

use super::{count, wrap_index, RingSlices};

/// An iterator over the elements of a `VecDeque`.
///
/// This `struct` is created by the [`iter`] method on [`super::VecDeque`]. See its
/// documentation for more.
///
/// [`iter`]: super::VecDeque::iter
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Iter<'a, T: 'a> {
pub(crate) ring: &'a [T],
pub(crate) tail: usize,
pub(crate) head: usize,
}

#[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
f.debug_tuple("Iter").field(&front).field(&back).finish()
}
}

// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Clone for Iter<'_, T> {
fn clone(&self) -> Self {
Iter { ring: self.ring, tail: self.tail, head: self.head }
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;

#[inline]
fn next(&mut self) -> Option<&'a T> {
if self.tail == self.head {
return None;
}
let tail = self.tail;
self.tail = wrap_index(self.tail.wrapping_add(1), self.ring.len());
unsafe { Some(self.ring.get_unchecked(tail)) }
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = count(self.tail, self.head, self.ring.len());
(len, Some(len))
}

fn fold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
where
F: FnMut(Acc, Self::Item) -> Acc,
{
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
accum = front.iter().fold(accum, &mut f);
back.iter().fold(accum, &mut f)
}

fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Ok = B>,
{
let (mut iter, final_res);
if self.tail <= self.head {
// single slice self.ring[self.tail..self.head]
iter = self.ring[self.tail..self.head].iter();
final_res = iter.try_fold(init, &mut f);
} else {
// two slices: self.ring[self.tail..], self.ring[..self.head]
let (front, back) = self.ring.split_at(self.tail);
let mut back_iter = back.iter();
let res = back_iter.try_fold(init, &mut f);
let len = self.ring.len();
self.tail = (self.ring.len() - back_iter.len()) & (len - 1);
iter = front[..self.head].iter();
final_res = iter.try_fold(res?, &mut f);
}
self.tail = self.head - iter.len();
final_res
}

fn nth(&mut self, n: usize) -> Option<Self::Item> {
if n >= count(self.tail, self.head, self.ring.len()) {
self.tail = self.head;
None
} else {
self.tail = wrap_index(self.tail.wrapping_add(n), self.ring.len());
self.next()
}
}

#[inline]
fn last(mut self) -> Option<&'a T> {
self.next_back()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a T> {
if self.tail == self.head {
return None;
}
self.head = wrap_index(self.head.wrapping_sub(1), self.ring.len());
unsafe { Some(self.ring.get_unchecked(self.head)) }
}

fn rfold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
where
F: FnMut(Acc, Self::Item) -> Acc,
{
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
accum = back.iter().rfold(accum, &mut f);
front.iter().rfold(accum, &mut f)
}

fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Ok = B>,
{
let (mut iter, final_res);
if self.tail <= self.head {
// single slice self.ring[self.tail..self.head]
iter = self.ring[self.tail..self.head].iter();
final_res = iter.try_rfold(init, &mut f);
} else {
// two slices: self.ring[self.tail..], self.ring[..self.head]
let (front, back) = self.ring.split_at(self.tail);
let mut front_iter = front[..self.head].iter();
let res = front_iter.try_rfold(init, &mut f);
self.head = front_iter.len();
iter = back.iter();
final_res = iter.try_rfold(res?, &mut f);
}
self.head = self.tail + iter.len();
final_res
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for Iter<'_, T> {
fn is_empty(&self) -> bool {
self.head == self.tail
}
}

#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for Iter<'_, T> {}
128 changes: 128 additions & 0 deletions library/alloc/src/collections/vec_deque/iter_mut.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
use core::fmt;
use core::iter::FusedIterator;
use core::marker::PhantomData;

use super::{count, wrap_index, RingSlices};

/// A mutable iterator over the elements of a `VecDeque`.
///
/// This `struct` is created by the [`iter_mut`] method on [`super::VecDeque`]. See its
/// documentation for more.
///
/// [`iter_mut`]: super::VecDeque::iter_mut
#[stable(feature = "rust1", since = "1.0.0")]
pub struct IterMut<'a, T: 'a> {
// Internal safety invariant: the entire slice is dereferencable.
pub(crate) ring: *mut [T],
pub(crate) tail: usize,
pub(crate) head: usize,
pub(crate) phantom: PhantomData<&'a mut [T]>,
}

// SAFETY: we do nothing thread-local and there is no interior mutability,
// so the usual structural `Send`/`Sync` apply.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for IterMut<'_, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Sync> Sync for IterMut<'_, T> {}

#[stable(feature = "collection_debug", since = "1.17.0")]
impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
// The `IterMut` invariant also ensures everything is dereferencable.
let (front, back) = unsafe { (&*front, &*back) };
f.debug_tuple("IterMut").field(&front).field(&back).finish()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Iterator for IterMut<'a, T> {
type Item = &'a mut T;

#[inline]
fn next(&mut self) -> Option<&'a mut T> {
if self.tail == self.head {
return None;
}
let tail = self.tail;
self.tail = wrap_index(self.tail.wrapping_add(1), self.ring.len());

unsafe {
let elem = self.ring.get_unchecked_mut(tail);
Some(&mut *elem)
}
}

#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = count(self.tail, self.head, self.ring.len());
(len, Some(len))
}

fn fold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
where
F: FnMut(Acc, Self::Item) -> Acc,
{
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
// The `IterMut` invariant also ensures everything is dereferencable.
let (front, back) = unsafe { (&mut *front, &mut *back) };
accum = front.iter_mut().fold(accum, &mut f);
back.iter_mut().fold(accum, &mut f)
}

fn nth(&mut self, n: usize) -> Option<Self::Item> {
if n >= count(self.tail, self.head, self.ring.len()) {
self.tail = self.head;
None
} else {
self.tail = wrap_index(self.tail.wrapping_add(n), self.ring.len());
self.next()
}
}

#[inline]
fn last(mut self) -> Option<&'a mut T> {
self.next_back()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
#[inline]
fn next_back(&mut self) -> Option<&'a mut T> {
if self.tail == self.head {
return None;
}
self.head = wrap_index(self.head.wrapping_sub(1), self.ring.len());

unsafe {
let elem = self.ring.get_unchecked_mut(self.head);
Some(&mut *elem)
}
}

fn rfold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
where
F: FnMut(Acc, Self::Item) -> Acc,
{
let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail);
// SAFETY: these are the elements we have not handed out yet, so aliasing is fine.
// The `IterMut` invariant also ensures everything is dereferencable.
let (front, back) = unsafe { (&mut *front, &mut *back) };
accum = back.iter_mut().rfold(accum, &mut f);
front.iter_mut().rfold(accum, &mut f)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ExactSizeIterator for IterMut<'_, T> {
fn is_empty(&self) -> bool {
self.head == self.tail
}
}

#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for IterMut<'_, T> {}
19 changes: 19 additions & 0 deletions library/alloc/src/collections/vec_deque/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
macro_rules! __impl_slice_eq1 {
([$($vars:tt)*] $lhs:ty, $rhs:ty, $($constraints:tt)*) => {
#[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")]
impl<A, B, $($vars)*> PartialEq<$rhs> for $lhs
where
A: PartialEq<B>,
$($constraints)*
{
fn eq(&self, other: &$rhs) -> bool {
if self.len() != other.len() {
return false;
}
let (sa, sb) = self.as_slices();
let (oa, ob) = other[..].split_at(sa.len());
sa == oa && sb == ob
}
}
}
}
Loading