Skip to content

Commit

Permalink
Auto merge of #47214 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

- Successful merges: #47030, #47033, #47110, #47149, #47150, #47160, #47162, #47182, #47198, #47199
- Failed merges:
  • Loading branch information
bors committed Jan 5, 2018
2 parents 8a11b8c + 3fcb995 commit dd582ac
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 107 deletions.
4 changes: 0 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Stabilized APIs

Cargo
-----
- [Cargo now supports alternative registries][cargo/4506]
- [Cargo now supports uninstallation of multiple packages][cargo/4561]
eg. `cargo uninstall foo bar` uninstalls `foo` and `bar`.
- [Added unit test checking to `cargo check`][cargo/4592]
Expand All @@ -49,7 +48,6 @@ Misc
----
- [Releases now ship with the Cargo book documentation.][45692]
- [rustdoc now prints rendering warnings on every run.][45324]
- [Release tarballs now come with rustfmt][45903]

Compatibility Notes
-------------------
Expand Down Expand Up @@ -83,9 +81,7 @@ Compatibility Notes
[45852]: https://github.com/rust-lang/rust/issues/45852
[45853]: https://github.com/rust-lang/rust/pull/45853
[45887]: https://github.com/rust-lang/rust/pull/45887
[45903]: https://github.com/rust-lang/rust/pull/45903
[45920]: https://github.com/rust-lang/rust/pull/45920
[cargo/4506]: https://github.com/rust-lang/cargo/pull/4506
[cargo/4561]: https://github.com/rust-lang/cargo/pull/4561
[cargo/4592]: https://github.com/rust-lang/cargo/pull/4592
[cargo/4637]: https://github.com/rust-lang/cargo/pull/4637
Expand Down
15 changes: 13 additions & 2 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
use std::collections::HashMap;
use std::env;
use std::ffi::{OsString, OsStr};
use std::fs;
use std::process::Command;
use std::fs::{self, File};
use std::io::Read;
use std::path::PathBuf;
use std::process::Command;

use build_helper::output;

Expand Down Expand Up @@ -234,4 +235,14 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
if let Some(ref s) = build.config.ccache {
cmd_finder.must_have(s);
}

if build.config.channel == "stable" {
let mut stage0 = String::new();
t!(t!(File::open(build.src.join("src/stage0.txt")))
.read_to_string(&mut stage0));
if stage0.contains("\ndev:") {
panic!("bootstrapping from a dev compiler in a stable release, but \
should only be bootstrapping from a released compiler!");
}
}
}
140 changes: 68 additions & 72 deletions src/liballoc/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,43 +228,7 @@ impl<T: Ord> BTreeSet<T> {
pub fn new() -> BTreeSet<T> {
BTreeSet { map: BTreeMap::new() }
}
}

impl<T> BTreeSet<T> {
/// Gets an iterator that visits the values in the `BTreeSet` in ascending order.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [1, 2, 3].iter().cloned().collect();
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));
/// assert_eq!(set_iter.next(), Some(&2));
/// assert_eq!(set_iter.next(), Some(&3));
/// assert_eq!(set_iter.next(), None);
/// ```
///
/// Values returned by the iterator are returned in ascending order:
///
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [3, 1, 2].iter().cloned().collect();
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));
/// assert_eq!(set_iter.next(), Some(&2));
/// assert_eq!(set_iter.next(), Some(&3));
/// assert_eq!(set_iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
Iter { iter: self.map.keys() }
}
}

impl<T: Ord> BTreeSet<T> {
/// Constructs a double-ended iterator over a sub-range of elements in the set.
/// The simplest way is to use the range syntax `min..max`, thus `range(min..max)` will
/// yield elements from min (inclusive) to max (exclusive).
Expand Down Expand Up @@ -293,9 +257,7 @@ impl<T: Ord> BTreeSet<T> {
{
Range { iter: self.map.range(range) }
}
}

impl<T: Ord> BTreeSet<T> {
/// Visits the values representing the difference,
/// i.e. the values that are in `self` but not in `other`,
/// in ascending order.
Expand Down Expand Up @@ -408,40 +370,6 @@ impl<T: Ord> BTreeSet<T> {
}
}

/// Returns the number of elements in the set.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let mut v = BTreeSet::new();
/// assert_eq!(v.len(), 0);
/// v.insert(1);
/// assert_eq!(v.len(), 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
self.map.len()
}

/// Returns `true` if the set contains no elements.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let mut v = BTreeSet::new();
/// assert!(v.is_empty());
/// v.insert(1);
/// assert!(!v.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool {
self.len() == 0
}

/// Clears the set, removing all values.
///
/// # Examples
Expand Down Expand Up @@ -724,6 +652,74 @@ impl<T: Ord> BTreeSet<T> {
}
}

