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 10 pull requests #46362

Merged
merged 25 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
428c875
Add std::sync::mpsc::Receiver::recv_deadline()
ia0 Nov 11, 2017
667f83d
Remove inherent `ascii_ctype` methods from `str` and `[u8]`
LukasKalbertodt Nov 9, 2017
0337017
Stabilize `ascii_ctype` methods for `u8` and `char`
LukasKalbertodt Nov 18, 2017
1ad38f2
Improve documentation for slice swap/copy/clone operations.
frewsxcv Nov 23, 2017
6c5f53e
Stabilize const-calling existing const-fns in std
SimonSapin Nov 26, 2017
652a4bd
impl From<bool> for AtomicBool
ollie27 Nov 27, 2017
71d766b
Change version number for `impl From<bool> for AtomicBool` to 1.24.0
ollie27 Nov 27, 2017
8424cac
Use an unstable feature linked to #46316
ia0 Nov 27, 2017
c5aad96
Change `since` attribute from ctype methods from 1.23 to 1.24
LukasKalbertodt Nov 28, 2017
32a36d8
white list MMX and MSA target features
gnzlbg Nov 28, 2017
a6d1895
Update comment on alternate builds in .travis.yml
SimonSapin Nov 28, 2017
43323b3
Fix since for mpsc_error_conversions
ia0 Nov 28, 2017
8e025d8
Fix doc test of previous commit
ia0 Nov 28, 2017
2485afa
Deploy builds both with asserts enabled and asserts disabled to CI.
Mark-Simulacrum Nov 29, 2017
2c98378
Reject '2' as a binary digit in internals of 'b' formatting
daboross Nov 29, 2017
0ec3aee
Rollup merge of #45969 - ia0:mpsc_recv_deadline, r=alexcrichton
kennytm Nov 29, 2017
963ab91
Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=ale…
kennytm Nov 29, 2017
6006c0f
Rollup merge of #46219 - rust-lang:frewsxcv-issue-45636, r=GuillaumeG…
kennytm Nov 29, 2017
0e78c29
Rollup merge of #46287 - SimonSapin:stable-constness, r=aturon
kennytm Nov 29, 2017
fc9abbd
Rollup merge of #46293 - ollie27:atomic_bool_from, r=BurntSushi
kennytm Nov 29, 2017
a19c13a
Rollup merge of #46322 - gnzlbg:mmx, r=alexcrichton
kennytm Nov 29, 2017
30f1853
Rollup merge of #46323 - ia0:fix_mpsc_error_conv, r=kennytm
kennytm Nov 29, 2017
1e49d4a
Rollup merge of #46330 - SimonSapin:patch-6, r=kennytm
kennytm Nov 29, 2017
9a93df9
Rollup merge of #46354 - Mark-Simulacrum:alt-try, r=alexcrichton
kennytm Nov 29, 2017
51bd916
Rollup merge of #46356 - daboross:patch-2, r=sfackler
kennytm Nov 29, 2017
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
36 changes: 26 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ matrix:
if: type = pull_request OR branch = auto

- env: IMAGE=dist-x86_64-linux DEPLOY=1
if: branch = auto
if: branch = try OR branch = auto

# "alternate" deployments, these are "nightlies" but don't have assertions
# turned on, they're deployed to a different location primarily for projects
# which are stuck on nightly and don't want llvm assertions in the artifacts
# that they use.
# "alternate" deployments, these are "nightlies" but have LLVM assertions
# turned on, they're deployed to a different location primarily for
# additional testing.
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
if: branch = try OR branch = auto

Expand Down Expand Up @@ -310,22 +309,39 @@ deploy:
branch: auto
condition: $DEPLOY = 1

# this is the same as the above deployment provider except that it uploads to
# a slightly different directory and has a different trigger
- provider: s3
bucket: rust-lang-ci2
skip_cleanup: true
local_dir: deploy
upload_dir: rustc-builds-try
upload_dir: rustc-builds-alt
acl: public_read
region: us-west-1
access_key_id: AKIAJVBODR3IA4O72THQ
secret_access_key:
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
on:
branch: try
branch: auto
condition: $DEPLOY_ALT = 1

# this is the same as the above deployment provider except that it uploads to
# a slightly different directory and has a different trigger
# These two providers are the same as the two above, except deploy on the
# try branch. Travis does not appear to provide a way to use "or" in these
# conditions.
- provider: s3
bucket: rust-lang-ci2
skip_cleanup: true
local_dir: deploy
upload_dir: rustc-builds
acl: public_read
region: us-west-1
access_key_id: AKIAJVBODR3IA4O72THQ
secret_access_key:
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
on:
branch: try
condition: $DEPLOY = 1

