diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-08-07 10:57:08 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-08-09 01:33:49 -0700 |
| commit | 6fa140b86994d216b2bd425f69048a3a6c3067fc (patch) | |
| tree | 868156d6bbc5817d463c5caec00795c4ed718627 | |
| parent | 78d1442808fa318c782e7f8249dab27126254930 (diff) | |
| download | rust-6fa140b86994d216b2bd425f69048a3a6c3067fc.tar.gz rust-6fa140b86994d216b2bd425f69048a3a6c3067fc.zip | |
extended information for E0554 feature attributes only work on nightlies
It's more pleasing to use the inner-attribute syntax (`#!` rather than `#`) in the error message, as that is how `feature` attributes in particular will be declared (as they apply to the entire crate).
| -rw-r--r-- | src/libsyntax/diagnostic_list.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 6598ecb9444..33dbc02d869 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -162,6 +162,21 @@ For more information about the cfg attribute, read: https://doc.rust-lang.org/reference.html#conditional-compilation "##, +E0554: r##" +Feature attributes are only allowed on the nightly release channel. Stable or +beta compilers will not comply. + +Example of erroneous code (on a stable compiler): + +```ignore (depends on release channel) +#![feature(non_ascii_idents)] // error: #![feature] may not be used on the + // stable release channel +``` + +If you need the feature, make sure to use a nightly release of the compiler +(but be warned that the feature may be removed or altered in the future). +"##, + E0558: r##" The `export_name` attribute was malformed. @@ -301,7 +316,6 @@ register_diagnostics! { E0550, // multiple deprecated attributes E0551, // incorrect meta item E0552, // unrecognized representation hint - E0554, // #[feature] may not be used on the [] release channel E0555, // malformed feature attribute, expected #![feature(...)] E0556, // malformed feature, expected just one word E0557, // feature has been removed diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index e8de8cf41c9..aeb574bc3af 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1602,7 +1602,7 @@ fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate, if attr.check_name("feature") { let release_channel = option_env!("CFG_RELEASE_CHANNEL").unwrap_or("(unknown)"); span_err!(span_handler, attr.span, E0554, - "#[feature] may not be used on the {} release channel", + "#![feature] may not be used on the {} release channel", release_channel); } } |