impl<T> BTreeSet<T> {
/// Gets an iterator that visits the values in the `BTreeSet` in ascending order.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [1, 2, 3].iter().cloned().collect();
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));
/// assert_eq!(set_iter.next(), Some(&2));
/// assert_eq!(set_iter.next(), Some(&3));
/// assert_eq!(set_iter.next(), None);
/// ```
///
/// Values returned by the iterator are returned in ascending order:
///
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [3, 1, 2].iter().cloned().collect();
/// let mut set_iter = set.iter();
/// assert_eq!(set_iter.next(), Some(&1));
/// assert_eq!(set_iter.next(), Some(&2));
/// assert_eq!(set_iter.next(), Some(&3));
/// assert_eq!(set_iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
Iter { iter: self.map.keys() }
}

/// Returns the number of elements in the set.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let mut v = BTreeSet::new();
/// assert_eq!(v.len(), 0);
/// v.insert(1);
/// assert_eq!(v.len(), 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
self.map.len()
}

/// Returns `true` if the set contains no elements.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let mut v = BTreeSet::new();
/// assert!(v.is_empty());
/// v.insert(1);
/// assert!(!v.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> FromIterator<T> for BTreeSet<T> {
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BTreeSet<T> {
Expand Down
14 changes: 12 additions & 2 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#![feature(core_intrinsics)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![cfg_attr(any(unix, target_os = "redox"), feature(libc))]
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
#![rustc_alloc_kind = "lib"]

// The minimum alignment guaranteed by the architecture. This value is used to
Expand Down Expand Up @@ -116,7 +116,7 @@ unsafe impl Alloc for System {
}
}

#[cfg(any(unix, target_os = "redox"))]
#[cfg(any(unix, target_os = "cloudabi", target_os = "redox"))]
mod platform {
extern crate libc;

Expand Down Expand Up @@ -213,6 +213,16 @@ mod platform {
struct Stderr;

impl Write for Stderr {
#[cfg(target_os = "cloudabi")]
fn write_str(&mut self, _: &str) -> fmt::Result {
// CloudABI does not have any reserved file descriptor
// numbers. We should not attempt to write to file
// descriptor #2, as it may be associated with any kind of
// resource.
Ok(())
}

#[cfg(not(target_os = "cloudabi"))]
fn write_str(&mut self, s: &str) -> fmt::Result {
unsafe {
libc::write(libc::STDERR_FILENO,
Expand Down
1 change: 1 addition & 0 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ macro_rules! debug_assert_ne {
/// // The prefered method of quick returning Errors
/// fn write_to_file_question() -> Result<(), MyError> {
/// let mut file = File::create("my_best_friends.txt")?;
/// file.write_all(b"This is a list of my best friends.")?;
/// Ok(())
/// }
///
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ impl<T: ::fmt::Debug> ::fmt::Debug for ManuallyDrop<T> {
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: Clone> Clone for ManuallyDrop<T> {
fn clone(&self) -> Self {
ManuallyDrop::new(self.deref().clone())
Expand All @@ -1035,14 +1035,14 @@ impl<T: Clone> Clone for ManuallyDrop<T> {
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: Default> Default for ManuallyDrop<T> {
fn default() -> Self {
ManuallyDrop::new(Default::default())
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: PartialEq> PartialEq for ManuallyDrop<T> {
fn eq(&self, other: &Self) -> bool {
self.deref().eq(other)
Expand All @@ -1053,10 +1053,10 @@ impl<T: PartialEq> PartialEq for ManuallyDrop<T> {
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: Eq> Eq for ManuallyDrop<T> {}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: PartialOrd> PartialOrd for ManuallyDrop<T> {
fn partial_cmp(&self, other: &Self) -> Option<::cmp::Ordering> {
self.deref().partial_cmp(other)
Expand All @@ -1079,14 +1079,14 @@ impl<T: PartialOrd> PartialOrd for ManuallyDrop<T> {
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: Ord> Ord for ManuallyDrop<T> {
fn cmp(&self, other: &Self) -> ::cmp::Ordering {
self.deref().cmp(other)
}
}

#[stable(feature = "manually_drop", since = "1.20.0")]
#[stable(feature = "manually_drop_impls", since = "1.22.0")]
impl<T: ::hash::Hash> ::hash::Hash for ManuallyDrop<T> {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.deref().hash(state);
Expand Down
8 changes: 6 additions & 2 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,9 @@ mod traits {
}
}

#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[unstable(feature = "inclusive_range",
reason = "recently added, follows RFC",
issue = "28237")]
impl SliceIndex<str> for ops::RangeInclusive<usize> {
type Output = str;
#[inline]
Expand Down Expand Up @@ -2040,7 +2042,9 @@ mod traits {



#[stable(feature = "str_checked_slicing", since = "1.20.0")]
#[unstable(feature = "inclusive_range",
reason = "recently added, follows RFC",
issue = "28237")]
impl SliceIndex<str> for ops::RangeToInclusive<usize> {
type Output = str;
#[inline]
Expand Down
Loading

0 comments on commit dd582ac

Please sign in to comment.