- provider: s3
bucket: rust-lang-ci2
skip_cleanup: true
Expand All @@ -337,5 +353,5 @@ deploy:
secret_access_key:
secure: "kUGd3t7JcVWFESgIlzvsM8viZgCA9Encs3creW0xLJaLSeI1iVjlJK4h/2/nO6y224AFrh/GUfsNr4/4AlxPuYb8OU5oC5Lv+Ff2JiRDYtuNpyQSKAQp+bRYytWMtrmhja91h118Mbm90cUfcLPwkdiINgJNTXhPKg5Cqu3VYn0="
on:
branch: auto
branch: try
condition: $DEPLOY_ALT = 1
233 changes: 106 additions & 127 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1428,15 +1428,45 @@ impl<T> [T] {
///
/// # Examples
///
/// Cloning two elements from a slice into another:
///
/// ```
/// let src = [1, 2, 3, 4];
/// let mut dst = [0, 0];
///
/// dst.clone_from_slice(&src[2..]);
///
/// assert_eq!(src, [1, 2, 3, 4]);
/// assert_eq!(dst, [3, 4]);
/// ```
///
/// Rust enforces that there can only be one mutable reference with no
/// immutable references to a particular piece of data in a particular
/// scope. Because of this, attempting to use `clone_from_slice` on a
/// single slice will result in a compile failure:
///
/// ```compile_fail
/// let mut slice = [1, 2, 3, 4, 5];
///
/// slice[..2].clone_from_slice(&slice[3..]); // compile fail!
/// ```
///
/// To work around this, we can use [`split_at_mut`] to create two distinct
/// sub-slices from a slice:
///
/// ```
/// let mut dst = [0, 0, 0];
/// let src = [1, 2, 3];
/// let mut slice = [1, 2, 3, 4, 5];
///
/// dst.clone_from_slice(&src);
/// assert!(dst == [1, 2, 3]);
/// {
/// let (left, right) = slice.split_at_mut(2);
/// left.clone_from_slice(&right[1..]);
/// }
///
/// assert_eq!(slice, [4, 5, 3, 4, 5]);
/// ```
///
/// [`copy_from_slice`]: #method.copy_from_slice
/// [`split_at_mut`]: #method.split_at_mut
#[stable(feature = "clone_from_slice", since = "1.7.0")]
pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
core_slice::SliceExt::clone_from_slice(self, src)
Expand All @@ -1454,15 +1484,45 @@ impl<T> [T] {
///
/// # Examples
///
/// Copying two elements from a slice into another:
///
/// ```
/// let src = [1, 2, 3, 4];
/// let mut dst = [0, 0];
///
/// dst.copy_from_slice(&src[2..]);
///
/// assert_eq!(src, [1, 2, 3, 4]);
/// assert_eq!(dst, [3, 4]);
/// ```
///
/// Rust enforces that there can only be one mutable reference with no
/// immutable references to a particular piece of data in a particular
/// scope. Because of this, attempting to use `copy_from_slice` on a
/// single slice will result in a compile failure:
///
/// ```compile_fail
/// let mut slice = [1, 2, 3, 4, 5];
///
/// slice[..2].copy_from_slice(&slice[3..]); // compile fail!
/// ```
///
/// To work around this, we can use [`split_at_mut`] to create two distinct
/// sub-slices from a slice:
///
/// ```
/// let mut dst = [0, 0, 0];
/// let src = [1, 2, 3];
/// let mut slice = [1, 2, 3, 4, 5];
///
/// dst.copy_from_slice(&src);
/// assert_eq!(src, dst);
/// {
/// let (left, right) = slice.split_at_mut(2);
/// left.copy_from_slice(&right[1..]);
/// }
///
/// assert_eq!(slice, [4, 5, 3, 4, 5]);
/// ```
///
/// [`clone_from_slice`]: #method.clone_from_slice
/// [`split_at_mut`]: #method.split_at_mut
#[stable(feature = "copy_from_slice", since = "1.9.0")]
pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
core_slice::SliceExt::copy_from_slice(self, src)
Expand All @@ -1478,16 +1538,49 @@ impl<T> [T] {
///
/// # Example
///
/// Swapping two elements across slices:
///
/// ```
/// #![feature(swap_with_slice)]
///
/// let mut slice1 = [0, 0];
/// let mut slice2 = [1, 2, 3, 4];
///
/// slice1.swap_with_slice(&mut slice2[2..]);
///
/// assert_eq!(slice1, [3, 4]);
/// assert_eq!(slice2, [1, 2, 0, 0]);
/// ```
///
/// Rust enforces that there can only be one mutable reference to a
/// particular piece of data in a particular scope. Because of this,
/// attempting to use `swap_with_slice` on a single slice will result in
/// a compile failure:
///
/// ```compile_fail
/// #![feature(swap_with_slice)]
///
/// let mut slice = [1, 2, 3, 4, 5];
/// slice[..2].swap_with_slice(&mut slice[3..]); // compile fail!
/// ```
///
/// To work around this, we can use [`split_at_mut`] to create two distinct
/// mutable sub-slices from a slice:
///
/// ```
/// #![feature(swap_with_slice)]
///
/// let mut slice1 = [1, 2, 3];
/// let mut slice2 = [7, 8, 9];
/// let mut slice = [1, 2, 3, 4, 5];
///
/// {
/// let (left, right) = slice.split_at_mut(2);
/// left.swap_with_slice(&mut right[1..]);
/// }
///
/// slice1.swap_with_slice(&mut slice2);
/// assert_eq!(slice1, [7, 8, 9]);
/// assert_eq!(slice2, [1, 2, 3]);
/// assert_eq!(slice, [4, 5, 3, 1, 2]);
/// ```
///
/// [`split_at_mut`]: #method.split_at_mut
#[unstable(feature = "swap_with_slice", issue = "44030")]
pub fn swap_with_slice(&mut self, other: &mut [T]) {
core_slice::SliceExt::swap_with_slice(self, other)
Expand Down Expand Up @@ -1626,120 +1719,6 @@ impl [u8] {
byte.make_ascii_lowercase();
}
}

/// Checks if all bytes of this slice are ASCII alphabetic characters:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphabetic(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphabetic())
}

/// Checks if all bytes of this slice are ASCII uppercase characters:
/// U+0041 'A' ... U+005A 'Z'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_uppercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_uppercase())
}

/// Checks if all bytes of this slice are ASCII lowercase characters:
/// U+0061 'a' ... U+007A 'z'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_lowercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_lowercase())
}

