Skip to content

Commit 509f414

Browse files
committed
Ensure every unstable feature has a tracking issue.
1 parent 1a6bda6 commit 509f414

11 files changed

+67
-42
lines changed

src/libsyntax/feature_gate.rs

+24-22
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ declare_features! (
235235
(active, platform_intrinsics, "1.4.0", Some(27731), None),
236236

237237
// allow `#[unwind(..)]`
238-
// rust runtime internal
238+
// rustc internal for rust runtime
239239
(active, unwind_attributes, "1.4.0", None, None),
240240

241241
// allow the use of `#[naked]` on functions.
@@ -276,7 +276,7 @@ declare_features! (
276276
(active, never_type, "1.13.0", Some(35121), None),
277277

278278
// Allows exhaustive pattern matching on types that contain uninhabited types.
279-
(active, exhaustive_patterns, "1.13.0", None, None),
279+
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
280280

281281
// Allows all literals in attribute lists and values of key-value pairs.
282282
(active, attr_literals, "1.13.0", Some(34981), None),
@@ -294,12 +294,13 @@ declare_features! (
294294
(active, use_extern_macros, "1.15.0", Some(35896), None),
295295

296296
// `extern "ptx-*" fn()`
297-
(active, abi_ptx, "1.15.0", None, None),
297+
(active, abi_ptx, "1.15.0", Some(38788), None),
298298

299299
// The `repr(i128)` annotation for enums
300300
(active, repr128, "1.16.0", Some(35118), None),
301301

302302
// The `unadjusted` ABI. Perma unstable.
303+
// rustc internal
303304
(active, abi_unadjusted, "1.16.0", None, None),
304305

305306
// Procedural macros 2.0.
@@ -351,13 +352,14 @@ declare_features! (
351352
(active, unsized_tuple_coercion, "1.20.0", Some(42877), None),
352353

353354
// Generators
354-
(active, generators, "1.21.0", None, None),
355+
(active, generators, "1.21.0", Some(43122), None),
355356

356357
// Trait aliases
357358
(active, trait_alias, "1.24.0", Some(41517), None),
358359

359360
// global allocators and their internals
360-
(active, global_allocator, "1.20.0", None, None),
361+
(active, global_allocator, "1.20.0", Some(27389), None),
362+
// rustc internal
361363
(active, allocator_internals, "1.20.0", None, None),
362364

363365
// #[doc(cfg(...))]
@@ -415,7 +417,7 @@ declare_features! (
415417
(active, if_while_or_patterns, "1.26.0", Some(48215), None),
416418

417419
// Parentheses in patterns
418-
(active, pattern_parentheses, "1.26.0", None, None),
420+
(active, pattern_parentheses, "1.26.0", Some(51087), None),
419421

420422
// Allows `#[repr(packed)]` attribute on structs
421423
(active, repr_packed, "1.26.0", Some(33158), None),
@@ -424,10 +426,10 @@ declare_features! (
424426
(active, underscore_imports, "1.26.0", Some(48216), None),
425427

426428
// The #[wasm_custom_section] attribute
427-
(active, wasm_custom_section, "1.26.0", None, None),
429+
(active, wasm_custom_section, "1.26.0", Some(51088), None),
428430

429431
// The #![wasm_import_module] attribute
430-
(active, wasm_import_module, "1.26.0", None, None),
432+
(active, wasm_import_module, "1.26.0", Some(51088), None),
431433

432434
// Allows keywords to be escaped for use as identifiers
433435
(active, raw_identifiers, "1.26.0", Some(48589), None),
@@ -436,25 +438,25 @@ declare_features! (
436438
(active, macros_in_extern, "1.27.0", Some(49476), None),
437439

438440
// unstable #[target_feature] directives
439-
(active, arm_target_feature, "1.27.0", None, None),
440-
(active, aarch64_target_feature, "1.27.0", None, None),
441-
(active, hexagon_target_feature, "1.27.0", None, None),
442-
(active, powerpc_target_feature, "1.27.0", None, None),
443-
(active, mips_target_feature, "1.27.0", None, None),
444-
(active, avx512_target_feature, "1.27.0", None, None),
445-
(active, mmx_target_feature, "1.27.0", None, None),
446-
(active, sse4a_target_feature, "1.27.0", None, None),
447-
(active, tbm_target_feature, "1.27.0", None, None),
441+
(active, arm_target_feature, "1.27.0", Some(44839), None),
442+
(active, aarch64_target_feature, "1.27.0", Some(44839), None),
443+
(active, hexagon_target_feature, "1.27.0", Some(44839), None),
444+
(active, powerpc_target_feature, "1.27.0", Some(44839), None),
445+
(active, mips_target_feature, "1.27.0", Some(44839), None),
446+
(active, avx512_target_feature, "1.27.0", Some(44839), None),
447+
(active, mmx_target_feature, "1.27.0", Some(44839), None),
448+
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
449+
(active, tbm_target_feature, "1.27.0", Some(44839), None),
448450

449451
// Allows macro invocations of the form `#[foo::bar]`
450-
(active, proc_macro_path_invoc, "1.27.0", None, None),
452+
(active, proc_macro_path_invoc, "1.27.0", Some(38356), None),
451453

452454
// Allows macro invocations on modules expressions and statements and
453455
// procedural macros to expand to non-items.
454-
(active, proc_macro_mod, "1.27.0", None, None),
455-
(active, proc_macro_expr, "1.27.0", None, None),
456-
(active, proc_macro_non_items, "1.27.0", None, None),
457-
(active, proc_macro_gen, "1.27.0", None, None),
456+
(active, proc_macro_mod, "1.27.0", Some(38356), None),
457+
(active, proc_macro_expr, "1.27.0", Some(38356), None),
458+
(active, proc_macro_non_items, "1.27.0", Some(38356), None),
459+
(active, proc_macro_gen, "1.27.0", Some(38356), None),
458460

459461
// #[doc(alias = "...")]
460462
(active, doc_alias, "1.27.0", Some(50146), None),

src/test/ui/feature-gate-abi.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is expe
3838
|
3939
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
4040

41-
error[E0658]: PTX ABIs are experimental and subject to change
41+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
4242
--> $DIR/feature-gate-abi.rs:24:1
4343
|
4444
LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change
@@ -102,7 +102,7 @@ LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is ex
102102
|
103103
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
104104

105-
error[E0658]: PTX ABIs are experimental and subject to change
105+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
106106
--> $DIR/feature-gate-abi.rs:35:5
107107
|
108108
LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change
@@ -166,7 +166,7 @@ LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is
166166
|
167167
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
168168

169-
error[E0658]: PTX ABIs are experimental and subject to change
169+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
170170
--> $DIR/feature-gate-abi.rs:44:5
171171
|
172172
LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change
@@ -230,7 +230,7 @@ LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is
230230
|
231231
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
232232

233-
error[E0658]: PTX ABIs are experimental and subject to change
233+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
234234
--> $DIR/feature-gate-abi.rs:58:5
235235
|
236236
LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change
@@ -294,7 +294,7 @@ LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is
294294
|
295295
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
296296

297-
error[E0658]: PTX ABIs are experimental and subject to change
297+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
298298
--> $DIR/feature-gate-abi.rs:70:5
299299
|
300300
LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change
@@ -358,7 +358,7 @@ LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is
358358
|
359359
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
360360

361-
error[E0658]: PTX ABIs are experimental and subject to change
361+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
362362
--> $DIR/feature-gate-abi.rs:81:11
363363
|
364364
LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change
@@ -422,7 +422,7 @@ LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental
422422
|
423423
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable
424424

425-
error[E0658]: PTX ABIs are experimental and subject to change
425+
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
426426
--> $DIR/feature-gate-abi.rs:91:1
427427
|
428428
LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change

src/test/ui/feature-gate-generators.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: yield syntax is experimental
1+
error[E0658]: yield syntax is experimental (see issue #43122)
22
--> $DIR/feature-gate-generators.rs:12:5
33
|
44
LL | yield true; //~ ERROR yield syntax is experimental

src/test/ui/feature-gate-global_allocator.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: the `#[global_allocator]` attribute is an experimental feature
1+
error[E0658]: the `#[global_allocator]` attribute is an experimental feature (see issue #27389)
22
--> $DIR/feature-gate-global_allocator.rs:11:1
33
|
44
LL | #[global_allocator] //~ ERROR: attribute is an experimental feature

src/test/ui/feature-gate-pattern_parentheses.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: parentheses in patterns are unstable
1+
error[E0658]: parentheses in patterns are unstable (see issue #51087)
22
--> $DIR/feature-gate-pattern_parentheses.rs:13:9
33
|
44
LL | (pat) => {} //~ ERROR parentheses in patterns are unstable

src/test/ui/feature-gate-wasm_custom_section.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: attribute is currently unstable
1+
error[E0658]: attribute is currently unstable (see issue #51088)
22
--> $DIR/feature-gate-wasm_custom_section.rs:11:1
33
|
44
LL | #[wasm_custom_section = "foo"] //~ ERROR: attribute is currently unstable

src/test/ui/feature-gate-wasm_import_module.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: experimental attribute
1+
error[E0658]: experimental attribute (see issue #51088)
22
--> $DIR/feature-gate-wasm_import_module.rs:11:1
33
|
44
LL | #[wasm_import_module = "test"] //~ ERROR: experimental

src/test/ui/target-feature-gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: the target feature `avx512bw` is currently unstable
1+
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
22
--> $DIR/target-feature-gate.rs:26:18
33
|
44
LL | #[target_feature(enable = "avx512bw")]

src/tools/tidy/src/features.rs

+28-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Feature {
8181
pub type Features = HashMap<String, Feature>;
8282

8383
pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
84-
let mut features = collect_lang_features(path);
84+
let mut features = collect_lang_features(path, bad);
8585
assert!(!features.is_empty());
8686

8787
let lib_features = get_and_check_lib_features(path, bad, &features);
@@ -214,14 +214,27 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool {
214214
return false;
215215
}
216216

217-
pub fn collect_lang_features(base_src_path: &Path) -> Features {
217+
pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features {
218218
let mut contents = String::new();
219219
let path = base_src_path.join("libsyntax/feature_gate.rs");
220220
t!(t!(File::open(path)).read_to_string(&mut contents));
221221

222-
contents.lines()
223-
.filter_map(|line| {
224-
let mut parts = line.trim().split(",");
222+
// we allow rustc-internal features to omit a tracking issue.
223+
// these features must be marked with `// rustc internal` in its own group.
224+
let mut next_feature_is_rustc_internal = false;
225+
226+
contents.lines().zip(1..)
227+
.filter_map(|(line, line_number)| {
228+
let line = line.trim();
229+
if line.starts_with("// rustc internal") {
230+
next_feature_is_rustc_internal = true;
231+
return None;
232+
} else if line.is_empty() {
233+
next_feature_is_rustc_internal = false;
234+
return None;
235+
}
236+
237+
let mut parts = line.split(',');
225238
let level = match parts.next().map(|l| l.trim().trim_left_matches('(')) {
226239
Some("active") => Status::Unstable,
227240
Some("removed") => Status::Removed,
@@ -232,8 +245,18 @@ pub fn collect_lang_features(base_src_path: &Path) -> Features {
232245
let since = parts.next().unwrap().trim().trim_matches('"');
233246
let issue_str = parts.next().unwrap().trim();
234247
let tracking_issue = if issue_str.starts_with("None") {
248+
if level == Status::Unstable && !next_feature_is_rustc_internal {
249+
*bad = true;
250+
tidy_error!(
251+
bad,
252+
"libsyntax/feature_gate.rs:{}: no tracking issue for feature {}",
253+
line_number,
254+
name,
255+
);
256+
}
235257
None
236258
} else {
259+
next_feature_is_rustc_internal = false;
237260
let s = issue_str.split("(").nth(1).unwrap().split(")").nth(0).unwrap();
238261
Some(s.parse().unwrap())
239262
};

src/tools/tidy/src/unstable_book.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn check(path: &path::Path, bad: &mut bool) {
8686

8787
// Library features
8888

89-
let lang_features = collect_lang_features(path);
89+
let lang_features = collect_lang_features(path, bad);
9090
let lib_features = collect_lib_features(path).into_iter().filter(|&(ref name, _)| {
9191
!lang_features.contains_key(name)
9292
}).collect();

src/tools/unstable-book-gen/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn main() {
131131
let src_path = Path::new(&src_path_str);
132132
let dest_path = Path::new(&dest_path_str).join("src");
133133

134-
let lang_features = collect_lang_features(src_path);
134+
let lang_features = collect_lang_features(src_path, &mut false);
135135
let lib_features = collect_lib_features(src_path).into_iter().filter(|&(ref name, _)| {
136136
!lang_features.contains_key(name)
137137
}).collect();

0 commit comments

Comments
 (0)