about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-05-14 23:22:47 +0000
committerbors <bors@rust-lang.org>2020-05-14 23:22:47 +0000
commit85f0da67ff31923955f7fb107fb097835bb3b6ff (patch)
tree341c7d6dbfebd78f1864d5d5048ea3b33c44e30d /src/libcore
parenta74d1862d4d87a56244958416fd05976c58ca1a8 (diff)
parentcb2703945ca3c6c9664a5a9ec606430cb79ba2c8 (diff)
downloadrust-85f0da67ff31923955f7fb107fb097835bb3b6ff.tar.gz
rust-85f0da67ff31923955f7fb107fb097835bb3b6ff.zip
Auto merge of #71321 - matthewjasper:alloc-min-spec, r=sfackler
Use min_specialization in liballoc

- Remove a type parameter from `[A]RcFromIter`.
- Remove an implementation of `[A]RcFromIter` that didn't actually
  specialize anything.
- Remove unused implementation of `IsZero` for `Option<&mut T>`.
- Change specializations of `[A]RcEqIdent` to use a marker trait version
of `Eq`.
- Remove `BTreeClone`. I couldn't find a way to make this work with
  `min_specialization`.
- Add `rustc_unsafe_specialization_marker` to `Copy` and `TrustedLen`.

After this only libcore is the only standard library crate using `feature(specialization)`.
cc #31844
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter/traits/marker.rs2
-rw-r--r--src/libcore/marker.rs7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/iter/traits/marker.rs b/src/libcore/iter/traits/marker.rs
index 404cc84495c..a9ba3908c38 100644
--- a/src/libcore/iter/traits/marker.rs
+++ b/src/libcore/iter/traits/marker.rs
@@ -13,6 +13,7 @@
 /// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse
 /// [`Fuse`]: ../../std/iter/struct.Fuse.html
 #[stable(feature = "fused", since = "1.26.0")]
+#[rustc_unsafe_specialization_marker]
 pub trait FusedIterator: Iterator {}
 
 #[stable(feature = "fused", since = "1.26.0")]
@@ -38,6 +39,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for &mut I {}
 /// [`usize::MAX`]: ../../std/usize/constant.MAX.html
 /// [`.size_hint`]: ../../std/iter/trait.Iterator.html#method.size_hint
 #[unstable(feature = "trusted_len", issue = "37572")]
+#[rustc_unsafe_specialization_marker]
 pub unsafe trait TrustedLen: Iterator {}
 
 #[unstable(feature = "trusted_len", issue = "37572")]
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 09a8b417e6e..339b07119c6 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -363,6 +363,13 @@ pub trait StructuralEq {
 /// [impls]: #implementors
 #[stable(feature = "rust1", since = "1.0.0")]
 #[lang = "copy"]
+// FIXME(matthewjasper) This allows copying a type that doesn't implement
+// `Copy` because of unsatisfied lifetime bounds (copying `A<'_>` when only
+// `A<'static>: Copy` and `A<'_>: Clone`).
+// We have this attribute here for now only because there are quite a few
+// existing specializations on `Copy` that already exist in the standard
+// library, and there's no way to safely have this behavior right now.
+#[rustc_unsafe_specialization_marker]
 pub trait Copy: Clone {
     // Empty.
 }