about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-06 16:58:27 +0000
committerbors <bors@rust-lang.org>2018-08-06 16:58:27 +0000
commitb2397437530eecef72a1524a7e0a4b42034fa360 (patch)
tree429466887a0f431e3586e4985775d268dd2374f1 /src/liballoc
parent4b8089daf8046d7999310d44e5c68ccff4ab255a (diff)
parent4687476470d383fefe62ac9cde4e6f9015ba550f (diff)
downloadrust-b2397437530eecef72a1524a7e0a4b42034fa360.tar.gz
rust-b2397437530eecef72a1524a7e0a4b42034fa360.zip
Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboats
Add errors for unknown, stable and duplicate feature attributes

- Adds an error for unknown (lang and lib) features.
- Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
- Adds an error for duplicate (lang and lib) features.

```rust
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute
```

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:
- [x] Stability attributes on macros do not seem to be taken into account.
- [x] Stability attributes behind `cfg` attributes are not taken into account.
- [x] There are failing incremental tests.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/benches/lib.rs1
-rw-r--r--src/liballoc/collections/vec_deque.rs2
-rw-r--r--src/liballoc/lib.rs14
-rw-r--r--src/liballoc/tests/lib.rs3
4 files changed, 4 insertions, 16 deletions
diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs
index 4f69aa6670b..b4f4fd74f3a 100644
--- a/src/liballoc/benches/lib.rs
+++ b/src/liballoc/benches/lib.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(rand)]
 #![feature(repr_simd)]
 #![feature(slice_sort_by_cached_key)]
 #![feature(test)]
diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs
index ba92b886138..7787102ba82 100644
--- a/src/liballoc/collections/vec_deque.rs
+++ b/src/liballoc/collections/vec_deque.rs
@@ -2370,7 +2370,7 @@ macro_rules! __impl_slice_eq1 {
         __impl_slice_eq1! { $Lhs, $Rhs, Sized }
     };
     ($Lhs: ty, $Rhs: ty, $Bound: ident) => {
-        #[stable(feature = "vec-deque-partial-eq-slice", since = "1.17.0")]
+        #[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")]
         impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
             fn eq(&self, other: &$Rhs) -> bool {
                 if self.len() != other.len() {
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index ca1b7507b5e..d1b607bbe9b 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -74,27 +74,24 @@
 #![needs_allocator]
 #![deny(missing_debug_implementations)]
 
-#![cfg_attr(test, allow(deprecated))] // rand
-#![cfg_attr(not(test), feature(exact_size_is_empty))]
+#![cfg_attr(not(test), feature(fn_traits))]
 #![cfg_attr(not(test), feature(generator_trait))]
-#![cfg_attr(test, feature(rand, test))]
+#![cfg_attr(test, feature(test))]
+
 #![feature(allocator_api)]
 #![feature(allow_internal_unstable)]
 #![feature(arbitrary_self_types)]
-#![feature(ascii_ctype)]
 #![feature(box_into_raw_non_null)]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(cfg_target_has_atomic)]
 #![feature(coerce_unsized)]
-#![feature(collections_range)]
 #![feature(const_fn)]
 #![feature(core_intrinsics)]
 #![feature(custom_attribute)]
 #![feature(dropck_eyepatch)]
 #![feature(exact_size_is_empty)]
 #![feature(fmt_internals)]
-#![feature(from_ref)]
 #![feature(fundamental)]
 #![feature(futures_api)]
 #![feature(lang_items)]
@@ -118,14 +115,9 @@
 #![feature(allocator_internals)]
 #![feature(on_unimplemented)]
 #![feature(exact_chunks)]
-#![feature(pointer_methods)]
-#![feature(inclusive_range_methods)]
 #![feature(rustc_const_unstable)]
 #![feature(const_vec_new)]
 
-#![cfg_attr(not(test), feature(fn_traits, i128))]
-#![cfg_attr(test, feature(test))]
-
 // Allow testing this library
 
 #[cfg(test)]
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs
index 618aff963f2..c12c7a81f79 100644
--- a/src/liballoc/tests/lib.rs
+++ b/src/liballoc/tests/lib.rs
@@ -16,11 +16,8 @@
 #![feature(drain_filter)]
 #![feature(exact_size_is_empty)]
 #![feature(pattern)]
-#![feature(rand)]
 #![feature(slice_sort_by_cached_key)]
-#![feature(splice)]
 #![feature(str_escape)]
-#![feature(string_retain)]
 #![feature(try_reserve)]
 #![feature(unboxed_closures)]
 #![feature(exact_chunks)]