/// Checks if all bytes of this slice are ASCII alphanumeric characters:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z', or
/// - U+0030 '0' ... U+0039 '9'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphanumeric(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphanumeric())
}

/// Checks if all bytes of this slice are ASCII decimal digit:
/// U+0030 '0' ... U+0039 '9'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_digit(&self) -> bool {
self.iter().all(|b| b.is_ascii_digit())
}

/// Checks if all bytes of this slice are ASCII hexadecimal digits:
///
/// - U+0030 '0' ... U+0039 '9', or
/// - U+0041 'A' ... U+0046 'F', or
/// - U+0061 'a' ... U+0066 'f'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_hexdigit(&self) -> bool {
self.iter().all(|b| b.is_ascii_hexdigit())
}

/// Checks if all bytes of this slice are ASCII punctuation characters:
///
/// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ... U+0040 `: ; < = > ? @`, or
/// - U+005B ... U+0060 `[ \\ ] ^ _ \``, or
/// - U+007B ... U+007E `{ | } ~`
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_punctuation(&self) -> bool {
self.iter().all(|b| b.is_ascii_punctuation())
}

/// Checks if all bytes of this slice are ASCII graphic characters:
/// U+0021 '@' ... U+007E '~'.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_graphic(&self) -> bool {
self.iter().all(|b| b.is_ascii_graphic())
}

/// Checks if all bytes of this slice are ASCII whitespace characters:
/// U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED,
/// U+000C FORM FEED, or U+000D CARRIAGE RETURN.
///
/// Rust uses the WhatWG Infra Standard's [definition of ASCII
/// whitespace][infra-aw]. There are several other definitions in
/// wide use. For instance, [the POSIX locale][pct] includes
/// U+000B VERTICAL TAB as well as all the above characters,
/// but—from the very same specification—[the default rule for
/// "field splitting" in the Bourne shell][bfs] considers *only*
/// SPACE, HORIZONTAL TAB, and LINE FEED as whitespace.
///
/// If you are writing a program that will process an existing
/// file format, check what that format's definition of whitespace is
/// before using this function.
///
/// [infra-aw]: https://infra.spec.whatwg.org/#ascii-whitespace
/// [pct]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_01
/// [bfs]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_whitespace(&self) -> bool {
self.iter().all(|b| b.is_ascii_whitespace())
}

/// Checks if all bytes of this slice are ASCII control characters:
///
/// - U+0000 NUL ... U+001F UNIT SEPARATOR, or
/// - U+007F DELETE.
///
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_control(&self) -> bool {
self.iter().all(|b| b.is_ascii_control())
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading