Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure every unstable language feature has a tracking issue. #51090

Merged
merged 1 commit into from
May 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ declare_features! (
(active, platform_intrinsics, "1.4.0", Some(27731), None),

// allow `#[unwind(..)]`
// rust runtime internal
// rustc internal for rust runtime
(active, unwind_attributes, "1.4.0", None, None),

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

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

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

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

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

// The `unadjusted` ABI. Perma unstable.
// rustc internal
(active, abi_unadjusted, "1.16.0", None, None),

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

// Generators
(active, generators, "1.21.0", None, None),
(active, generators, "1.21.0", Some(43122), None),

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

// global allocators and their internals
(active, global_allocator, "1.20.0", None, None),
(active, global_allocator, "1.20.0", Some(27389), None),
// rustc internal
(active, allocator_internals, "1.20.0", None, None),

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

// Parentheses in patterns
(active, pattern_parentheses, "1.26.0", None, None),
(active, pattern_parentheses, "1.26.0", Some(51087), None),

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

// The #[wasm_custom_section] attribute
(active, wasm_custom_section, "1.26.0", None, None),
(active, wasm_custom_section, "1.26.0", Some(51088), None),

// The #![wasm_import_module] attribute
(active, wasm_import_module, "1.26.0", None, None),
(active, wasm_import_module, "1.26.0", Some(51088), None),

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

// unstable #[target_feature] directives
(active, arm_target_feature, "1.27.0", None, None),
(active, aarch64_target_feature, "1.27.0", None, None),
(active, hexagon_target_feature, "1.27.0", None, None),
(active, powerpc_target_feature, "1.27.0", None, None),
(active, mips_target_feature, "1.27.0", None, None),
(active, avx512_target_feature, "1.27.0", None, None),
(active, mmx_target_feature, "1.27.0", None, None),
(active, sse4a_target_feature, "1.27.0", None, None),
(active, tbm_target_feature, "1.27.0", None, None),
(active, arm_target_feature, "1.27.0", Some(44839), None),
(active, aarch64_target_feature, "1.27.0", Some(44839), None),
(active, hexagon_target_feature, "1.27.0", Some(44839), None),
(active, powerpc_target_feature, "1.27.0", Some(44839), None),
(active, mips_target_feature, "1.27.0", Some(44839), None),
(active, avx512_target_feature, "1.27.0", Some(44839), None),
(active, mmx_target_feature, "1.27.0", Some(44839), None),
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
(active, tbm_target_feature, "1.27.0", Some(44839), None),

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

// Allows macro invocations on modules expressions and statements and
// procedural macros to expand to non-items.
(active, proc_macro_mod, "1.27.0", None, None),
(active, proc_macro_expr, "1.27.0", None, None),
(active, proc_macro_non_items, "1.27.0", None, None),
(active, proc_macro_gen, "1.27.0", None, None),
(active, proc_macro_mod, "1.27.0", Some(38356), None),
(active, proc_macro_expr, "1.27.0", Some(38356), None),
(active, proc_macro_non_items, "1.27.0", Some(38356), None),
(active, proc_macro_gen, "1.27.0", Some(38356), None),

// #[doc(alias = "...")]
(active, doc_alias, "1.27.0", Some(50146), None),
Expand Down
14 changes: 7 additions & 7 deletions src/test/ui/feature-gate-abi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is expe
|
= help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable

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

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

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

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

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

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

error[E0658]: PTX ABIs are experimental and subject to change
error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788)
--> $DIR/feature-gate-abi.rs:91:1
|
LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-generators.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: yield syntax is experimental
error[E0658]: yield syntax is experimental (see issue #43122)
--> $DIR/feature-gate-generators.rs:12:5
|
LL | yield true; //~ ERROR yield syntax is experimental
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-global_allocator.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: the `#[global_allocator]` attribute is an experimental feature
error[E0658]: the `#[global_allocator]` attribute is an experimental feature (see issue #27389)
--> $DIR/feature-gate-global_allocator.rs:11:1
|
LL | #[global_allocator] //~ ERROR: attribute is an experimental feature
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-pattern_parentheses.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: parentheses in patterns are unstable
error[E0658]: parentheses in patterns are unstable (see issue #51087)
--> $DIR/feature-gate-pattern_parentheses.rs:13:9
|
LL | (pat) => {} //~ ERROR parentheses in patterns are unstable
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-wasm_custom_section.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: attribute is currently unstable
error[E0658]: attribute is currently unstable (see issue #51088)
--> $DIR/feature-gate-wasm_custom_section.rs:11:1
|
LL | #[wasm_custom_section = "foo"] //~ ERROR: attribute is currently unstable
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate-wasm_import_module.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: experimental attribute
error[E0658]: experimental attribute (see issue #51088)
--> $DIR/feature-gate-wasm_import_module.rs:11:1
|
LL | #[wasm_import_module = "test"] //~ ERROR: experimental
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/target-feature-gate.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: the target feature `avx512bw` is currently unstable
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
--> $DIR/target-feature-gate.rs:26:18
|
LL | #[target_feature(enable = "avx512bw")]
Expand Down
33 changes: 28 additions & 5 deletions src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Feature {
pub type Features = HashMap<String, Feature>;

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

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

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

contents.lines()
.filter_map(|line| {
let mut parts = line.trim().split(",");
// we allow rustc-internal features to omit a tracking issue.
// these features must be marked with `// rustc internal` in its own group.
let mut next_feature_is_rustc_internal = false;

contents.lines().zip(1..)
.filter_map(|(line, line_number)| {
let line = line.trim();
if line.starts_with("// rustc internal") {
next_feature_is_rustc_internal = true;
return None;
} else if line.is_empty() {
next_feature_is_rustc_internal = false;
return None;
}

let mut parts = line.split(',');
let level = match parts.next().map(|l| l.trim().trim_left_matches('(')) {
Some("active") => Status::Unstable,
Some("removed") => Status::Removed,
Expand All @@ -232,8 +245,18 @@ pub fn collect_lang_features(base_src_path: &Path) -> Features {
let since = parts.next().unwrap().trim().trim_matches('"');
let issue_str = parts.next().unwrap().trim();
let tracking_issue = if issue_str.starts_with("None") {
if level == Status::Unstable && !next_feature_is_rustc_internal {
*bad = true;
tidy_error!(
bad,
"libsyntax/feature_gate.rs:{}: no tracking issue for feature {}",
line_number,
name,
);
}
None
} else {
next_feature_is_rustc_internal = false;
let s = issue_str.split("(").nth(1).unwrap().split(")").nth(0).unwrap();
Some(s.parse().unwrap())
};
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/unstable_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn check(path: &path::Path, bad: &mut bool) {

// Library features

let lang_features = collect_lang_features(path);
let lang_features = collect_lang_features(path, bad);
let lib_features = collect_lib_features(path).into_iter().filter(|&(ref name, _)| {
!lang_features.contains_key(name)
}).collect();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/unstable-book-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn main() {
let src_path = Path::new(&src_path_str);
let dest_path = Path::new(&dest_path_str).join("src");

let lang_features = collect_lang_features(src_path);
let lang_features = collect_lang_features(src_path, &mut false);
let lib_features = collect_lib_features(src_path).into_iter().filter(|&(ref name, _)| {
!lang_features.contains_key(name)
}).collect();
Expand Down