Skip to content

Commit b239743

Browse files
committed
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.
2 parents 4b8089d + 4687476 commit b239743

File tree

399 files changed

+1040
-1210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+1040
-1210
lines changed

src/etc/test-float-parse/many-digits.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rand)]
12-
1311
extern crate rand;
1412

1513
mod _common;

src/etc/test-float-parse/rand-f64.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rand)]
12-
1311
extern crate rand;
1412

1513
mod _common;

src/liballoc/benches/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rand)]
1211
#![feature(repr_simd)]
1312
#![feature(slice_sort_by_cached_key)]
1413
#![feature(test)]

src/liballoc/collections/vec_deque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ macro_rules! __impl_slice_eq1 {
23702370
__impl_slice_eq1! { $Lhs, $Rhs, Sized }
23712371
};
23722372
($Lhs: ty, $Rhs: ty, $Bound: ident) => {
2373-
#[stable(feature = "vec-deque-partial-eq-slice", since = "1.17.0")]
2373+
#[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")]
23742374
impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
23752375
fn eq(&self, other: &$Rhs) -> bool {
23762376
if self.len() != other.len() {

src/liballoc/lib.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,24 @@
7474
#![needs_allocator]
7575
#![deny(missing_debug_implementations)]
7676

77-
#![cfg_attr(test, allow(deprecated))] // rand
78-
#![cfg_attr(not(test), feature(exact_size_is_empty))]
77+
#![cfg_attr(not(test), feature(fn_traits))]
7978
#![cfg_attr(not(test), feature(generator_trait))]
80-
#![cfg_attr(test, feature(rand, test))]
79+
#![cfg_attr(test, feature(test))]
80+
8181
#![feature(allocator_api)]
8282
#![feature(allow_internal_unstable)]
8383
#![feature(arbitrary_self_types)]
84-
#![feature(ascii_ctype)]
8584
#![feature(box_into_raw_non_null)]
8685
#![feature(box_patterns)]
8786
#![feature(box_syntax)]
8887
#![feature(cfg_target_has_atomic)]
8988
#![feature(coerce_unsized)]
90-
#![feature(collections_range)]
9189
#![feature(const_fn)]
9290
#![feature(core_intrinsics)]
9391
#![feature(custom_attribute)]
9492
#![feature(dropck_eyepatch)]
9593
#![feature(exact_size_is_empty)]
9694
#![feature(fmt_internals)]
97-
#![feature(from_ref)]
9895
#![feature(fundamental)]
9996
#![feature(futures_api)]
10097
#![feature(lang_items)]
@@ -118,14 +115,9 @@
118115
#![feature(allocator_internals)]
119116
#![feature(on_unimplemented)]
120117
#![feature(exact_chunks)]
121-
#![feature(pointer_methods)]
122-
#![feature(inclusive_range_methods)]
123118
#![feature(rustc_const_unstable)]
124119
#![feature(const_vec_new)]
125120

126-
#![cfg_attr(not(test), feature(fn_traits, i128))]
127-
#![cfg_attr(test, feature(test))]
128-
129121
// Allow testing this library
130122

131123
#[cfg(test)]

src/liballoc/tests/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
#![feature(drain_filter)]
1717
#![feature(exact_size_is_empty)]
1818
#![feature(pattern)]
19-
#![feature(rand)]
2019
#![feature(slice_sort_by_cached_key)]
21-
#![feature(splice)]
2220
#![feature(str_escape)]
23-
#![feature(string_retain)]
2421
#![feature(try_reserve)]
2522
#![feature(unboxed_closures)]
2623
#![feature(exact_chunks)]

src/libcore/char/methods.rs

-20
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,6 @@ impl char {
10501050
/// # Examples
10511051
///
10521052
/// ```
1053-
/// #![feature(ascii_ctype)]
1054-
///
10551053
/// let uppercase_a = 'A';
10561054
/// let uppercase_g = 'G';
10571055
/// let a = 'a';
@@ -1084,8 +1082,6 @@ impl char {
10841082
/// # Examples
10851083
///
10861084
/// ```
1087-
/// #![feature(ascii_ctype)]
1088-
///
10891085
/// let uppercase_a = 'A';
10901086
/// let uppercase_g = 'G';
10911087
/// let a = 'a';
@@ -1118,8 +1114,6 @@ impl char {
11181114
/// # Examples
11191115
///
11201116
/// ```
1121-
/// #![feature(ascii_ctype)]
1122-
///
11231117
/// let uppercase_a = 'A';
11241118
/// let uppercase_g = 'G';
11251119
/// let a = 'a';
@@ -1155,8 +1149,6 @@ impl char {
11551149
/// # Examples
11561150
///
11571151
/// ```
1158-
/// #![feature(ascii_ctype)]
1159-
///
11601152
/// let uppercase_a = 'A';
11611153
/// let uppercase_g = 'G';
11621154
/// let a = 'a';
@@ -1189,8 +1181,6 @@ impl char {
11891181
/// # Examples
11901182
///
11911183
/// ```
1192-
/// #![feature(ascii_ctype)]
1193-
///
11941184
/// let uppercase_a = 'A';
11951185
/// let uppercase_g = 'G';
11961186
/// let a = 'a';
@@ -1226,8 +1216,6 @@ impl char {
12261216
/// # Examples
12271217
///
12281218
/// ```
1229-
/// #![feature(ascii_ctype)]
1230-
///
12311219
/// let uppercase_a = 'A';
12321220
/// let uppercase_g = 'G';
12331221
/// let a = 'a';
@@ -1264,8 +1252,6 @@ impl char {
12641252
/// # Examples
12651253
///
12661254
/// ```
1267-
/// #![feature(ascii_ctype)]
1268-
///
12691255
/// let uppercase_a = 'A';
12701256
/// let uppercase_g = 'G';
12711257
/// let a = 'a';
@@ -1298,8 +1284,6 @@ impl char {
12981284
/// # Examples
12991285
///
13001286
/// ```
1301-
/// #![feature(ascii_ctype)]
1302-
///
13031287
/// let uppercase_a = 'A';
13041288
/// let uppercase_g = 'G';
13051289
/// let a = 'a';
@@ -1349,8 +1333,6 @@ impl char {
13491333
/// # Examples
13501334
///
13511335
/// ```
1352-
/// #![feature(ascii_ctype)]
1353-
///
13541336
/// let uppercase_a = 'A';
13551337
/// let uppercase_g = 'G';
13561338
/// let a = 'a';
@@ -1385,8 +1367,6 @@ impl char {
13851367
/// # Examples
13861368
///
13871369
/// ```
1388-
/// #![feature(ascii_ctype)]
1389-
///
13901370
/// let uppercase_a = 'A';
13911371
/// let uppercase_g = 'G';
13921372
/// let a = 'a';

src/libcore/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
#![feature(concat_idents)]
8383
#![feature(const_fn)]
8484
#![feature(const_int_ops)]
85-
#![feature(core_float)]
8685
#![feature(custom_attribute)]
8786
#![feature(doc_cfg)]
8887
#![feature(doc_spotlight)]
@@ -102,16 +101,13 @@
102101
#![feature(rustc_attrs)]
103102
#![feature(rustc_const_unstable)]
104103
#![feature(simd_ffi)]
105-
#![feature(core_slice_ext)]
106-
#![feature(core_str_ext)]
107104
#![feature(specialization)]
108105
#![feature(staged_api)]
109106
#![feature(stmt_expr_attributes)]
110107
#![feature(unboxed_closures)]
111108
#![feature(untagged_unions)]
112109
#![feature(unwind_attributes)]
113110
#![feature(doc_alias)]
114-
#![feature(inclusive_range_methods)]
115111
#![feature(mmx_target_feature)]
116112
#![feature(tbm_target_feature)]
117113
#![feature(sse4a_target_feature)]

src/libcore/num/mod.rs

-20
Original file line numberDiff line numberDiff line change
@@ -3761,8 +3761,6 @@ impl u8 {
37613761
/// # Examples
37623762
///
37633763
/// ```
3764-
/// #![feature(ascii_ctype)]
3765-
///
37663764
/// let uppercase_a = b'A';
37673765
/// let uppercase_g = b'G';
37683766
/// let a = b'a';
@@ -3799,8 +3797,6 @@ impl u8 {
37993797
/// # Examples
38003798
///
38013799
/// ```
3802-
/// #![feature(ascii_ctype)]
3803-
///
38043800
/// let uppercase_a = b'A';
38053801
/// let uppercase_g = b'G';
38063802
/// let a = b'a';
@@ -3837,8 +3833,6 @@ impl u8 {
38373833
/// # Examples
38383834
///
38393835
/// ```
3840-
/// #![feature(ascii_ctype)]
3841-
///
38423836
/// let uppercase_a = b'A';
38433837
/// let uppercase_g = b'G';
38443838
/// let a = b'a';
@@ -3878,8 +3872,6 @@ impl u8 {
38783872
/// # Examples
38793873
///
38803874
/// ```
3881-
/// #![feature(ascii_ctype)]
3882-
///
38833875
/// let uppercase_a = b'A';
38843876
/// let uppercase_g = b'G';
38853877
/// let a = b'a';
@@ -3916,8 +3908,6 @@ impl u8 {
39163908
/// # Examples
39173909
///
39183910
/// ```
3919-
/// #![feature(ascii_ctype)]
3920-
///
39213911
/// let uppercase_a = b'A';
39223912
/// let uppercase_g = b'G';
39233913
/// let a = b'a';
@@ -3957,8 +3947,6 @@ impl u8 {
39573947
/// # Examples
39583948
///
39593949
/// ```
3960-
/// #![feature(ascii_ctype)]
3961-
///
39623950
/// let uppercase_a = b'A';
39633951
/// let uppercase_g = b'G';
39643952
/// let a = b'a';
@@ -3999,8 +3987,6 @@ impl u8 {
39993987
/// # Examples
40003988
///
40013989
/// ```
4002-
/// #![feature(ascii_ctype)]
4003-
///
40043990
/// let uppercase_a = b'A';
40053991
/// let uppercase_g = b'G';
40063992
/// let a = b'a';
@@ -4037,8 +4023,6 @@ impl u8 {
40374023
/// # Examples
40384024
///
40394025
/// ```
4040-
/// #![feature(ascii_ctype)]
4041-
///
40424026
/// let uppercase_a = b'A';
40434027
/// let uppercase_g = b'G';
40444028
/// let a = b'a';
@@ -4092,8 +4076,6 @@ impl u8 {
40924076
/// # Examples
40934077
///
40944078
/// ```
4095-
/// #![feature(ascii_ctype)]
4096-
///
40974079
/// let uppercase_a = b'A';
40984080
/// let uppercase_g = b'G';
40994081
/// let a = b'a';
@@ -4132,8 +4114,6 @@ impl u8 {
41324114
/// # Examples
41334115
///
41344116
/// ```
4135-
/// #![feature(ascii_ctype)]
4136-
///
41374117
/// let uppercase_a = b'A';
41384118
/// let uppercase_g = b'G';
41394119
/// let a = b'a';

src/libcore/slice/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ pub trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
20072007
fn index_mut(self, slice: &mut T) -> &mut Self::Output;
20082008
}
20092009

2010-
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
2010+
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
20112011
impl<T> SliceIndex<[T]> for usize {
20122012
type Output = T;
20132013

@@ -2056,7 +2056,7 @@ impl<T> SliceIndex<[T]> for usize {
20562056
}
20572057
}
20582058

2059-
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
2059+
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
20602060
impl<T> SliceIndex<[T]> for ops::Range<usize> {
20612061
type Output = [T];
20622062

@@ -2117,7 +2117,7 @@ impl<T> SliceIndex<[T]> for ops::Range<usize> {
21172117
}
21182118
}
21192119

2120-
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
2120+
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
21212121
impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
21222122
type Output = [T];
21232123

@@ -2152,7 +2152,7 @@ impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
21522152
}
21532153
}
21542154

2155-
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
2155+
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
21562156
impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
21572157
type Output = [T];
21582158

@@ -2187,7 +2187,7 @@ impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
21872187
}
21882188
}
21892189

2190-
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
2190+
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
21912191
impl<T> SliceIndex<[T]> for ops::RangeFull {
21922192
type Output = [T];
21932193

src/libcore/tests/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(ascii_ctype)]
1211
#![feature(box_syntax)]
1312
#![feature(cell_update)]
14-
#![feature(core_float)]
1513
#![feature(core_private_bignum)]
1614
#![feature(core_private_diy_float)]
1715
#![feature(dec2flt)]
18-
#![feature(decode_utf8)]
1916
#![feature(euclidean_division)]
2017
#![feature(exact_size_is_empty)]
2118
#![feature(fixed_size_array)]
22-
#![feature(float_internals)]
2319
#![feature(flt2dec)]
2420
#![feature(fmt_internals)]
2521
#![feature(hashmap_internals)]
@@ -29,7 +25,6 @@
2925
#![feature(refcell_map_split)]
3026
#![feature(refcell_replace_swap)]
3127
#![feature(slice_patterns)]
32-
#![feature(slice_rotate)]
3328
#![feature(sort_internals)]
3429
#![feature(specialization)]
3530
#![feature(step_trait)]

src/libpanic_unwind/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(staged_api)]
4040
#![feature(std_internals)]
4141
#![feature(unwind_attributes)]
42-
#![cfg_attr(target_env = "msvc", feature(raw))]
4342

4443
#![panic_runtime]
4544
#![feature(panic_runtime)]

src/librustc/dep_graph/dep_node.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ define_dep_nodes!( <'tcx>
615615
[input] CrateName(CrateNum),
616616
[] ItemChildren(DefId),
617617
[] ExternModStmtCnum(DefId),
618-
[input] GetLangItems,
618+
[eval_always] GetLibFeatures,
619+
[] DefinedLibFeatures(CrateNum),
620+
[eval_always] GetLangItems,
619621
[] DefinedLangItems(CrateNum),
620622
[] MissingLangItems(CrateNum),
621623
[] VisibleParentMap,

0 commit comments

Comments
 (0)