diff options
| author | bors <bors@rust-lang.org> | 2019-07-11 04:45:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-07-11 04:45:15 +0000 |
| commit | 69070058cd2fdb57ebbbbef94892cfb5688ce27f (patch) | |
| tree | 2cecc439269108897d4bec08cc5cfe119c3f8fdd /src/libcore | |
| parent | 35cacbce1661366250a877da4fa5b6b4cb03542e (diff) | |
| parent | f9034ce8bc42e2cfed14373a1e0952e4ac67da4d (diff) | |
| download | rust-69070058cd2fdb57ebbbbef94892cfb5688ce27f.tar.gz rust-69070058cd2fdb57ebbbbef94892cfb5688ce27f.zip | |
Auto merge of #62580 - Centril:rollup-remihe0, r=Centril
Rollup of 7 pull requests Successful merges: - #61665 (core: check for pointer equality when comparing Eq slices) - #61923 (Prerequisites from dep graph refactoring #2) - #62270 (Move async-await tests from run-pass to ui) - #62425 (filedesc: don't use ioctl(FIOCLEX) on Linux) - #62476 (Continue refactoring macro expansion and resolution) - #62519 (Regression test for HRTB bug (issue 30786).) - #62557 (Fix typo in libcore/intrinsics.rs) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 3 | ||||
| -rw-r--r-- | src/libcore/macros.rs | 3 | ||||
| -rw-r--r-- | src/libcore/ops/try.rs | 4 | ||||
| -rw-r--r-- | src/libcore/slice/mod.rs | 23 |
4 files changed, 24 insertions, 9 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 67430e5bbda..513e22a788c 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -705,7 +705,8 @@ extern "rust-intrinsic" { they should be used through stabilized interfaces \ in the rest of the standard library", issue = "0")] - #[rustc_deprecated(reason = "no longer used by rustc, will be removed - use MaybeUnint instead", + #[rustc_deprecated(reason = "no longer used by rustc, will be removed - use MaybeUninit \ + instead", since = "1.38.0")] pub fn init<T>() -> T; diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 2e999a0682b..293a2dd9492 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -1244,12 +1244,14 @@ mod builtin { /// Attribute macro applied to a function to turn it into a unit test. #[stable(feature = "rust1", since = "1.0.0")] + #[allow_internal_unstable(test, rustc_attrs)] #[rustc_builtin_macro] #[rustc_macro_transparency = "semitransparent"] pub macro test($item:item) { /* compiler built-in */ } /// Attribute macro applied to a function to turn it into a benchmark test. #[stable(feature = "rust1", since = "1.0.0")] + #[allow_internal_unstable(test, rustc_attrs)] #[rustc_builtin_macro] #[rustc_macro_transparency = "semitransparent"] pub macro bench($item:item) { /* compiler built-in */ } @@ -1257,6 +1259,7 @@ mod builtin { /// An implementation detail of the `#[test]` and `#[bench]` macros. #[unstable(feature = "custom_test_frameworks", issue = "50297", reason = "custom test frameworks are an unstable feature")] + #[allow_internal_unstable(test, rustc_attrs)] #[rustc_builtin_macro] #[rustc_macro_transparency = "semitransparent"] pub macro test_case($item:item) { /* compiler built-in */ } diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 9fa2c81954e..76fec1020f1 100644 --- a/src/libcore/ops/try.rs +++ b/src/libcore/ops/try.rs @@ -8,12 +8,12 @@ #[rustc_on_unimplemented( on(all( any(from_method="from_error", from_method="from_ok"), - from_desugaring="?"), + from_desugaring="QuestionMark"), message="the `?` operator can only be used in a \ function that returns `Result` or `Option` \ (or another type that implements `{Try}`)", label="cannot use the `?` operator in a function that returns `{Self}`"), - on(all(from_method="into_result", from_desugaring="?"), + on(all(from_method="into_result", from_desugaring="QuestionMark"), message="the `?` operator can only be applied to values \ that implement `{Try}`", label="the `?` operator cannot be applied to type `{Self}`") diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index fdf3cc8e006..363ae088275 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -5342,13 +5342,24 @@ impl<A, B> SlicePartialEq<B> for [A] return false; } - for i in 0..self.len() { - if !self[i].eq(&other[i]) { - return false; - } + self.iter().zip(other.iter()).all(|(x, y)| x == y) + } +} + +// Use an equal-pointer optimization when types are `Eq` +impl<A> SlicePartialEq<A> for [A] + where A: PartialEq<A> + Eq +{ + default fn equal(&self, other: &[A]) -> bool { + if self.len() != other.len() { + return false; + } + + if self.as_ptr() == other.as_ptr() { + return true; } - true + self.iter().zip(other.iter()).all(|(x, y)| x == y) } } @@ -5457,7 +5468,7 @@ impl SliceOrd<u8> for [u8] { #[doc(hidden)] /// Trait implemented for types that can be compared for equality using /// their bytewise representation -trait BytewiseEquality { } +trait BytewiseEquality: Eq + Copy { } macro_rules! impl_marker_for { ($traitname:ident, $($ty:ty)*) => { |
