From 41c65992c52113699451a6236148d408894f89ef Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 2 Jan 2019 02:21:05 +0300 Subject: [PATCH 1/2] Implement basic input validation for built-in attributes --- src/librustc/diagnostics.rs | 37 +- src/librustc/hir/check_attr.rs | 15 - src/librustc/lint/builtin.rs | 13 +- src/librustc/lint/levels.rs | 2 - src/librustc/lint/mod.rs | 3 +- src/librustc/middle/recursion_limit.rs | 13 +- src/librustc/traits/on_unimplemented.rs | 5 +- src/librustc_driver/driver.rs | 26 +- src/librustc_lint/builtin.rs | 81 +- src/librustc_lint/lib.rs | 11 +- src/librustc_lint/unused.rs | 4 +- src/librustc_plugin/load.rs | 5 +- src/librustc_typeck/collect.rs | 15 +- src/librustc_typeck/diagnostics.rs | 24 +- src/libsyntax/attr/builtin.rs | 3 - src/libsyntax/attr/mod.rs | 43 +- src/libsyntax/config.rs | 9 +- src/libsyntax/diagnostic_list.rs | 4 +- src/libsyntax/early_buffered_lints.rs | 1 + src/libsyntax/ext/derive.rs | 5 + src/libsyntax/feature_gate.rs | 378 +++++--- src/libsyntax/lib.rs | 1 + src/libsyntax/test.rs | 9 +- src/libsyntax_ext/proc_macro_decls.rs | 27 +- src/libsyntax_ext/test.rs | 16 +- src/libterm/terminfo/searcher.rs | 2 +- .../cfg-attr-syntax-validation.rs | 3 +- .../cfg-attr-syntax-validation.stderr | 8 +- .../derives/deriving-meta-empty-trait-list.rs | 7 +- .../deriving-meta-empty-trait-list.stderr | 8 +- src/test/ui/error-codes/E0232.rs | 8 - src/test/ui/error-codes/E0232.stderr | 11 - src/test/ui/error-codes/E0296.rs | 3 - src/test/ui/error-codes/E0296.stderr | 9 - src/test/ui/error-codes/E0558.rs | 6 - src/test/ui/error-codes/E0558.stderr | 9 - .../issue-43106-gating-of-builtin-attrs.rs | 331 +++---- ...issue-43106-gating-of-builtin-attrs.stderr | 879 ++++++++---------- .../issue-43106-gating-of-deprecated.rs | 12 +- .../issue-43106-gating-of-inline.rs | 14 +- .../issue-43106-gating-of-inline.stderr | 38 +- .../issue-43106-gating-of-macro_use.rs | 16 +- .../issue-43106-gating-of-macro_use.stderr | 24 +- ...issue-43106-gating-of-proc_macro_derive.rs | 14 +- ...e-43106-gating-of-proc_macro_derive.stderr | 24 +- .../issue-43106-gating-of-rustc_deprecated.rs | 14 +- ...ue-43106-gating-of-rustc_deprecated.stderr | 28 +- .../issue-43106-gating-of-stable.rs | 14 +- .../issue-43106-gating-of-stable.stderr | 28 +- .../issue-43106-gating-of-unstable.rs | 14 +- .../issue-43106-gating-of-unstable.stderr | 28 +- .../feature-gate-unwind-attributes.rs | 2 +- .../feature-gate-unwind-attributes.stderr | 4 +- src/test/ui/gated-bad-feature.rs | 4 +- src/test/ui/gated-bad-feature.stderr | 24 +- src/test/ui/invalid_crate_type_syntax.rs | 2 +- src/test/ui/invalid_crate_type_syntax.stderr | 6 +- src/test/ui/issues/issue-43988.rs | 5 +- src/test/ui/issues/issue-43988.stderr | 23 +- src/test/ui/lint/lint-malformed.rs | 2 +- src/test/ui/lint/lint-malformed.stderr | 12 +- src/test/ui/macros/meta-item-absolute-path.rs | 4 + .../ui/macros/meta-item-absolute-path.stderr | 9 + .../ui/malformed/malformed-derive-entry.rs | 2 +- .../malformed/malformed-derive-entry.stderr | 4 +- src/test/ui/malformed/malformed-plugin-1.rs | 2 +- .../ui/malformed/malformed-plugin-1.stderr | 5 +- src/test/ui/malformed/malformed-plugin-2.rs | 2 +- .../ui/malformed/malformed-plugin-2.stderr | 5 +- .../ui/malformed/malformed-regressions.rs | 8 + .../ui/malformed/malformed-regressions.stderr | 48 + .../ui/malformed/malformed-special-attrs.rs | 13 + .../malformed/malformed-special-attrs.stderr | 25 + .../marker-attribute-with-values.rs | 6 +- .../marker-attribute-with-values.stderr | 10 +- .../ui/nll/user-annotations/normalization.rs | 1 - .../nll/user-annotations/normalization.stderr | 2 +- src/test/ui/no_crate_type.rs | 2 +- src/test/ui/no_crate_type.stderr | 6 +- .../ui/on-unimplemented/bad-annotation.rs | 3 +- .../ui/on-unimplemented/bad-annotation.stderr | 26 +- .../expected-comma-found-token.rs | 2 +- .../expected-comma-found-token.stderr | 14 +- src/test/ui/parser/attr.rs | 3 +- src/test/ui/parser/attr.stderr | 11 +- src/test/ui/proc-macro/attribute.rs | 4 +- src/test/ui/proc-macro/attribute.stderr | 24 +- src/test/ui/proc-macro/invalid-attributes.rs | 12 +- .../ui/proc-macro/invalid-attributes.stderr | 24 +- src/test/ui/repr.rs | 8 +- src/test/ui/repr.stderr | 27 +- .../invalid-attribute.rs | 2 +- .../invalid-attribute.stderr | 8 +- ...ity-attribute-non-staged-force-unstable.rs | 6 +- ...attribute-non-staged-force-unstable.stderr | 12 +- .../stability-attribute-non-staged.rs | 6 +- .../stability-attribute-non-staged.stderr | 12 +- .../stability-attribute-sanity-4.rs | 29 + .../stability-attribute-sanity-4.stderr | 38 + .../stability-attribute-sanity.rs | 22 - .../stability-attribute-sanity.stderr | 64 +- src/test/ui/suffixed-literal-meta.rs | 26 +- src/test/ui/suffixed-literal-meta.stderr | 72 +- src/test/ui/target-feature-wrong.stderr | 2 +- src/test/ui/test-should-panic-attr.rs | 3 +- src/test/ui/test-should-panic-attr.stderr | 16 +- 106 files changed, 1391 insertions(+), 1625 deletions(-) delete mode 100644 src/test/ui/error-codes/E0232.rs delete mode 100644 src/test/ui/error-codes/E0232.stderr delete mode 100644 src/test/ui/error-codes/E0296.rs delete mode 100644 src/test/ui/error-codes/E0296.stderr delete mode 100644 src/test/ui/error-codes/E0558.rs delete mode 100644 src/test/ui/error-codes/E0558.stderr create mode 100644 src/test/ui/macros/meta-item-absolute-path.rs create mode 100644 src/test/ui/macros/meta-item-absolute-path.stderr create mode 100644 src/test/ui/malformed/malformed-regressions.rs create mode 100644 src/test/ui/malformed/malformed-regressions.stderr create mode 100644 src/test/ui/malformed/malformed-special-attrs.rs create mode 100644 src/test/ui/malformed/malformed-special-attrs.stderr create mode 100644 src/test/ui/stability-attribute/stability-attribute-sanity-4.rs create mode 100644 src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 4bc52e82f9be1..287a45a21eadf 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1180,27 +1180,6 @@ fn main() { ``` "##, -E0296: r##" -This error indicates that the given recursion limit could not be parsed. Ensure -that the value provided is a positive integer between quotes. - -Erroneous code example: - -```compile_fail,E0296 -#![recursion_limit] - -fn main() {} -``` - -And a working example: - -``` -#![recursion_limit="1000"] - -fn main() {} -``` -"##, - E0308: r##" This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a @@ -2093,20 +2072,6 @@ trait Foo { } ``` "##, -E0702: r##" -This error indicates that a `#[non_exhaustive]` attribute had a value. The -`#[non_exhaustive]` should be empty. - -Examples of erroneous code: - -```compile_fail,E0702 -# #![feature(non_exhaustive)] - -#[non_exhaustive(anything)] -struct Foo; -``` -"##, - E0718: r##" This error indicates that a `#[lang = ".."]` attribute was placed on the wrong type of item. @@ -2138,6 +2103,7 @@ register_diagnostics! { E0280, // requirement is not satisfied E0284, // cannot resolve type // E0285, // overflow evaluation builtin bounds +// E0296, // replaced with a generic attribute input check // E0300, // unexpanded macro // E0304, // expected signed integer constant // E0305, // expected constant @@ -2180,4 +2146,5 @@ register_diagnostics! { E0709, // multiple different lifetimes used in arguments of `async fn` E0710, // an unknown tool name found in scoped lint E0711, // a feature has been declared with conflicting stability attributes +// E0702, // replaced with a generic attribute input check } diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 2e0e9672758fd..6792427fb1e2e 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -137,15 +137,6 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { return; } } - - if attr.meta_item_list().is_some() || attr.value_str().is_some() { - struct_span_err!(self.tcx.sess, - attr.span, - E0702, - "attribute should be empty") - .span_label(item.span, "not empty") - .emit(); - } } /// Check if the `#[marker]` attribute on an `item` is valid. @@ -160,12 +151,6 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { return; } } - - if !attr.is_word() { - self.tcx.sess - .struct_span_err(attr.span, "attribute should be empty") - .emit(); - } } /// Check if the `#[repr]` attributes on `item` are valid. diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index c428ff1bd1b37..c8d137a42b2e8 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -204,12 +204,6 @@ declare_lint! { "trait-object types were treated as different depending on marker-trait order" } -declare_lint! { - pub BAD_REPR, - Warn, - "detects incorrect use of `repr` attribute" -} - declare_lint! { pub DEPRECATED, Warn, @@ -359,6 +353,12 @@ pub mod parser { Allow, "detects the use of `?` as a macro separator" } + + declare_lint! { + pub ILL_FORMED_ATTRIBUTE_INPUT, + Warn, + "ill-formed attribute inputs that were previously accepted and used in practice" + } } declare_lint! { @@ -431,6 +431,7 @@ impl LintPass for HardwiredLints { MACRO_USE_EXTERN_CRATE, MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS, parser::QUESTION_MARK_MACRO_SEP, + parser::ILL_FORMED_ATTRIBUTE_INPUT, DEPRECATED_IN_FUTURE, ) } diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index fe113494316b4..8b45a5a1504b5 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -204,8 +204,6 @@ impl<'a> LintLevelsBuilder<'a> { let mut metas = if let Some(metas) = meta.meta_item_list() { metas } else { - let mut err = bad_attr(meta.span); - err.emit(); continue; }; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index a373faab3a204..730ce919bd295 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -28,7 +28,7 @@ use hir::def_id::{CrateNum, LOCAL_CRATE}; use hir::intravisit; use hir; use lint::builtin::BuiltinLintDiagnostics; -use lint::builtin::parser::QUESTION_MARK_MACRO_SEP; +use lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT}; use session::{Session, DiagnosticMessageId}; use std::{hash, ptr}; use syntax::ast; @@ -82,6 +82,7 @@ impl Lint { pub fn from_parser_lint_id(lint_id: BufferedEarlyLintId) -> &'static Self { match lint_id { BufferedEarlyLintId::QuestionMarkMacroSep => QUESTION_MARK_MACRO_SEP, + BufferedEarlyLintId::IllFormedAttributeInput => ILL_FORMED_ATTRIBUTE_INPUT, } } diff --git a/src/librustc/middle/recursion_limit.rs b/src/librustc/middle/recursion_limit.rs index ea83432a80184..1eabd7f59e689 100644 --- a/src/librustc/middle/recursion_limit.rs +++ b/src/librustc/middle/recursion_limit.rs @@ -11,14 +11,11 @@ use syntax::ast; use rustc_data_structures::sync::Once; pub fn update_limits(sess: &Session, krate: &ast::Crate) { - update_limit(sess, krate, &sess.recursion_limit, "recursion_limit", - "recursion limit", 64); - update_limit(sess, krate, &sess.type_length_limit, "type_length_limit", - "type length limit", 1048576); + update_limit(krate, &sess.recursion_limit, "recursion_limit", 64); + update_limit(krate, &sess.type_length_limit, "type_length_limit", 1048576); } -fn update_limit(sess: &Session, krate: &ast::Crate, limit: &Once, - name: &str, description: &str, default: usize) { +fn update_limit(krate: &ast::Crate, limit: &Once, name: &str, default: usize) { for attr in &krate.attrs { if !attr.check_name(name) { continue; @@ -30,10 +27,6 @@ fn update_limit(sess: &Session, krate: &ast::Crate, limit: &Once, return; } } - - span_err!(sess, attr.span, E0296, - "malformed {} attribute, expected #![{}=\"N\"]", - description, name); } limit.set(default); } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index 4b188d2517511..3ec901f50e4cc 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -157,10 +157,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { note: None, })) } else { - return Err(parse_error(tcx, attr.span, - "`#[rustc_on_unimplemented]` requires a value", - "value required here", - Some(r#"eg `#[rustc_on_unimplemented(message="foo")]`"#))); + return Err(ErrorReported); }; debug!("of_item({:?}/{:?}) = {:?}", trait_def_id, impl_def_id, result); result diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index bfff592a5dd49..db4483ae55b90 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1070,15 +1070,6 @@ where ) }); - // Add all buffered lints from the `ParseSess` to the `Session`. - sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { - info!("{} parse sess buffered_lints", buffered_lints.len()); - for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { - let lint = lint::Lint::from_parser_lint_id(lint_id); - sess.buffer_lint(lint, id, span, &msg); - } - }); - // Done with macro expansion! after_expand(&krate)?; @@ -1114,6 +1105,15 @@ where ); }); + // Add all buffered lints from the `ParseSess` to the `Session`. + sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { + info!("{} parse sess buffered_lints", buffered_lints.len()); + for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { + let lint = lint::Lint::from_parser_lint_id(lint_id); + sess.buffer_lint(lint, id, span, &msg); + } + }); + // Lower ast -> hir. // First, we need to collect the dep_graph. let dep_graph = match future_dep_graph { @@ -1526,13 +1526,7 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { - session - .struct_span_err(a.span, "`crate_type` requires a value") - .note("for example: `#![crate_type=\"lib\"]`") - .emit(); - None - } + None => None } } else { None diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 5678f30dabccd..fd0e3007830e3 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -35,7 +35,8 @@ use syntax::ast::Expr; use syntax::attr; use syntax::source_map::Spanned; use syntax::edition::Edition; -use syntax::feature_gate::{AttributeGate, AttributeType, Stability, deprecated_attributes}; +use syntax::feature_gate::{AttributeGate, AttributeTemplate, AttributeType}; +use syntax::feature_gate::{Stability, deprecated_attributes}; use syntax_pos::{BytePos, Span, SyntaxContext}; use syntax::symbol::keywords; use syntax::errors::{Applicability, DiagnosticBuilder}; @@ -682,86 +683,12 @@ impl EarlyLintPass for AnonymousParameters { } } -/// Checks for incorrect use of `repr` attributes. -#[derive(Clone)] -pub struct BadRepr; - -impl LintPass for BadRepr { - fn get_lints(&self) -> LintArray { - lint_array!() - } -} - -impl EarlyLintPass for BadRepr { - fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { - if attr.name() == "repr" { - let list = attr.meta_item_list(); - - let repr_str = |lit: &str| { format!("#[repr({})]", lit) }; - - // Emit warnings with `repr` either has a literal assignment (`#[repr = "C"]`) or - // no hints (``#[repr]`) - let has_hints = list.as_ref().map(|ref list| !list.is_empty()).unwrap_or(false); - if !has_hints { - let mut suggested = false; - let mut warn = if let Some(ref lit) = attr.value_str() { - // avoid warning about empty `repr` on `#[repr = "foo"]` - let mut warn = cx.struct_span_lint( - BAD_REPR, - attr.span, - "`repr` attribute isn't configurable with a literal", - ); - match lit.to_string().as_ref() { - | "C" | "packed" | "rust" | "transparent" - | "u8" | "u16" | "u32" | "u64" | "u128" | "usize" - | "i8" | "i16" | "i32" | "i64" | "i128" | "isize" => { - // if the literal could have been a valid `repr` arg, - // suggest the correct syntax - warn.span_suggestion_with_applicability( - attr.span, - "give `repr` a hint", - repr_str(&lit.as_str()), - Applicability::MachineApplicable - ); - suggested = true; - } - _ => { // the literal wasn't a valid `repr` arg - warn.span_label(attr.span, "needs a hint"); - } - }; - warn - } else { - let mut warn = cx.struct_span_lint( - BAD_REPR, - attr.span, - "`repr` attribute must have a hint", - ); - warn.span_label(attr.span, "needs a hint"); - warn - }; - if !suggested { - warn.help(&format!( - "valid hints include `{}`, `{}`, `{}` and `{}`", - repr_str("C"), - repr_str("packed"), - repr_str("rust"), - repr_str("transparent"), - )); - warn.note("for more information, visit \ - "); - } - warn.emit(); - } - } - } -} - /// Checks for use of attributes which have been deprecated. #[derive(Clone)] pub struct DeprecatedAttr { // This is not free to compute, so we want to keep it around, rather than // compute it for every attribute. - depr_attrs: Vec<&'static (&'static str, AttributeType, AttributeGate)>, + depr_attrs: Vec<&'static (&'static str, AttributeType, AttributeTemplate, AttributeGate)>, } impl DeprecatedAttr { @@ -780,7 +707,7 @@ impl LintPass for DeprecatedAttr { impl EarlyLintPass for DeprecatedAttr { fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { - for &&(n, _, ref g) in &self.depr_attrs { + for &&(n, _, _, ref g) in &self.depr_attrs { if attr.name() == n { if let &AttributeGate::Gated(Stability::Deprecated(link, suggestion), ref name, diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 4dfb664451b91..743287096202a 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -48,7 +48,8 @@ use rustc::lint::builtin::{ INTRA_DOC_LINK_RESOLUTION_FAILURE, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, - parser::QUESTION_MARK_MACRO_SEP + parser::QUESTION_MARK_MACRO_SEP, + parser::ILL_FORMED_ATTRIBUTE_INPUT, }; use rustc::session; use rustc::util; @@ -113,7 +114,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { UnusedImportBraces, AnonymousParameters, UnusedDocComment, - BadRepr, EllipsisInclusiveRangePatterns, NonCamelCaseTypes, ); @@ -336,6 +336,11 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { reference: "issue #52234 ", edition: None, }, + FutureIncompatibleInfo { + id: LintId::of(ILL_FORMED_ATTRIBUTE_INPUT), + reference: "issue #57321 ", + edition: None, + }, ]); // Register renamed and removed lints. @@ -385,4 +390,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { "no longer a warning, #[no_mangle] functions always exported"); store.register_removed("private_no_mangle_statics", "no longer a warning, #[no_mangle] statics always exported"); + store.register_removed("bad_repr", + "replaced with a generic attribute input check"); } diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 205f8941d1ee2..bc29020e79f2a 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -232,7 +232,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes { fn check_attribute(&mut self, cx: &LateContext, attr: &ast::Attribute) { debug!("checking attribute: {:?}", attr); // Note that check_name() marks the attribute as used if it matches. - for &(ref name, ty, _) in BUILTIN_ATTRIBUTES { + for &(name, ty, ..) in BUILTIN_ATTRIBUTES { match ty { AttributeType::Whitelisted if attr.check_name(name) => { debug!("{:?} is Whitelisted", name); @@ -256,7 +256,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes { cx.span_lint(UNUSED_ATTRIBUTES, attr.span, "unused attribute"); // Is it a builtin attribute that must be used at the crate level? let known_crate = BUILTIN_ATTRIBUTES.iter() - .find(|&&(builtin, ty, _)| name == builtin && ty == AttributeType::CrateLevel) + .find(|&&(builtin, ty, ..)| name == builtin && ty == AttributeType::CrateLevel) .is_some(); // Has a plugin registered this attribute as one that must be used at diff --git a/src/librustc_plugin/load.rs b/src/librustc_plugin/load.rs index 9e7839ef0c4d1..39f580420cf03 100644 --- a/src/librustc_plugin/load.rs +++ b/src/librustc_plugin/load.rs @@ -50,10 +50,7 @@ pub fn load_plugins(sess: &Session, let plugins = match attr.meta_item_list() { Some(xs) => xs, - None => { - call_malformed_plugin_attribute(sess, attr.span); - continue; - } + None => continue, }; for plugin in plugins { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index be5f398e31f05..ed29506a33376 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2136,12 +2136,7 @@ fn from_target_feature( ) { let list = match attr.meta_item_list() { Some(list) => list, - None => { - let msg = "#[target_feature] attribute must be of the form \ - #[target_feature(..)]"; - tcx.sess.span_err(attr.span, &msg); - return; - } + None => return, }; let rust_features = tcx.features(); for item in list { @@ -2339,14 +2334,6 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen ).emit(); } codegen_fn_attrs.export_name = Some(s); - } else { - struct_span_err!( - tcx.sess, - attr.span, - E0558, - "`export_name` attribute has invalid format" - ).span_label(attr.span, "did you mean #[export_name=\"*\"]?") - .emit(); } } else if attr.check_name("target_feature") { if tcx.fn_sig(id).unsafety() == Unsafety::Normal { diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 387dabe747ab8..0228b1dca09ae 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3785,29 +3785,6 @@ For more information about the inline attribute, https: read://doc.rust-lang.org/reference.html#inline-attributes "##, -E0558: r##" -The `export_name` attribute was malformed. - -Erroneous code example: - -```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail) -#[export_name] // error: `export_name` attribute has invalid format -pub fn something() {} - -fn main() {} -``` - -The `export_name` attribute expects a string in order to determine the name of -the exported symbol. Example: - -``` -#[export_name = "some_function"] // ok! -pub fn something() {} - -fn main() {} -``` -"##, - E0559: r##" An unknown field was specified into an enum's structure variant. @@ -4896,6 +4873,7 @@ register_diagnostics! { // E0372, // coherence not object safe E0377, // the trait `CoerceUnsized` may only be implemented for a coercion // between structures with the same definition +// E0558, // replaced with a generic attribute input check E0533, // `{}` does not name a unit variant, unit struct or a constant // E0563, // cannot determine a type for this `impl Trait`: {} // removed in 6383de15 E0564, // only named lifetimes are allowed in `impl Trait`, diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 98585dc1e6f50..15e480496f7a8 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -436,9 +436,6 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, } _ => unreachable!() } - } else { - span_err!(diagnostic, attr.span(), E0548, "incorrect stability attribute type"); - continue } } diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index a309775a1a40b..a3ebb9f90caff 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -481,28 +481,33 @@ impl MetaItem { { // FIXME: Share code with `parse_path`. let ident = match tokens.next() { - Some(TokenTree::Token(span, Token::Ident(ident, _))) => { - if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { - let mut segments = vec![PathSegment::from_ident(ident.with_span_pos(span))]; - tokens.next(); - loop { - if let Some(TokenTree::Token(span, - Token::Ident(ident, _))) = tokens.next() { - segments.push(PathSegment::from_ident(ident.with_span_pos(span))); - } else { - return None; - } - if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { - tokens.next(); - } else { - break; - } + Some(TokenTree::Token(span, token @ Token::Ident(..))) | + Some(TokenTree::Token(span, token @ Token::ModSep)) => 'arm: { + let mut segments = if let Token::Ident(ident, _) = token { + if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { + tokens.next(); + vec![PathSegment::from_ident(ident.with_span_pos(span))] + } else { + break 'arm Path::from_ident(ident.with_span_pos(span)); } - let span = span.with_hi(segments.last().unwrap().ident.span.hi()); - Path { span, segments } } else { - Path::from_ident(ident.with_span_pos(span)) + vec![PathSegment::path_root(span)] + }; + loop { + if let Some(TokenTree::Token(span, + Token::Ident(ident, _))) = tokens.next() { + segments.push(PathSegment::from_ident(ident.with_span_pos(span))); + } else { + return None; + } + if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { + tokens.next(); + } else { + break; + } } + let span = span.with_hi(segments.last().unwrap().ident.span.hi()); + Path { span, segments } } Some(TokenTree::Token(_, Token::Interpolated(ref nt))) => match nt.0 { token::Nonterminal::NtIdent(ident, _) => Path::from_ident(ident), diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index a987f534a2725..50e0056f3b9f1 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -166,12 +166,9 @@ impl<'a> StripUnconfigured<'a> { true }; - let meta_item = if let Some(meta_item) = attr.meta() { - meta_item - } else { - // Not a well-formed meta-item. Why? We don't know. - return error(attr.span, "`cfg` is not a well-formed meta-item", - "#[cfg(/* predicate */)]"); + let meta_item = match attr.parse_meta(self.sess) { + Ok(meta_item) => meta_item, + Err(mut err) => { err.emit(); return true; } }; let nested_meta_items = if let Some(nested_meta_items) = meta_item.meta_item_list() { nested_meta_items diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 548bf8b7f8a80..2c367f1f40242 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -389,12 +389,12 @@ register_diagnostics! { E0545, // incorrect 'issue' E0546, // missing 'feature' E0547, // missing 'issue' - E0548, // incorrect stability attribute type +// E0548, // replaced with a generic attribute input check E0549, // rustc_deprecated attribute must be paired with either stable or unstable attribute E0550, // multiple deprecated attributes E0551, // incorrect meta item E0553, // multiple rustc_const_unstable attributes - E0555, // malformed feature attribute, expected #![feature(...)] +// E0555, // replaced with a generic attribute input check E0556, // malformed feature, expected just one word E0584, // file for module `..` found at both .. and .. E0629, // missing 'feature' (rustc_const_unstable) diff --git a/src/libsyntax/early_buffered_lints.rs b/src/libsyntax/early_buffered_lints.rs index 204e07625adef..cf9671a14b38d 100644 --- a/src/libsyntax/early_buffered_lints.rs +++ b/src/libsyntax/early_buffered_lints.rs @@ -11,6 +11,7 @@ use syntax_pos::MultiSpan; pub enum BufferedEarlyLintId { /// Usage of `?` as a macro separator is deprecated. QuestionMarkMacroSep, + IllFormedAttributeInput, } /// Stores buffered lint info which can later be passed to `librustc`. diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index d5a51bc170338..7ef09ce5fbd40 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -15,6 +15,11 @@ pub fn collect_derives(cx: &mut ExtCtxt, attrs: &mut Vec) -> Vec if attr.path != "derive" { return true; } + if !attr.is_meta_item_list() { + cx.span_err(attr.span, + "attribute must be of the form `#[derive(Trait1, Trait2, ...)]`"); + return false; + } match attr.parse_list(cx.parse_sess, |parser| parser.parse_path_allowing_meta(PathStyle::Mod)) { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 89da1a219b70a..a483e35a5b516 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -19,6 +19,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::abi::Abi; use ast::{self, NodeId, PatKind, RangeEnd}; use attr; +use early_buffered_lints::BufferedEarlyLintId; use source_map::Spanned; use edition::{ALL_EDITIONS, Edition}; use syntax_pos::{Span, DUMMY_SP}; @@ -716,6 +717,41 @@ pub enum AttributeGate { Ungated, } +#[derive(Clone, Copy)] +pub struct AttributeTemplate { + word: bool, + list: Option<&'static str>, + name_value_str: Option<&'static str>, +} + +impl AttributeTemplate { + fn compatible(&self, meta_item_kind: &ast::MetaItemKind) -> bool { + match meta_item_kind { + ast::MetaItemKind::Word => self.word, + ast::MetaItemKind::List(..) => self.list.is_some(), + ast::MetaItemKind::NameValue(lit) if lit.node.is_str() => self.name_value_str.is_some(), + ast::MetaItemKind::NameValue(..) => false, + } + } +} + +macro_rules! template { + (@ $word: expr, $list: expr, $name_value_str: expr) => { AttributeTemplate { + word: $word, list: $list, name_value_str: $name_value_str + } }; + (Word) => { template!(@ true, None, None) }; + (List: $descr: expr) => { template!(@ false, Some($descr), None) }; + (NameValueStr: $descr: expr) => { template!(@ false, None, Some($descr)) }; + (Word, List: $descr: expr) => { template!(@ true, Some($descr), None) }; + (Word, NameValueStr: $descr: expr) => { template!(@ true, None, Some($descr)) }; + (List: $descr1: expr, NameValueStr: $descr2: expr) => { + template!(@ false, Some($descr1), Some($descr2)) + }; + (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => { + template!(@ true, Some($descr1), Some($descr2)) + }; +} + impl AttributeGate { fn is_deprecated(&self) -> bool { match *self { @@ -753,225 +789,241 @@ macro_rules! cfg_fn { }} } -pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, AttributeGate)> { - BUILTIN_ATTRIBUTES.iter().filter(|a| a.2.is_deprecated()).collect() +pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, + AttributeTemplate, AttributeGate)> { + BUILTIN_ATTRIBUTES.iter().filter(|(.., gate)| gate.is_deprecated()).collect() } pub fn is_builtin_attr_name(name: ast::Name) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| name == builtin_name) + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, ..)| name == builtin_name) } pub fn is_builtin_attr(attr: &ast::Attribute) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name) + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, ..)| attr.path == builtin_name) } // Attributes that have a special meaning to rustc or rustdoc -pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ +pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeTemplate, AttributeGate)] = &[ // Normal attributes - ("warn", Normal, Ungated), - ("allow", Normal, Ungated), - ("forbid", Normal, Ungated), - ("deny", Normal, Ungated), - - ("macro_use", Normal, Ungated), - ("macro_export", Normal, Ungated), - ("plugin_registrar", Normal, Ungated), - - ("cfg", Normal, Ungated), - ("cfg_attr", Normal, Ungated), - ("main", Normal, Ungated), - ("start", Normal, Ungated), - ("repr", Normal, Ungated), - ("path", Normal, Ungated), - ("abi", Normal, Ungated), - ("automatically_derived", Normal, Ungated), - ("no_mangle", Normal, Ungated), - ("no_link", Normal, Ungated), - ("derive", Normal, Ungated), - ("should_panic", Normal, Ungated), - ("ignore", Normal, Ungated), - ("no_implicit_prelude", Normal, Ungated), - ("reexport_test_harness_main", Normal, Ungated), - ("link_args", Normal, Gated(Stability::Unstable, + ("warn", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("allow", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("forbid", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("deny", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + + ("macro_use", Normal, template!(Word, List: "name1, name2, ..."), Ungated), + ("macro_export", Normal, template!(Word, List: "local_inner_macros"), Ungated), + ("plugin_registrar", Normal, template!(Word), Ungated), + + ("cfg", Normal, template!(List: "predicate"), Ungated), + ("cfg_attr", Normal, template!(List: "predicate, attr1, attr2, ..."), Ungated), + ("main", Normal, template!(Word), Ungated), + ("start", Normal, template!(Word), Ungated), + ("repr", Normal, template!(List: "C, packed, ..."), Ungated), + ("path", Normal, template!(NameValueStr: "file"), Ungated), + ("automatically_derived", Normal, template!(Word), Ungated), + ("no_mangle", Normal, template!(Word), Ungated), + ("no_link", Normal, template!(Word), Ungated), + ("derive", Normal, template!(List: "Trait1, Trait2, ..."), Ungated), + ("should_panic", Normal, template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), + Ungated), + ("ignore", Normal, template!(Word, NameValueStr: "reason"), Ungated), + ("no_implicit_prelude", Normal, template!(Word), Ungated), + ("reexport_test_harness_main", Normal, template!(NameValueStr: "name"), Ungated), + ("link_args", Normal, template!(NameValueStr: "args"), Gated(Stability::Unstable, "link_args", "the `link_args` attribute is experimental and not \ portable across platforms, it is recommended to \ use `#[link(name = \"foo\")] instead", cfg_fn!(link_args))), - ("macro_escape", Normal, Ungated), + ("macro_escape", Normal, template!(Word), Ungated), // RFC #1445. - ("structural_match", Whitelisted, Gated(Stability::Unstable, + ("structural_match", Whitelisted, template!(Word), Gated(Stability::Unstable, "structural_match", "the semantics of constant patterns is \ not yet settled", cfg_fn!(structural_match))), // RFC #2008 - ("non_exhaustive", Whitelisted, Gated(Stability::Unstable, + ("non_exhaustive", Whitelisted, template!(Word), Gated(Stability::Unstable, "non_exhaustive", "non exhaustive is an experimental feature", cfg_fn!(non_exhaustive))), // RFC #1268 - ("marker", Normal, Gated(Stability::Unstable, + ("marker", Normal, template!(Word), Gated(Stability::Unstable, "marker_trait_attr", "marker traits is an experimental feature", cfg_fn!(marker_trait_attr))), - ("plugin", CrateLevel, Gated(Stability::Unstable, + ("plugin", CrateLevel, template!(List: "name|name(args)"), Gated(Stability::Unstable, "plugin", "compiler plugins are experimental \ and possibly buggy", cfg_fn!(plugin))), - ("no_std", CrateLevel, Ungated), - ("no_core", CrateLevel, Gated(Stability::Unstable, + ("no_std", CrateLevel, template!(Word), Ungated), + ("no_core", CrateLevel, template!(Word), Gated(Stability::Unstable, "no_core", "no_core is experimental", cfg_fn!(no_core))), - ("lang", Normal, Gated(Stability::Unstable, + ("lang", Normal, template!(NameValueStr: "name"), Gated(Stability::Unstable, "lang_items", "language items are subject to change", cfg_fn!(lang_items))), - ("linkage", Whitelisted, Gated(Stability::Unstable, + ("linkage", Whitelisted, template!(NameValueStr: "external|internal|..."), + Gated(Stability::Unstable, "linkage", "the `linkage` attribute is experimental \ and not portable across platforms", cfg_fn!(linkage))), - ("thread_local", Whitelisted, Gated(Stability::Unstable, + ("thread_local", Whitelisted, template!(Word), Gated(Stability::Unstable, "thread_local", "`#[thread_local]` is an experimental feature, and does \ not currently handle destructors.", cfg_fn!(thread_local))), - ("rustc_on_unimplemented", Normal, Gated(Stability::Unstable, + ("rustc_on_unimplemented", Normal, template!(List: + r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#, + NameValueStr: "message"), + Gated(Stability::Unstable, "on_unimplemented", "the `#[rustc_on_unimplemented]` attribute \ is an experimental feature", cfg_fn!(on_unimplemented))), - ("rustc_const_unstable", Normal, Gated(Stability::Unstable, + ("rustc_const_unstable", Normal, template!(List: r#"feature = "name""#), + Gated(Stability::Unstable, "rustc_const_unstable", "the `#[rustc_const_unstable]` attribute \ is an internal feature", cfg_fn!(rustc_const_unstable))), - ("global_allocator", Normal, Ungated), - ("default_lib_allocator", Whitelisted, Gated(Stability::Unstable, + ("global_allocator", Normal, template!(Word), Ungated), + ("default_lib_allocator", Whitelisted, template!(Word), Gated(Stability::Unstable, "allocator_internals", "the `#[default_lib_allocator]` \ attribute is an experimental feature", cfg_fn!(allocator_internals))), - ("needs_allocator", Normal, Gated(Stability::Unstable, + ("needs_allocator", Normal, template!(Word), Gated(Stability::Unstable, "allocator_internals", "the `#[needs_allocator]` \ attribute is an experimental \ feature", cfg_fn!(allocator_internals))), - ("panic_runtime", Whitelisted, Gated(Stability::Unstable, + ("panic_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "panic_runtime", "the `#[panic_runtime]` attribute is \ an experimental feature", cfg_fn!(panic_runtime))), - ("needs_panic_runtime", Whitelisted, Gated(Stability::Unstable, + ("needs_panic_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "needs_panic_runtime", "the `#[needs_panic_runtime]` \ attribute is an experimental \ feature", cfg_fn!(needs_panic_runtime))), - ("rustc_outlives", Normal, Gated(Stability::Unstable, + ("rustc_outlives", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_outlives]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_variance", Normal, Gated(Stability::Unstable, + ("rustc_variance", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_variance]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_regions", Normal, Gated(Stability::Unstable, + ("rustc_regions", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_regions]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_error", Whitelisted, Gated(Stability::Unstable, + ("rustc_error", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_error]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dump_user_substs", Whitelisted, Gated(Stability::Unstable, + ("rustc_dump_user_substs", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_if_this_changed", Whitelisted, Gated(Stability::Unstable, + ("rustc_if_this_changed", Whitelisted, template!(Word, List: "DepNode"), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_if_this_changed]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_then_this_would_need", Whitelisted, Gated(Stability::Unstable, + ("rustc_then_this_would_need", Whitelisted, template!(List: "DepNode"), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_if_this_changed]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dirty", Whitelisted, Gated(Stability::Unstable, + ("rustc_dirty", Whitelisted, template!(List: r#"cfg = "...", /*opt*/ label = "...", + /*opt*/ except = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_dirty]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_clean", Whitelisted, Gated(Stability::Unstable, + ("rustc_clean", Whitelisted, template!(List: r#"cfg = "...", /*opt*/ label = "...", + /*opt*/ except = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_clean]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_partition_reused", Whitelisted, Gated(Stability::Unstable, + ("rustc_partition_reused", Whitelisted, template!(List: r#"cfg = "...", module = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_partition_codegened", Whitelisted, Gated(Stability::Unstable, + ("rustc_partition_codegened", Whitelisted, template!(List: r#"cfg = "...", module = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_expected_cgu_reuse", Whitelisted, Gated(Stability::Unstable, + ("rustc_expected_cgu_reuse", Whitelisted, template!(List: r#"cfg = "...", module = "...", + kind = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_synthetic", Whitelisted, Gated(Stability::Unstable, + ("rustc_synthetic", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_symbol_name", Whitelisted, Gated(Stability::Unstable, + ("rustc_symbol_name", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal rustc attributes will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_item_path", Whitelisted, Gated(Stability::Unstable, + ("rustc_item_path", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal rustc attributes will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_mir", Whitelisted, Gated(Stability::Unstable, + ("rustc_mir", Whitelisted, template!(List: "arg1, arg2, ..."), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_mir]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_inherit_overflow_checks", Whitelisted, Gated(Stability::Unstable, + ("rustc_inherit_overflow_checks", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_inherit_overflow_checks]` \ attribute is just used to control \ @@ -980,41 +1032,35 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ across crates and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dump_program_clauses", Whitelisted, Gated(Stability::Unstable, + ("rustc_dump_program_clauses", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_dump_program_clauses]` \ attribute is just used for rustc unit \ tests and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_test_marker", Normal, Gated(Stability::Unstable, + ("rustc_test_marker", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_test_marker]` attribute \ is used internally to track tests", cfg_fn!(rustc_attrs))), - ("rustc_transparent_macro", Whitelisted, Gated(Stability::Unstable, + ("rustc_transparent_macro", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "used internally for testing macro hygiene", cfg_fn!(rustc_attrs))), - - // RFC #2094 - ("nll", Whitelisted, Gated(Stability::Unstable, - "nll", - "Non lexical lifetimes", - cfg_fn!(nll))), - ("compiler_builtins", Whitelisted, Gated(Stability::Unstable, + ("compiler_builtins", Whitelisted, template!(Word), Gated(Stability::Unstable, "compiler_builtins", "the `#[compiler_builtins]` attribute is used to \ identify the `compiler_builtins` crate which \ contains compiler-rt intrinsics and will never be \ stable", cfg_fn!(compiler_builtins))), - ("sanitizer_runtime", Whitelisted, Gated(Stability::Unstable, + ("sanitizer_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "sanitizer_runtime", "the `#[sanitizer_runtime]` attribute is used to \ identify crates that contain the runtime of a \ sanitizer and will never be stable", cfg_fn!(sanitizer_runtime))), - ("profiler_runtime", Whitelisted, Gated(Stability::Unstable, + ("profiler_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "profiler_runtime", "the `#[profiler_runtime]` attribute is used to \ identify the `profiler_builtins` crate which \ @@ -1022,55 +1068,57 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ stable", cfg_fn!(profiler_runtime))), - ("allow_internal_unstable", Normal, Gated(Stability::Unstable, + ("allow_internal_unstable", Normal, template!(Word), Gated(Stability::Unstable, "allow_internal_unstable", EXPLAIN_ALLOW_INTERNAL_UNSTABLE, cfg_fn!(allow_internal_unstable))), - ("allow_internal_unsafe", Normal, Gated(Stability::Unstable, + ("allow_internal_unsafe", Normal, template!(Word), Gated(Stability::Unstable, "allow_internal_unsafe", EXPLAIN_ALLOW_INTERNAL_UNSAFE, cfg_fn!(allow_internal_unsafe))), - ("fundamental", Whitelisted, Gated(Stability::Unstable, + ("fundamental", Whitelisted, template!(Word), Gated(Stability::Unstable, "fundamental", "the `#[fundamental]` attribute \ is an experimental feature", cfg_fn!(fundamental))), - ("proc_macro_derive", Normal, Ungated), + ("proc_macro_derive", Normal, template!(List: "TraitName, attributes(name1, name2, ...)"), + Ungated), - ("rustc_copy_clone_marker", Whitelisted, Gated(Stability::Unstable, + ("rustc_copy_clone_marker", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal implementation detail", cfg_fn!(rustc_attrs))), // FIXME: #14408 whitelist docs since rustdoc looks at them - ("doc", Whitelisted, Ungated), + ("doc", Whitelisted, template!(List: "hidden|inline|...", NameValueStr: "string"), Ungated), // FIXME: #14406 these are processed in codegen, which happens after the // lint pass - ("cold", Whitelisted, Ungated), - ("naked", Whitelisted, Gated(Stability::Unstable, + ("cold", Whitelisted, template!(Word), Ungated), + ("naked", Whitelisted, template!(Word), Gated(Stability::Unstable, "naked_functions", "the `#[naked]` attribute \ is an experimental feature", cfg_fn!(naked_functions))), - ("target_feature", Whitelisted, Ungated), - ("export_name", Whitelisted, Ungated), - ("inline", Whitelisted, Ungated), - ("link", Whitelisted, Ungated), - ("link_name", Whitelisted, Ungated), - ("link_section", Whitelisted, Ungated), - ("no_builtins", Whitelisted, Ungated), - ("no_mangle", Whitelisted, Ungated), - ("no_debug", Whitelisted, Gated( + ("target_feature", Whitelisted, template!(List: r#"enable = "name""#), Ungated), + ("export_name", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("inline", Whitelisted, template!(Word, List: "always|never"), Ungated), + ("link", Whitelisted, template!(List: r#"name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...""#), Ungated), + ("link_name", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("link_section", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("no_builtins", Whitelisted, template!(Word), Ungated), + ("no_mangle", Whitelisted, template!(Word), Ungated), + ("no_debug", Whitelisted, template!(Word), Gated( Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None), "no_debug", "the `#[no_debug]` attribute was an experimental feature that has been \ deprecated due to lack of demand", cfg_fn!(no_debug))), - ("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable, + ("omit_gdb_pretty_printer_section", Whitelisted, template!(Word), Gated(Stability::Unstable, "omit_gdb_pretty_printer_section", "the `#[omit_gdb_pretty_printer_section]` \ attribute is just used for the Rust test \ @@ -1078,6 +1126,7 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ cfg_fn!(omit_gdb_pretty_printer_section))), ("unsafe_destructor_blind_to_params", Normal, + template!(Word), Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761", Some("replace this attribute with `#[may_dangle]`")), "dropck_parametricity", @@ -1086,93 +1135,91 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[ cfg_fn!(dropck_parametricity))), ("may_dangle", Normal, + template!(Word), Gated(Stability::Unstable, "dropck_eyepatch", "may_dangle has unstable semantics and may be removed in the future", cfg_fn!(dropck_eyepatch))), - ("unwind", Whitelisted, Gated(Stability::Unstable, + ("unwind", Whitelisted, template!(List: "allowed"), Gated(Stability::Unstable, "unwind_attributes", "#[unwind] is experimental", cfg_fn!(unwind_attributes))), - ("used", Whitelisted, Ungated), + ("used", Whitelisted, template!(Word), Ungated), // used in resolve - ("prelude_import", Whitelisted, Gated(Stability::Unstable, + ("prelude_import", Whitelisted, template!(Word), Gated(Stability::Unstable, "prelude_import", "`#[prelude_import]` is for use by rustc only", cfg_fn!(prelude_import))), // FIXME: #14407 these are only looked at on-demand so we can't // guarantee they'll have already been checked - ("rustc_deprecated", Whitelisted, Ungated), - ("must_use", Whitelisted, Ungated), - ("stable", Whitelisted, Ungated), - ("unstable", Whitelisted, Ungated), - ("deprecated", Normal, Ungated), - - ("rustc_paren_sugar", Normal, Gated(Stability::Unstable, + ("rustc_deprecated", Whitelisted, template!(List: r#"since = "version", reason = "...""#), + Ungated), + ("must_use", Whitelisted, template!(Word, NameValueStr: "reason"), Ungated), + ("stable", Whitelisted, template!(List: r#"feature = "name", since = "version""#), Ungated), + ("unstable", Whitelisted, template!(List: r#"feature = "name", reason = "...", issue = "N""#), + Ungated), + ("deprecated", Normal, template!(Word, List: r#"/*opt*/ since = "version", + /*opt*/ note = "reason"#, + NameValueStr: "reason"), Ungated), + + ("rustc_paren_sugar", Normal, template!(Word), Gated(Stability::Unstable, "unboxed_closures", "unboxed_closures are still evolving", cfg_fn!(unboxed_closures))), - ("windows_subsystem", Whitelisted, Ungated), + ("windows_subsystem", Whitelisted, template!(NameValueStr: "windows|console"), Ungated), - ("proc_macro_attribute", Normal, Ungated), - ("proc_macro", Normal, Ungated), + ("proc_macro_attribute", Normal, template!(Word), Ungated), + ("proc_macro", Normal, template!(Word), Ungated), - ("rustc_proc_macro_decls", Normal, Gated(Stability::Unstable, + ("rustc_proc_macro_decls", Normal, template!(Word), Gated(Stability::Unstable, "rustc_proc_macro_decls", "used internally by rustc", cfg_fn!(rustc_attrs))), - ("allow_fail", Normal, Gated(Stability::Unstable, + ("allow_fail", Normal, template!(Word), Gated(Stability::Unstable, "allow_fail", "allow_fail attribute is currently unstable", cfg_fn!(allow_fail))), - ("rustc_std_internal_symbol", Whitelisted, Gated(Stability::Unstable, + ("rustc_std_internal_symbol", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this is an internal attribute that will \ never be stable", cfg_fn!(rustc_attrs))), // whitelists "identity-like" conversion methods to suggest on type mismatch - ("rustc_conversion_suggestion", Whitelisted, Gated(Stability::Unstable, + ("rustc_conversion_suggestion", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this is an internal attribute that will \ never be stable", cfg_fn!(rustc_attrs))), - ("rustc_args_required_const", Whitelisted, Gated(Stability::Unstable, + ("rustc_args_required_const", Whitelisted, template!(List: "N"), Gated(Stability::Unstable, "rustc_attrs", "never will be stable", cfg_fn!(rustc_attrs))), - - // RFC #2093 - ("infer_static_outlives_requirements", Normal, Gated(Stability::Unstable, - "infer_static_outlives_requirements", - "infer 'static lifetime requirements", - cfg_fn!(infer_static_outlives_requirements))), - // RFC 2070 - ("panic_handler", Normal, Ungated), + ("panic_handler", Normal, template!(Word), Ungated), - ("alloc_error_handler", Normal, Gated(Stability::Unstable, + ("alloc_error_handler", Normal, template!(Word), Gated(Stability::Unstable, "alloc_error_handler", "#[alloc_error_handler] is an unstable feature", cfg_fn!(alloc_error_handler))), // Crate level attributes - ("crate_name", CrateLevel, Ungated), - ("crate_type", CrateLevel, Ungated), - ("crate_id", CrateLevel, Ungated), - ("feature", CrateLevel, Ungated), - ("no_start", CrateLevel, Ungated), - ("no_main", CrateLevel, Ungated), - ("no_builtins", CrateLevel, Ungated), - ("recursion_limit", CrateLevel, Ungated), - ("type_length_limit", CrateLevel, Ungated), - ("test_runner", CrateLevel, Gated(Stability::Unstable, + ("crate_name", CrateLevel, template!(NameValueStr: "name"), Ungated), + ("crate_type", CrateLevel, template!(NameValueStr: "bin|lib|..."), Ungated), + ("crate_id", CrateLevel, template!(NameValueStr: "ignored"), Ungated), + ("feature", CrateLevel, template!(List: "name1, name1, ..."), Ungated), + ("no_start", CrateLevel, template!(Word), Ungated), + ("no_main", CrateLevel, template!(Word), Ungated), + ("no_builtins", CrateLevel, template!(Word), Ungated), + ("recursion_limit", CrateLevel, template!(NameValueStr: "N"), Ungated), + ("type_length_limit", CrateLevel, template!(NameValueStr: "N"), Ungated), + ("test_runner", CrateLevel, template!(List: "path"), Gated(Stability::Unstable, "custom_test_frameworks", EXPLAIN_CUSTOM_TEST_FRAMEWORKS, cfg_fn!(custom_test_frameworks))), @@ -1249,7 +1296,7 @@ impl<'a> Context<'a> { fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) { debug!("check_attribute(attr = {:?})", attr); let name = attr.name().as_str(); - for &(n, ty, ref gateage) in BUILTIN_ATTRIBUTES { + for &(n, ty, _template, ref gateage) in BUILTIN_ATTRIBUTES { if name == n { if let Gated(_, name, desc, ref has_feature) = *gateage { gate_feature_fn!(self, has_feature, attr.span, name, desc, GateStrength::Hard); @@ -1484,6 +1531,52 @@ impl<'a> PostExpansionVisitor<'a> { Abi::System => {} } } + + fn check_builtin_attribute(&mut self, attr: &ast::Attribute, name: &str, + template: AttributeTemplate) { + // Some special attributes like `cfg` must be checked + // before the generic check, so we skip them here. + let should_skip = |name| name == "cfg"; + // Some of previously accepted forms were used in practice, + // report them as warnings for now. + let should_warn = |name| name == "doc" || name == "ignore" || + name == "inline" || name == "link"; + + match attr.parse_meta(self.context.parse_sess) { + Ok(meta) => if !should_skip(name) && !template.compatible(&meta.node) { + let mut msg = "attribute must be of the form ".to_owned(); + let mut first = true; + if template.word { + first = false; + msg.push_str(&format!("`#[{}{}]`", name, "")); + } + if let Some(descr) = template.list { + if !first { + msg.push_str(" or "); + } + first = false; + msg.push_str(&format!("`#[{}({})]`", name, descr)); + } + if let Some(descr) = template.name_value_str { + if !first { + msg.push_str(" or "); + } + msg.push_str(&format!("`#[{} = \"{}\"]`", name, descr)); + } + if should_warn(name) { + self.context.parse_sess.buffer_lint( + BufferedEarlyLintId::IllFormedAttributeInput, + meta.span, + ast::CRATE_NODE_ID, + &msg, + ); + } else { + self.context.parse_sess.span_diagnostic.span_err(meta.span, &msg); + } + } + Err(mut err) => err.emit(), + } + } } impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { @@ -1519,12 +1612,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } - if !self.context.features.unrestricted_attribute_tokens { - // Unfortunately, `parse_meta` cannot be called speculatively - // because it can report errors by itself, so we have to call it - // only if the feature is disabled. - if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { - err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() + match BUILTIN_ATTRIBUTES.iter().find(|(name, ..)| attr.path == name) { + Some(&(name, _, template, _)) => self.check_builtin_attribute(attr, name, template), + None => if !self.context.features.unrestricted_attribute_tokens { + // Unfortunately, `parse_meta` cannot be called speculatively + // because it can report errors by itself, so we have to call it + // only if the feature is disabled. + if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { + err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() + } } } } @@ -1947,11 +2043,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], let list = match attr.meta_item_list() { Some(list) => list, - None => { - span_err!(span_handler, attr.span, E0555, - "malformed feature attribute, expected #![feature(...)]"); - continue - } + None => continue, }; for mi in list { diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index ea943e16a46e8..df22dacce1a75 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -10,6 +10,7 @@ test(attr(deny(warnings))))] #![feature(crate_visibility_modifier)] +#![feature(label_break_value)] #![feature(nll)] #![feature(rustc_attrs)] #![feature(rustc_diagnostic_macros)] diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 884c4fd109e6a..b352486e39a64 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -428,14 +428,11 @@ fn is_test_case(i: &ast::Item) -> bool { fn get_test_runner(sd: &errors::Handler, krate: &ast::Crate) -> Option { let test_attr = attr::find_by_name(&krate.attrs, "test_runner")?; - if let Some(meta_list) = test_attr.meta_item_list() { + test_attr.meta_item_list().map(|meta_list| { if meta_list.len() != 1 { sd.span_fatal(test_attr.span(), "#![test_runner(..)] accepts exactly 1 argument").raise() } - Some(meta_list[0].word().as_ref().unwrap().ident.clone()) - } else { - sd.span_fatal(test_attr.span(), - "test_runner must be of the form #[test_runner(..)]").raise() - } + meta_list[0].word().as_ref().unwrap().ident.clone() + }) } diff --git a/src/libsyntax_ext/proc_macro_decls.rs b/src/libsyntax_ext/proc_macro_decls.rs index 38f7ca500b25d..1d272712cacc8 100644 --- a/src/libsyntax_ext/proc_macro_decls.rs +++ b/src/libsyntax_ext/proc_macro_decls.rs @@ -105,12 +105,7 @@ impl<'a> CollectProcMacros<'a> { // `#[proc_macro_derive(Foo, attributes(A, ..))]` let list = match attr.meta_item_list() { Some(list) => list, - None => { - self.handler.span_err(attr.span(), - "attribute must be of form: \ - #[proc_macro_derive(TraitName)]"); - return - } + None => return, }; if list.len() != 1 && list.len() != 2 { self.handler.span_err(attr.span(), @@ -182,13 +177,7 @@ impl<'a> CollectProcMacros<'a> { } } - fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - if !attr.is_word() { - self.handler.span_err(attr.span, "`#[proc_macro_attribute]` attribute \ - does not take any arguments"); - return; - } - + fn collect_attr_proc_macro(&mut self, item: &'a ast::Item) { if self.in_root && item.vis.node.is_pub() { self.attr_macros.push(ProcMacroDef { span: item.span, @@ -205,13 +194,7 @@ impl<'a> CollectProcMacros<'a> { } } - fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - if !attr.is_word() { - self.handler.span_err(attr.span, "`#[proc_macro]` attribute \ - does not take any arguments"); - return; - } - + fn collect_bang_proc_macro(&mut self, item: &'a ast::Item) { if self.in_root && item.vis.node.is_pub() { self.bang_macros.push(ProcMacroDef { span: item.span, @@ -308,9 +291,9 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { if attr.check_name("proc_macro_derive") { self.collect_custom_derive(item, attr); } else if attr.check_name("proc_macro_attribute") { - self.collect_attr_proc_macro(item, attr); + self.collect_attr_proc_macro(item); } else if attr.check_name("proc_macro") { - self.collect_bang_proc_macro(item, attr); + self.collect_bang_proc_macro(item); }; let prev_in_root = mem::replace(&mut self.in_root, false); diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index cf842dddeb3d6..4fa4c6d61cd95 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -214,20 +214,8 @@ fn should_panic(cx: &ExtCtxt, i: &ast::Item) -> ShouldPanic { match attr::find_by_name(&i.attrs, "should_panic") { Some(attr) => { let ref sd = cx.parse_sess.span_diagnostic; - if attr.is_value_str() { - sd.struct_span_warn( - attr.span(), - "attribute must be of the form: \ - `#[should_panic]` or \ - `#[should_panic(expected = \"error message\")]`" - ).note("Errors in this attribute were erroneously allowed \ - and will become a hard error in a future release.") - .emit(); - return ShouldPanic::Yes(None); - } + match attr.meta_item_list() { - // Handle #[should_panic] - None => ShouldPanic::Yes(None), // Handle #[should_panic(expected = "foo")] Some(list) => { let msg = list.iter() @@ -247,6 +235,8 @@ fn should_panic(cx: &ExtCtxt, i: &ast::Item) -> ShouldPanic { ShouldPanic::Yes(msg) } }, + // Handle #[should_panic] and #[should_panic = "expected"] + None => ShouldPanic::Yes(attr.value_str()) } } None => ShouldPanic::No, diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index d48e189abc450..a9e2626a57e5d 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -66,7 +66,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option { } #[test] -#[ignore(reason = "buildbots don't have ncurses installed and I can't mock everything I need")] +#[ignore = "buildbots don't have ncurses installed and I can't mock everything I need"] fn test_get_dbpath_for_term() { // woefully inadequate test coverage // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's) diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs index c7e1b4435e49b..c5aa903f9491f 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -27,7 +27,8 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { - #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item + #[cfg(feature = $expr)] + //~^ ERROR expected unsuffixed literal or identifier, found concat!("nonexistent") struct S10; } } diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index da06a81751cdb..bcf13ead2f4f7 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -52,11 +52,11 @@ error[E0565]: literal in `cfg` predicate value must be a string LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string | ^^^^^ help: consider removing the prefix: `"hi"` -error: `cfg` is not a well-formed meta-item - --> $DIR/cfg-attr-syntax-validation.rs:30:9 +error: expected unsuffixed literal or identifier, found concat!("nonexistent") + --> $DIR/cfg-attr-syntax-validation.rs:30:15 | -LL | #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item - | ^^^^^^^^^^^^^^^^^^^^^^^ help: expected syntax is: `#[cfg(/* predicate */)]` +LL | #[cfg(feature = $expr)] + | ^^^^^^^ ... LL | generate_s10!(concat!("nonexistent")); | -------------------------------------- in this macro invocation diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.rs b/src/test/ui/derives/deriving-meta-empty-trait-list.rs index 98da6d23245c7..882484146152d 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.rs +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.rs @@ -1,9 +1,4 @@ -// run-pass - -#![allow(dead_code)] - -#[derive] //~ WARNING empty trait list in `derive` -struct Foo; +// compile-pass #[derive()] //~ WARNING empty trait list in `derive` struct Bar; diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr index dbc2387960fdc..191bb780f7e1f 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr @@ -1,11 +1,5 @@ warning: empty trait list in `derive` - --> $DIR/deriving-meta-empty-trait-list.rs:5:1 - | -LL | #[derive] //~ WARNING empty trait list in `derive` - | ^^^^^^^^^ - -warning: empty trait list in `derive` - --> $DIR/deriving-meta-empty-trait-list.rs:8:1 + --> $DIR/deriving-meta-empty-trait-list.rs:3:1 | LL | #[derive()] //~ WARNING empty trait list in `derive` | ^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0232.rs b/src/test/ui/error-codes/E0232.rs deleted file mode 100644 index 8e8062436d6e5..0000000000000 --- a/src/test/ui/error-codes/E0232.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(on_unimplemented)] - -#[rustc_on_unimplemented] -//~^ ERROR E0232 -trait Bar {} - -fn main() { -} diff --git a/src/test/ui/error-codes/E0232.stderr b/src/test/ui/error-codes/E0232.stderr deleted file mode 100644 index 9e9155b1d323c..0000000000000 --- a/src/test/ui/error-codes/E0232.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0232]: `#[rustc_on_unimplemented]` requires a value - --> $DIR/E0232.rs:3:1 - | -LL | #[rustc_on_unimplemented] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here - | - = note: eg `#[rustc_on_unimplemented(message="foo")]` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0232`. diff --git a/src/test/ui/error-codes/E0296.rs b/src/test/ui/error-codes/E0296.rs deleted file mode 100644 index a1a86574465fb..0000000000000 --- a/src/test/ui/error-codes/E0296.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![recursion_limit] //~ ERROR E0296 - -fn main() {} diff --git a/src/test/ui/error-codes/E0296.stderr b/src/test/ui/error-codes/E0296.stderr deleted file mode 100644 index 41e9f7ea7f9fb..0000000000000 --- a/src/test/ui/error-codes/E0296.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0296]: malformed recursion limit attribute, expected #![recursion_limit="N"] - --> $DIR/E0296.rs:1:1 - | -LL | #![recursion_limit] //~ ERROR E0296 - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0296`. diff --git a/src/test/ui/error-codes/E0558.rs b/src/test/ui/error-codes/E0558.rs deleted file mode 100644 index 26d16f685a047..0000000000000 --- a/src/test/ui/error-codes/E0558.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[export_name] -//~^ ERROR E0558 - -pub fn something() {} - -fn main() {} diff --git a/src/test/ui/error-codes/E0558.stderr b/src/test/ui/error-codes/E0558.stderr deleted file mode 100644 index 95bd9a1a828f2..0000000000000 --- a/src/test/ui/error-codes/E0558.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0558]: `export_name` attribute has invalid format - --> $DIR/E0558.rs:1:1 - | -LL | #[export_name] - | ^^^^^^^^^^^^^^ did you mean #[export_name="*"]? - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0558`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 051bfbefdc1f0..b1a8cba1676bd 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -30,75 +30,71 @@ // inputs are handled by each, and (2.) to ease searching for related // occurrences in the source text. -// skip-codegen #![warn(unused_attributes, unknown_lints)] -#![allow(dead_code)] #![allow(stable_features)] // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES -#![warn (x5400)] //~ WARN unknown lint: `x5400` -#![allow (x5300)] //~ WARN unknown lint: `x5300` -#![forbid (x5200)] //~ WARN unknown lint: `x5200` -#![deny (x5100)] //~ WARN unknown lint: `x5100` +#![warn(x5400)] //~ WARN unknown lint: `x5400` +#![allow(x5300)] //~ WARN unknown lint: `x5300` +#![forbid(x5200)] //~ WARN unknown lint: `x5200` +#![deny(x5100)] //~ WARN unknown lint: `x5100` #![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs) -#![macro_export = "4800"] //~ WARN unused attribute -#![plugin_registrar = "4700"] //~ WARN unused attribute +#![macro_export] //~ WARN unused attribute +#![plugin_registrar] //~ WARN unused attribute // skipping testing of cfg // skipping testing of cfg_attr -#![main = "x4400"] //~ WARN unused attribute -#![start = "x4300"] //~ WARN unused attribute +#![main] //~ WARN unused attribute +#![start] //~ WARN unused attribute // see issue-43106-gating-of-test.rs for crate-level; but non crate-level is below at "4200" // see issue-43106-gating-of-bench.rs for crate-level; but non crate-level is below at "4100" -#![repr = "3900"] +#![repr()] //~^ WARN unused attribute -//~| WARN `repr` attribute isn't configurable with a literal -#![path = "3800"] //~ WARN unused attribute -#![abi = "3700"] //~ WARN unused attribute -#![automatically_derived = "3600"] //~ WARN unused attribute -#![no_mangle = "3500"] -#![no_link = "3400"] //~ WARN unused attribute +#![path = "3800"] //~ WARN unused attribute +#![automatically_derived] //~ WARN unused attribute +#![no_mangle] +#![no_link] //~ WARN unused attribute // see issue-43106-gating-of-derive.rs -#![should_panic = "3200"] //~ WARN unused attribute -#![ignore = "3100"] //~ WARN unused attribute -#![no_implicit_prelude = "3000"] +#![should_panic] //~ WARN unused attribute +#![ignore] //~ WARN unused attribute +#![no_implicit_prelude] #![reexport_test_harness_main = "2900"] // see gated-link-args.rs // see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700" // (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600") -#![proc_macro_derive = "2500"] //~ WARN unused attribute -#![doc = "2400"] -#![cold = "2300"] -#![export_name = "2200"] +#![proc_macro_derive()] //~ WARN unused attribute +#![doc = "2400"] +#![cold] +#![export_name = "2200"] // see issue-43106-gating-of-inline.rs -#![link = "2000"] -#![link_name = "1900"] -#![link_section = "1800"] -#![no_builtins = "1700"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300") -#![no_mangle = "1600"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500") +#![link()] +#![link_name = "1900"] +#![link_section = "1800"] +#![no_builtins] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300") +#![no_mangle] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500") // see issue-43106-gating-of-rustc_deprecated.rs -#![must_use = "1400"] +#![must_use] // see issue-43106-gating-of-stable.rs // see issue-43106-gating-of-unstable.rs // see issue-43106-gating-of-deprecated.rs -#![windows_subsystem = "1000"] +#![windows_subsystem = "1000"] // UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES -#![crate_name = "0900"] -#![crate_type = "bin"] // cannot pass "0800" here +#![crate_name = "0900"] +#![crate_type = "bin"] // cannot pass "0800" here // For #![crate_id], see issue #43142. (I cannot bear to enshrine current behavior in a test) // FIXME(#44232) we should warn that this isn't used. -#![feature ( rust1)] +#![feature(rust1)] // For #![no_start], see issue #43144. (I cannot bear to enshrine current behavior in a test) // (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400") -#![no_builtins = "0300"] -#![recursion_limit = "0200"] -#![type_length_limit = "0100"] +#![no_builtins] +#![recursion_limit = "0200"] +#![type_length_limit = "0100"] // USES OF BUILT-IN ATTRIBUTES IN OTHER ("UNUSUAL") PLACES @@ -195,84 +191,84 @@ mod macro_use { //~^ WARN unused attribute } -#[macro_export = "4800"] +#[macro_export] //~^ WARN unused attribute mod macro_export { - mod inner { #![macro_export="4800"] } + mod inner { #![macro_export] } //~^ WARN unused attribute - #[macro_export = "4800"] fn f() { } + #[macro_export] fn f() { } //~^ WARN unused attribute - #[macro_export = "4800"] struct S; + #[macro_export] struct S; //~^ WARN unused attribute - #[macro_export = "4800"] type T = S; + #[macro_export] type T = S; //~^ WARN unused attribute - #[macro_export = "4800"] impl S { } + #[macro_export] impl S { } //~^ WARN unused attribute } -#[plugin_registrar = "4700"] +#[plugin_registrar] //~^ WARN unused attribute mod plugin_registrar { - mod inner { #![plugin_registrar="4700"] } + mod inner { #![plugin_registrar] } //~^ WARN unused attribute // for `fn f()` case, see gated-plugin_registrar.rs - #[plugin_registrar = "4700"] struct S; + #[plugin_registrar] struct S; //~^ WARN unused attribute - #[plugin_registrar = "4700"] type T = S; + #[plugin_registrar] type T = S; //~^ WARN unused attribute - #[plugin_registrar = "4700"] impl S { } + #[plugin_registrar] impl S { } //~^ WARN unused attribute } -#[main = "4400"] +#[main] //~^ WARN unused attribute mod main { - mod inner { #![main="4300"] } + mod inner { #![main] } //~^ WARN unused attribute // for `fn f()` case, see feature-gate-main.rs - #[main = "4400"] struct S; + #[main] struct S; //~^ WARN unused attribute - #[main = "4400"] type T = S; + #[main] type T = S; //~^ WARN unused attribute - #[main = "4400"] impl S { } + #[main] impl S { } //~^ WARN unused attribute } -#[start = "4300"] +#[start] //~^ WARN unused attribute mod start { - mod inner { #![start="4300"] } + mod inner { #![start] } //~^ WARN unused attribute // for `fn f()` case, see feature-gate-start.rs - #[start = "4300"] struct S; + #[start] struct S; //~^ WARN unused attribute - #[start = "4300"] type T = S; + #[start] type T = S; //~^ WARN unused attribute - #[start = "4300"] impl S { } + #[start] impl S { } //~^ WARN unused attribute } // At time of unit test authorship, if compiling without `--test` then // non-crate-level #[test] attributes seem to be ignored. -#[test = "4200"] -mod test { mod inner { #![test="4200"] } +#[test] +mod test { mod inner { #![test] } fn f() { } @@ -286,41 +282,31 @@ mod test { mod inner { #![test="4200"] } // At time of unit test authorship, if compiling without `--test` then // non-crate-level #[bench] attributes seem to be ignored. -#[bench = "4100"] +#[bench] mod bench { - mod inner { #![bench="4100"] } + mod inner { #![bench] } - #[bench = "4100"] + #[bench] struct S; - #[bench = "4100"] + #[bench] type T = S; - #[bench = "4100"] + #[bench] impl S { } } -#[repr = "3900"] -//~^ WARN unused attribute -//~| WARN `repr` attribute isn't configurable with a literal +#[repr()] mod repr { - mod inner { #![repr="3900"] } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + mod inner { #![repr()] } - #[repr = "3900"] fn f() { } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] fn f() { } struct S; - #[repr = "3900"] type T = S; - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] type T = S; - #[repr = "3900"] impl S { } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] impl S { } } #[path = "3800"] @@ -340,130 +326,111 @@ mod path { //~^ WARN unused attribute } -#[abi = "3700"] -//~^ WARN unused attribute -mod abi { - mod inner { #![abi="3700"] } - //~^ WARN unused attribute - - #[abi = "3700"] fn f() { } - //~^ WARN unused attribute - - #[abi = "3700"] struct S; - //~^ WARN unused attribute - - #[abi = "3700"] type T = S; - //~^ WARN unused attribute - - #[abi = "3700"] impl S { } - //~^ WARN unused attribute -} - -#[automatically_derived = "3600"] +#[automatically_derived] //~^ WARN unused attribute mod automatically_derived { - mod inner { #![automatically_derived="3600"] } + mod inner { #![automatically_derived] } //~^ WARN unused attribute - #[automatically_derived = "3600"] fn f() { } + #[automatically_derived] fn f() { } //~^ WARN unused attribute - #[automatically_derived = "3600"] struct S; + #[automatically_derived] struct S; //~^ WARN unused attribute - #[automatically_derived = "3600"] type T = S; + #[automatically_derived] type T = S; //~^ WARN unused attribute - #[automatically_derived = "3600"] impl S { } + #[automatically_derived] impl S { } //~^ WARN unused attribute } -#[no_mangle = "3500"] +#[no_mangle] mod no_mangle { - mod inner { #![no_mangle="3500"] } + mod inner { #![no_mangle] } - #[no_mangle = "3500"] fn f() { } + #[no_mangle] fn f() { } - #[no_mangle = "3500"] struct S; + #[no_mangle] struct S; - #[no_mangle = "3500"] type T = S; + #[no_mangle] type T = S; - #[no_mangle = "3500"] impl S { } + #[no_mangle] impl S { } } -#[no_link = "3400"] +#[no_link] //~^ WARN unused attribute mod no_link { - mod inner { #![no_link="3400"] } + mod inner { #![no_link] } //~^ WARN unused attribute - #[no_link = "3400"] fn f() { } + #[no_link] fn f() { } //~^ WARN unused attribute - #[no_link = "3400"] struct S; + #[no_link] struct S; //~^ WARN unused attribute - #[no_link = "3400"]type T = S; + #[no_link]type T = S; //~^ WARN unused attribute - #[no_link = "3400"] impl S { } + #[no_link] impl S { } //~^ WARN unused attribute } -#[should_panic = "3200"] +#[should_panic] //~^ WARN unused attribute mod should_panic { - mod inner { #![should_panic="3200"] } + mod inner { #![should_panic] } //~^ WARN unused attribute - #[should_panic = "3200"] fn f() { } + #[should_panic] fn f() { } //~^ WARN unused attribute - #[should_panic = "3200"] struct S; + #[should_panic] struct S; //~^ WARN unused attribute - #[should_panic = "3200"] type T = S; + #[should_panic] type T = S; //~^ WARN unused attribute - #[should_panic = "3200"] impl S { } + #[should_panic] impl S { } //~^ WARN unused attribute } -#[ignore = "3100"] +#[ignore] //~^ WARN unused attribute mod ignore { - mod inner { #![ignore="3100"] } + mod inner { #![ignore] } //~^ WARN unused attribute - #[ignore = "3100"] fn f() { } + #[ignore] fn f() { } //~^ WARN unused attribute - #[ignore = "3100"] struct S; + #[ignore] struct S; //~^ WARN unused attribute - #[ignore = "3100"] type T = S; + #[ignore] type T = S; //~^ WARN unused attribute - #[ignore = "3100"] impl S { } + #[ignore] impl S { } //~^ WARN unused attribute } -#[no_implicit_prelude = "3000"] +#[no_implicit_prelude] //~^ WARN unused attribute mod no_implicit_prelude { - mod inner { #![no_implicit_prelude="3000"] } + mod inner { #![no_implicit_prelude] } //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] fn f() { } + #[no_implicit_prelude] fn f() { } //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] struct S; + #[no_implicit_prelude] struct S; //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] type T = S; + #[no_implicit_prelude] type T = S; //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] impl S { } + #[no_implicit_prelude] impl S { } //~^ WARN unused attribute } @@ -506,27 +473,27 @@ mod macro_escape { //~^ WARN unused attribute } -#[no_std = "2600"] +#[no_std] //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute mod no_std { - mod inner { #![no_std="2600"] } + mod inner { #![no_std] } //~^ WARN unused attribute //~| WARN crate-level attribute should be in the root module - #[no_std = "2600"] fn f() { } + #[no_std] fn f() { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] struct S; + #[no_std] struct S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] type T = S; + #[no_std] type T = S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] impl S { } + #[no_std] impl S { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute } @@ -548,17 +515,17 @@ mod doc { #[doc = "2400"] impl S { } } -#[cold = "2300"] +#[cold] mod cold { - mod inner { #![cold="2300"] } + mod inner { #![cold] } - #[cold = "2300"] fn f() { } + #[cold] fn f() { } - #[cold = "2300"] struct S; + #[cold] struct S; - #[cold = "2300"] type T = S; + #[cold] type T = S; - #[cold = "2300"] impl S { } + #[cold] impl S { } } #[export_name = "2200"] @@ -579,17 +546,17 @@ mod export_name { // out that we allow them at non-crate-level (though I do not know // whether they have the same effect here as at crate-level). -#[link = "2000"] +#[link()] mod link { - mod inner { #![link="2000"] } + mod inner { #![link()] } - #[link = "2000"] fn f() { } + #[link()] fn f() { } - #[link = "2000"] struct S; + #[link()] struct S; - #[link = "2000"] type T = S; + #[link()] type T = S; - #[link = "2000"] impl S { } + #[link()] impl S { } } #[link_name = "1900"] @@ -620,30 +587,30 @@ mod link_section { struct StructForDeprecated; -#[deprecated = "1500"] +#[deprecated] mod deprecated { - mod inner { #![deprecated="1500"] } + mod inner { #![deprecated] } - #[deprecated = "1500"] fn f() { } + #[deprecated] fn f() { } - #[deprecated = "1500"] struct S1; + #[deprecated] struct S1; - #[deprecated = "1500"] type T = super::StructForDeprecated; + #[deprecated] type T = super::StructForDeprecated; - #[deprecated = "1500"] impl super::StructForDeprecated { } + #[deprecated] impl super::StructForDeprecated { } } -#[must_use = "1400"] +#[must_use] mod must_use { - mod inner { #![must_use="1400"] } + mod inner { #![must_use] } - #[must_use = "1400"] fn f() { } + #[must_use] fn f() { } - #[must_use = "1400"] struct S; + #[must_use] struct S; - #[must_use = "1400"] type T = S; + #[must_use] type T = S; - #[must_use = "1400"] impl S { } + #[must_use] impl S { } } #[windows_subsystem = "1000"] @@ -737,42 +704,42 @@ mod feature { } -#[no_main = "0400"] +#[no_main] //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute mod no_main_1 { - mod inner { #![no_main="0400"] } + mod inner { #![no_main] } //~^ WARN unused attribute //~| WARN crate-level attribute should be in the root module - #[no_main = "0400"] fn f() { } + #[no_main] fn f() { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] struct S; + #[no_main] struct S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] type T = S; + #[no_main] type T = S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] impl S { } + #[no_main] impl S { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute } -#[no_builtins = "0300"] +#[no_builtins] mod no_builtins { - mod inner { #![no_builtins="0200"] } + mod inner { #![no_builtins] } - #[no_builtins = "0300"] fn f() { } + #[no_builtins] fn f() { } - #[no_builtins = "0300"] struct S; + #[no_builtins] struct S; - #[no_builtins = "0300"] type T = S; + #[no_builtins] type T = S; - #[no_builtins = "0300"] impl S { } + #[no_builtins] impl S { } } #[recursion_limit="0200"] @@ -825,12 +792,4 @@ mod type_length_limit { //~| WARN crate-level attribute should be an inner attribute } - - - - - - -fn main() { - println!("Hello World"); -} +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index cb3e9bd62a408..4d15ccb300a87 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,1307 +1,1180 @@ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:38:9 | -LL | #![warn (x5400)] //~ WARN unknown lint: `x5400` - | ^^^^^ +LL | #![warn(x5400)] //~ WARN unknown lint: `x5400` + | ^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:34:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:28 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:10 | -LL | #![allow (x5300)] //~ WARN unknown lint: `x5300` - | ^^^^^ +LL | #![allow(x5300)] //~ WARN unknown lint: `x5300` + | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:42:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:11 | -LL | #![forbid (x5200)] //~ WARN unknown lint: `x5200` - | ^^^^^ +LL | #![forbid(x5200)] //~ WARN unknown lint: `x5200` + | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 | -LL | #![deny (x5100)] //~ WARN unknown lint: `x5100` - | ^^^^^ +LL | #![deny(x5100)] //~ WARN unknown lint: `x5100` + | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:105:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:101:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:108:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:104:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:107:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:110:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:460:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:307:17 - | -LL | mod inner { #![repr="3900"] } - | ^^^^^^^^^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:311:5 - | -LL | #[repr = "3900"] fn f() { } - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:5 - | -LL | #[repr = "3900"] type T = S; - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 - | -LL | #[repr = "3900"] impl S { } - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:303:1 - | -LL | #[repr = "3900"] - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 - | -LL | #![repr = "3900"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:34:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:9 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:188:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:191:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:17 | -LL | mod inner { #![macro_export="4800"] } - | ^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5 - | -LL | #[macro_export = "4800"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:5 - | -LL | #[macro_export = "4800"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:5 - | -LL | #[macro_export = "4800"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5 - | -LL | #[macro_export = "4800"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:1 - | -LL | #[macro_export = "4800"] - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![macro_export] } + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:220:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:5 | -LL | mod inner { #![plugin_registrar="4700"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] fn f() { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:225:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 | -LL | #[plugin_registrar = "4700"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] struct S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:228:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:206:5 | -LL | #[plugin_registrar = "4700"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] type T = S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 | -LL | #[plugin_registrar = "4700"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] impl S { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:217:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:1 | -LL | #[plugin_registrar = "4700"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:17 | -LL | mod inner { #![main="4300"] } - | ^^^^^^^^^^^^^^^ +LL | mod inner { #![plugin_registrar] } + | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:243:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:221:5 | -LL | #[main = "4400"] struct S; - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] struct S; + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:246:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:5 | -LL | #[main = "4400"] type T = S; - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] type T = S; + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:249:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5 | -LL | #[main = "4400"] impl S { } - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] impl S { } + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:1 | -LL | #[main = "4400"] - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:234:17 | -LL | mod inner { #![start="4300"] } - | ^^^^^^^^^^^^^^^^ +LL | mod inner { #![main] } + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:261:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:239:5 | -LL | #[start = "4300"] struct S; - | ^^^^^^^^^^^^^^^^^ +LL | #[main] struct S; + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:264:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5 | -LL | #[start = "4300"] type T = S; - | ^^^^^^^^^^^^^^^^^ +LL | #[main] type T = S; + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:267:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:5 | -LL | #[start = "4300"] impl S { } - | ^^^^^^^^^^^^^^^^^ +LL | #[main] impl S { } + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:1 | -LL | #[start = "4300"] - | ^^^^^^^^^^^^^^^^^ +LL | #[main] + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:307:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:17 | -LL | mod inner { #![repr="3900"] } - | ^^^^^^^^^^^^^^^ +LL | mod inner { #![start] } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:311:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:5 | -LL | #[repr = "3900"] fn f() { } - | ^^^^^^^^^^^^^^^^ +LL | #[start] struct S; + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:260:5 | -LL | #[repr = "3900"] type T = S; - | ^^^^^^^^^^^^^^^^ +LL | #[start] type T = S; + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:5 | -LL | #[repr = "3900"] impl S { } - | ^^^^^^^^^^^^^^^^ +LL | #[start] impl S { } + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:303:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:249:1 | -LL | #[repr = "3900"] - | ^^^^^^^^^^^^^^^^ +LL | #[start] + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:333:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:322:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:325:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:17 - | -LL | mod inner { #![abi="3700"] } - | ^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5 - | -LL | #[abi = "3700"] fn f() { } - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:5 - | -LL | #[abi = "3700"] struct S; - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 - | -LL | #[abi = "3700"] type T = S; - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:358:5 - | -LL | #[abi = "3700"] impl S { } - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:1 - | -LL | #[abi = "3700"] - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:17 | -LL | mod inner { #![automatically_derived="3600"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![automatically_derived] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5 | -LL | #[automatically_derived = "3600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:338:5 | -LL | #[automatically_derived = "3600"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:5 | -LL | #[automatically_derived = "3600"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:377:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5 | -LL | #[automatically_derived = "3600"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:1 | -LL | #[automatically_derived = "3600"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:397:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:17 | -LL | mod inner { #![no_link="3400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_link] } + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:400:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 | -LL | #[no_link = "3400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] fn f() { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 | -LL | #[no_link = "3400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] struct S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:5 | -LL | #[no_link = "3400"]type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link]type T = S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5 | -LL | #[no_link = "3400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] impl S { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:1 | -LL | #[no_link = "3400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:17 | -LL | mod inner { #![should_panic="3200"] } - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![should_panic] } + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:5 | -LL | #[should_panic = "3200"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] fn f() { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5 | -LL | #[should_panic = "3200"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] struct S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:5 | -LL | #[should_panic = "3200"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] type T = S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 | -LL | #[should_panic = "3200"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] impl S { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:1 | -LL | #[should_panic = "3200"] - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:17 | -LL | mod inner { #![ignore="3100"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![ignore] } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:5 | -LL | #[ignore = "3100"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] fn f() { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 | -LL | #[ignore = "3100"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] struct S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 | -LL | #[ignore = "3100"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] type T = S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:447:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | -LL | #[ignore = "3100"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] impl S { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:1 | -LL | #[ignore = "3100"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:17 | -LL | mod inner { #![no_implicit_prelude="3000"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_implicit_prelude] } + | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:5 | -LL | #[no_implicit_prelude = "3000"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:460:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:5 | -LL | #[no_implicit_prelude = "3000"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 | -LL | #[no_implicit_prelude = "3000"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 | -LL | #[no_implicit_prelude = "3000"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:1 | -LL | #[no_implicit_prelude = "3000"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:473:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:440:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:485:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:437:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:499:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:502:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:513:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 | -LL | mod inner { #![no_std="2600"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_std] } + | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:513:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 | -LL | mod inner { #![no_std="2600"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_std] } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:517:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | -LL | #[no_std = "2600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] fn f() { } + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:517:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | -LL | #[no_std = "2600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] fn f() { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:521:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 | -LL | #[no_std = "2600"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] struct S; + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:521:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 | -LL | #[no_std = "2600"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] struct S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:525:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | -LL | #[no_std = "2600"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] type T = S; + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:525:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | -LL | #[no_std = "2600"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] type T = S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:529:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | -LL | #[no_std = "2600"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] impl S { } + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:529:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | -LL | #[no_std = "2600"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] impl S { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 | -LL | #[no_std = "2600"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 | -LL | #[no_std = "2600"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:730:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:730:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 | -LL | mod inner { #![no_main="0400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_main] } + | ^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 | -LL | mod inner { #![no_main="0400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_main] } + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | -LL | #[no_main = "0400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] fn f() { } + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | -LL | #[no_main = "0400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] fn f() { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | -LL | #[no_main = "0400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] struct S; + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | -LL | #[no_main = "0400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] struct S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 | -LL | #[no_main = "0400"] type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] type T = S; + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 | -LL | #[no_main = "0400"] type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] type T = S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 | -LL | #[no_main = "0400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] impl S { } + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 | -LL | #[no_main = "0400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] impl S { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 | -LL | #[no_main = "0400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 | -LL | #[no_main = "0400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:794:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:823:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:823:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:1 - | -LL | #![macro_export = "4800"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:46:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:1 | -LL | #![plugin_registrar = "4700"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![macro_export] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:49:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 | -LL | #![main = "x4400"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![plugin_registrar] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:1 | -LL | #![start = "x4300"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![main] //~ WARN unused attribute + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 | -LL | #![repr = "3900"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![start] //~ WARN unused attribute + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:1 | -LL | #![path = "3800"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![repr()] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:57:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 | -LL | #![abi = "3700"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![path = "3800"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | -LL | #![automatically_derived = "3600"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![automatically_derived] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | -LL | #![no_link = "3400"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![no_link] //~ WARN unused attribute + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 | -LL | #![should_panic = "3200"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![should_panic] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | -LL | #![ignore = "3100"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![ignore] //~ WARN unused attribute + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 | -LL | #![proc_macro_derive = "2500"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![proc_macro_derive()] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ error: invalid windows subsystem `1000`, only `windows` and `console` are allowed diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs index 32f30ce830447..360d570b65061 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs @@ -7,15 +7,7 @@ // compile-pass // skip-codegen -#![allow(dead_code)] -#![deprecated = "1100"] -// Since we expect for the mix of attributes used here to compile -// successfully, and we are just testing for the expected warnings of -// various (mis)uses of attributes, we use the `rustc_error` attribute -// on the `fn main()`. +#![deprecated] - -fn main() { - println!("Hello World"); -} +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs index 7c17cd1af153c..bb9e6d4ca83b0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs @@ -6,23 +6,25 @@ // issue-43106-gating-of-builtin-attrs.rs) // Crate-level is accepted, though it is almost certainly unused? -#![inline = "2100"] +#![inline] -#[inline = "2100"] +#[inline] //~^ ERROR attribute should be applied to function or closure mod inline { - mod inner { #![inline="2100"] } + mod inner { #![inline] } //~^ ERROR attribute should be applied to function or closure #[inline = "2100"] fn f() { } + //~^ WARN attribute must be of the form + //~| WARN this was previously accepted - #[inline = "2100"] struct S; + #[inline] struct S; //~^ ERROR attribute should be applied to function or closure - #[inline = "2100"] type T = S; + #[inline] type T = S; //~^ ERROR attribute should be applied to function or closure - #[inline = "2100"] impl S { } + #[inline] impl S { } //~^ ERROR attribute should be applied to function or closure } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 7eb0b5c197acf..485ff11eea7bf 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -1,11 +1,21 @@ +warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` + --> $DIR/issue-43106-gating-of-inline.rs:17:5 + | +LL | #[inline = "2100"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(ill_formed_attribute_input)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43106-gating-of-inline.rs:11:1 | -LL | #[inline = "2100"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[inline] + | ^^^^^^^^^ LL | //~^ ERROR attribute should be applied to function or closure LL | / mod inline { -LL | | mod inner { #![inline="2100"] } +LL | | mod inner { #![inline] } LL | | //~^ ERROR attribute should be applied to function or closure LL | | ... | @@ -16,26 +26,26 @@ LL | | } error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43106-gating-of-inline.rs:14:17 | -LL | mod inner { #![inline="2100"] } - | ------------^^^^^^^^^^^^^^^^^-- not a function or closure +LL | mod inner { #![inline] } + | ------------^^^^^^^^^^-- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:19:5 + --> $DIR/issue-43106-gating-of-inline.rs:21:5 | -LL | #[inline = "2100"] struct S; - | ^^^^^^^^^^^^^^^^^^ --------- not a function or closure +LL | #[inline] struct S; + | ^^^^^^^^^ --------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:22:5 + --> $DIR/issue-43106-gating-of-inline.rs:24:5 | -LL | #[inline = "2100"] type T = S; - | ^^^^^^^^^^^^^^^^^^ ----------- not a function or closure +LL | #[inline] type T = S; + | ^^^^^^^^^ ----------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:25:5 + --> $DIR/issue-43106-gating-of-inline.rs:27:5 | -LL | #[inline = "2100"] impl S { } - | ^^^^^^^^^^^^^^^^^^ ---------- not a function or closure +LL | #[inline] impl S { } + | ^^^^^^^^^ ---------- not a function or closure error: aborting due to 5 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs index bb54c0013d24e..725f2e0b9d008 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs @@ -3,21 +3,23 @@ // corresponds to cases where the attribute is currently unused, so we // get that warning; see issue-43106-gating-of-builtin-attrs.rs -#![macro_use = "4900"] //~ ERROR arguments to macro_use are not allowed here +#![macro_use(my_macro)] +//~^ ERROR arguments to macro_use are not allowed here -#[macro_use = "2700"] +#[macro_use(my_macro)] //~^ ERROR arguments to macro_use are not allowed here mod macro_escape { - mod inner { #![macro_use="2700"] } + mod inner { #![macro_use(my_macro)] } //~^ ERROR arguments to macro_use are not allowed here - #[macro_use = "2700"] fn f() { } - #[macro_use = "2700"] struct S; + //~^ ERROR attribute must be of the form + + #[macro_use] fn f() { } - #[macro_use = "2700"] type T = S; + #[macro_use] type T = S; - #[macro_use = "2700"] impl S { } + #[macro_use] impl S { } } fn main() { } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr index fb0e3b4caea35..8074528c0e060 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr @@ -1,20 +1,26 @@ error: arguments to macro_use are not allowed here --> $DIR/issue-43106-gating-of-macro_use.rs:6:1 | -LL | #![macro_use = "4900"] //~ ERROR arguments to macro_use are not allowed here - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![macro_use(my_macro)] + | ^^^^^^^^^^^^^^^^^^^^^^^ error: arguments to macro_use are not allowed here - --> $DIR/issue-43106-gating-of-macro_use.rs:8:1 + --> $DIR/issue-43106-gating-of-macro_use.rs:9:1 | -LL | #[macro_use = "2700"] - | ^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_use(my_macro)] + | ^^^^^^^^^^^^^^^^^^^^^^ error: arguments to macro_use are not allowed here - --> $DIR/issue-43106-gating-of-macro_use.rs:11:17 + --> $DIR/issue-43106-gating-of-macro_use.rs:12:17 | -LL | mod inner { #![macro_use="2700"] } - | ^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![macro_use(my_macro)] } + | ^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: attribute must be of the form `#[macro_use]` or `#[macro_use(name1, name2, ...)]` + --> $DIR/issue-43106-gating-of-macro_use.rs:15:5 + | +LL | #[macro_use = "2700"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs index e2d0c263e65f3..a94ffd602efbf 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs @@ -7,27 +7,27 @@ // signal errors, making it incompatible with the "warnings only" // nature of issue-43106-gating-of-builtin-attrs.rs -#[proc_macro_derive = "2500"] +#[proc_macro_derive()] //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions mod proc_macro_derive1 { - mod inner { #![proc_macro_derive="2500"] } + mod inner { #![proc_macro_derive()] } // (no error issued here if there was one on outer module) } mod proc_macro_derive2 { - mod inner { #![proc_macro_derive="2500"] } + mod inner { #![proc_macro_derive()] } //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] fn f() { } + #[proc_macro_derive()] fn f() { } //~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` - #[proc_macro_derive = "2500"] struct S; + #[proc_macro_derive()] struct S; //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] type T = S; + #[proc_macro_derive()] type T = S; //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] impl S { } + #[proc_macro_derive()] impl S { } //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr index aa841c3263c91..e202b472d9cae 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr @@ -1,38 +1,38 @@ error: the `#[proc_macro_derive]` attribute may only be used on bare functions --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:10:1 | -LL | #[proc_macro_derive = "2500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:18:17 | -LL | mod inner { #![proc_macro_derive="2500"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![proc_macro_derive()] } + | ^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:21:5 | -LL | #[proc_macro_derive = "2500"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:24:5 | -LL | #[proc_macro_derive = "2500"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:27:5 | -LL | #[proc_macro_derive = "2500"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:30:5 | -LL | #[proc_macro_derive = "2500"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs index b2fd6a7358fd5..60873f9cc7581 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs @@ -4,25 +4,25 @@ // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![rustc_deprecated = "1500"] +#![rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library -#[rustc_deprecated = "1500"] +#[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library mod rustc_deprecated { - mod inner { #![rustc_deprecated="1500"] } + mod inner { #![rustc_deprecated()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] fn f() { } + #[rustc_deprecated()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] struct S; + #[rustc_deprecated()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] type T = S; + #[rustc_deprecated()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] impl S { } + #[rustc_deprecated()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr index af056bc12e92c..4eead36910356 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1 | -LL | #![rustc_deprecated = "1500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:10:1 | -LL | #[rustc_deprecated = "1500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:13:17 | -LL | mod inner { #![rustc_deprecated="1500"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![rustc_deprecated()] } + | ^^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:5 | -LL | #[rustc_deprecated = "1500"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:19:5 | -LL | #[rustc_deprecated = "1500"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] struct S; + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:22:5 | -LL | #[rustc_deprecated = "1500"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:25:5 | -LL | #[rustc_deprecated = "1500"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs index 7d9501a799646..e3ac2749306ab 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs @@ -4,25 +4,25 @@ // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![stable = "1300"] +#![stable()] //~^ ERROR stability attributes may not be used outside of the standard library -#[stable = "1300"] +#[stable()] //~^ ERROR stability attributes may not be used outside of the standard library mod stable { - mod inner { #![stable="1300"] } + mod inner { #![stable()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] fn f() { } + #[stable()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] struct S; + #[stable()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] type T = S; + #[stable()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] impl S { } + #[stable()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr index 56066e85ba26b..03410eabe3652 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:7:1 | -LL | #![stable = "1300"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![stable()] + | ^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:10:1 | -LL | #[stable = "1300"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:13:17 | -LL | mod inner { #![stable="1300"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![stable()] } + | ^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:16:5 | -LL | #[stable = "1300"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] fn f() { } + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:19:5 | -LL | #[stable = "1300"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] struct S; + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:22:5 | -LL | #[stable = "1300"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] type T = S; + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:25:5 | -LL | #[stable = "1300"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] impl S { } + | ^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs index 8be55f0baf623..8d519c3106c5e 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs @@ -4,25 +4,25 @@ // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![unstable = "1200"] +#![unstable()] //~^ ERROR stability attributes may not be used outside of the standard library -#[unstable = "1200"] +#[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library mod unstable { - mod inner { #![unstable="1200"] } + mod inner { #![unstable()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] fn f() { } + #[unstable()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] struct S; + #[unstable()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] type T = S; + #[unstable()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] impl S { } + #[unstable()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr index ee8b9d43d41e7..5952b3836aac8 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:7:1 | -LL | #![unstable = "1200"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![unstable()] + | ^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:10:1 | -LL | #[unstable = "1200"] - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:13:17 | -LL | mod inner { #![unstable="1200"] } - | ^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![unstable()] } + | ^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:16:5 | -LL | #[unstable = "1200"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] fn f() { } + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:19:5 | -LL | #[unstable = "1200"] struct S; - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] struct S; + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:22:5 | -LL | #[unstable = "1200"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] type T = S; + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:25:5 | -LL | #[unstable = "1200"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] impl S { } + | ^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs index 6dda2c5551358..e0cb9c882192b 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs @@ -8,7 +8,7 @@ extern { fn extern_fn(); // CHECK-NOT: Function Attrs: nounwind // CHECK: declare void @unwinding_extern_fn - #[unwind] //~ ERROR #[unwind] is experimental + #[unwind(allowed)] //~ ERROR #[unwind] is experimental fn unwinding_extern_fn(); } diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr index e558712afd13b..918d40d681bb4 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr @@ -1,8 +1,8 @@ error[E0658]: #[unwind] is experimental --> $DIR/feature-gate-unwind-attributes.rs:11:5 | -LL | #[unwind] //~ ERROR #[unwind] is experimental - | ^^^^^^^^^ +LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental + | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unwind_attributes)] to the crate attributes to enable diff --git a/src/test/ui/gated-bad-feature.rs b/src/test/ui/gated-bad-feature.rs index 0782fe4c108f7..fb4cc94f779fe 100644 --- a/src/test/ui/gated-bad-feature.rs +++ b/src/test/ui/gated-bad-feature.rs @@ -6,8 +6,8 @@ //~^^^ ERROR: malformed feature //~^^^ ERROR: malformed feature -#![feature] //~ ERROR: malformed feature -#![feature = "foo"] //~ ERROR: malformed feature +#![feature] //~ ERROR: attribute must be of the form +#![feature = "foo"] //~ ERROR: attribute must be of the form #![feature(test_removed_feature)] //~ ERROR: feature has been removed diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index a8c35dd6b086c..141c51609b7c5 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -10,25 +10,25 @@ error[E0556]: malformed feature, expected just one word LL | foo = "baz" | ^^^^^^^^^^^ -error[E0555]: malformed feature attribute, expected #![feature(...)] +error[E0557]: feature has been removed + --> $DIR/gated-bad-feature.rs:12:12 + | +LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:9:1 | -LL | #![feature] //~ ERROR: malformed feature +LL | #![feature] //~ ERROR: attribute must be of the form | ^^^^^^^^^^^ -error[E0555]: malformed feature attribute, expected #![feature(...)] +error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:10:1 | -LL | #![feature = "foo"] //~ ERROR: malformed feature +LL | #![feature = "foo"] //~ ERROR: attribute must be of the form | ^^^^^^^^^^^^^^^^^^^ -error[E0557]: feature has been removed - --> $DIR/gated-bad-feature.rs:12:12 - | -LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed - | ^^^^^^^^^^^^^^^^^^^^ - error: aborting due to 5 previous errors -Some errors occurred: E0555, E0556, E0557. -For more information about an error, try `rustc --explain E0555`. +Some errors occurred: E0556, E0557. +For more information about an error, try `rustc --explain E0556`. diff --git a/src/test/ui/invalid_crate_type_syntax.rs b/src/test/ui/invalid_crate_type_syntax.rs index eae4fad5b4fa7..8157ccdcbf0b9 100644 --- a/src/test/ui/invalid_crate_type_syntax.rs +++ b/src/test/ui/invalid_crate_type_syntax.rs @@ -1,5 +1,5 @@ // regression test for issue 16974 -#![crate_type(lib)] //~ ERROR `crate_type` requires a value +#![crate_type(lib)] //~ ERROR attribute must be of the form fn my_lib_fn() {} diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index 8494f718817f3..8d6948b583c51 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -1,10 +1,8 @@ -error: `crate_type` requires a value +error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/invalid_crate_type_syntax.rs:2:1 | -LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value +LL | #![crate_type(lib)] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^ - | - = note: for example: `#![crate_type="lib"]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43988.rs b/src/test/ui/issues/issue-43988.rs index b2a203546fe07..74667d74334cc 100644 --- a/src/test/ui/issues/issue-43988.rs +++ b/src/test/ui/issues/issue-43988.rs @@ -24,8 +24,7 @@ fn main() { #[repr] let _y = "123"; //~^^ ERROR attribute should not be applied to a statement - //~| WARN `repr` attribute must have a hint - + //~| ERROR attribute must be of the form fn foo() {} @@ -35,5 +34,5 @@ fn main() { let _z = #[repr] 1; //~^ ERROR attribute should not be applied to an expression - //~| WARN `repr` attribute must have a hint + //~| ERROR attribute must be of the form } diff --git a/src/test/ui/issues/issue-43988.stderr b/src/test/ui/issues/issue-43988.stderr index 811816d0087b8..6fe41a3de29b4 100644 --- a/src/test/ui/issues/issue-43988.stderr +++ b/src/test/ui/issues/issue-43988.stderr @@ -1,21 +1,14 @@ -warning: `repr` attribute must have a hint +error: attribute must be of the form `#[repr(C, packed, ...)]` --> $DIR/issue-43988.rs:24:5 | LL | #[repr] - | ^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ -warning: `repr` attribute must have a hint - --> $DIR/issue-43988.rs:36:14 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/issue-43988.rs:35:14 | LL | let _z = #[repr] 1; - | ^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43988.rs:5:5 @@ -60,7 +53,7 @@ LL | let _y = "123"; | --------------- not a struct, enum or union error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:32:5 + --> $DIR/issue-43988.rs:31:5 | LL | #[inline(ABC)] | ^^^^^^^^^^^^^^ @@ -68,12 +61,12 @@ LL | foo(); | ----- not a function or closure error[E0517]: attribute should not be applied to an expression - --> $DIR/issue-43988.rs:36:14 + --> $DIR/issue-43988.rs:35:14 | LL | let _z = #[repr] 1; | ^^^^^^^ - not defining a struct, enum or union -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors Some errors occurred: E0517, E0518. For more information about an error, try `rustc --explain E0517`. diff --git a/src/test/ui/lint/lint-malformed.rs b/src/test/ui/lint/lint-malformed.rs index e9232497c3f04..c97a4320f1d20 100644 --- a/src/test/ui/lint/lint-malformed.rs +++ b/src/test/ui/lint/lint-malformed.rs @@ -1,4 +1,4 @@ -#![deny = "foo"] //~ ERROR malformed lint attribute +#![deny = "foo"] //~ ERROR attribute must be of the form #![allow(bar = "baz")] //~ ERROR malformed lint attribute fn main() { } diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr index 554b0250d0a1e..98a7cecc2bb2d 100644 --- a/src/test/ui/lint/lint-malformed.stderr +++ b/src/test/ui/lint/lint-malformed.stderr @@ -1,15 +1,15 @@ -error[E0452]: malformed lint attribute - --> $DIR/lint-malformed.rs:1:1 - | -LL | #![deny = "foo"] //~ ERROR malformed lint attribute - | ^^^^^^^^^^^^^^^^ - error[E0452]: malformed lint attribute --> $DIR/lint-malformed.rs:2:10 | LL | #![allow(bar = "baz")] //~ ERROR malformed lint attribute | ^^^^^^^^^^^ +error: attribute must be of the form `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` + --> $DIR/lint-malformed.rs:1:1 + | +LL | #![deny = "foo"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^ + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/macros/meta-item-absolute-path.rs b/src/test/ui/macros/meta-item-absolute-path.rs new file mode 100644 index 0000000000000..14d23be059c87 --- /dev/null +++ b/src/test/ui/macros/meta-item-absolute-path.rs @@ -0,0 +1,4 @@ +#[derive(::Absolute)] //~ ERROR failed to resolve +struct S; + +fn main() {} diff --git a/src/test/ui/macros/meta-item-absolute-path.stderr b/src/test/ui/macros/meta-item-absolute-path.stderr new file mode 100644 index 0000000000000..31b0a27bbc8da --- /dev/null +++ b/src/test/ui/macros/meta-item-absolute-path.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: maybe a missing `extern crate Absolute;`? + --> $DIR/meta-item-absolute-path.rs:1:12 + | +LL | #[derive(::Absolute)] //~ ERROR failed to resolve + | ^^^^^^^^ maybe a missing `extern crate Absolute;`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/malformed/malformed-derive-entry.rs b/src/test/ui/malformed/malformed-derive-entry.rs index 2c8ebc497728b..74d22102c664d 100644 --- a/src/test/ui/malformed/malformed-derive-entry.rs +++ b/src/test/ui/malformed/malformed-derive-entry.rs @@ -11,7 +11,7 @@ struct Test2; struct Test3; #[derive] -//~^ WARNING empty trait list +//~^ ERROR attribute must be of the form struct Test4; fn main() {} diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index b3474220eec02..f546f74220a1c 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -16,11 +16,11 @@ warning: empty trait list in `derive` LL | #[derive()] | ^^^^^^^^^^^ -warning: empty trait list in `derive` +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` --> $DIR/malformed-derive-entry.rs:13:1 | LL | #[derive] | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/malformed/malformed-plugin-1.rs b/src/test/ui/malformed/malformed-plugin-1.rs index c5a251d28fa58..16e7a952ef2d0 100644 --- a/src/test/ui/malformed/malformed-plugin-1.rs +++ b/src/test/ui/malformed/malformed-plugin-1.rs @@ -1,4 +1,4 @@ #![feature(plugin)] -#![plugin] //~ ERROR malformed plugin attribute +#![plugin] //~ ERROR attribute must be of the form fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index 4124fd6e4a6d4..f42e66e2b32f3 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,9 +1,8 @@ -error[E0498]: malformed plugin attribute +error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-1.rs:2:1 | -LL | #![plugin] //~ ERROR malformed plugin attribute +LL | #![plugin] //~ ERROR attribute must be of the form | ^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0498`. diff --git a/src/test/ui/malformed/malformed-plugin-2.rs b/src/test/ui/malformed/malformed-plugin-2.rs index 96a3138e712ca..70a1d7f85e8b6 100644 --- a/src/test/ui/malformed/malformed-plugin-2.rs +++ b/src/test/ui/malformed/malformed-plugin-2.rs @@ -1,4 +1,4 @@ #![feature(plugin)] -#![plugin="bleh"] //~ ERROR malformed plugin attribute +#![plugin="bleh"] //~ ERROR attribute must be of the form fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 308db46b6fc9f..923cbc188607e 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,9 +1,8 @@ -error[E0498]: malformed plugin attribute +error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-2.rs:2:1 | -LL | #![plugin="bleh"] //~ ERROR malformed plugin attribute +LL | #![plugin="bleh"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0498`. diff --git a/src/test/ui/malformed/malformed-regressions.rs b/src/test/ui/malformed/malformed-regressions.rs new file mode 100644 index 0000000000000..b5c992440d4dc --- /dev/null +++ b/src/test/ui/malformed/malformed-regressions.rs @@ -0,0 +1,8 @@ +// compile-pass + +#[doc] //~ WARN attribute must be of the form +#[ignore()] //~ WARN attribute must be of the form +#[inline = ""] //~ WARN attribute must be of the form +#[link] //~ WARN attribute must be of the form +#[link = ""] //~ WARN attribute must be of the form +fn main() {} diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr new file mode 100644 index 0000000000000..f8dbfc04f1056 --- /dev/null +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -0,0 +1,48 @@ +warning: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]` + --> $DIR/malformed-regressions.rs:3:1 + | +LL | #[doc] //~ WARN attribute must be of the form + | ^^^^^^ + | + = note: #[warn(ill_formed_attribute_input)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + +warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]` + --> $DIR/malformed-regressions.rs:4:1 + | +LL | #[ignore()] //~ WARN attribute must be of the form + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + +warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` + --> $DIR/malformed-regressions.rs:5:1 + | +LL | #[inline = ""] //~ WARN attribute must be of the form + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + +warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...")]` + --> $DIR/malformed-regressions.rs:6:1 + | +LL | #[link] //~ WARN attribute must be of the form + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + +warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...")]` + --> $DIR/malformed-regressions.rs:7:1 + | +LL | #[link = ""] //~ WARN attribute must be of the form + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57321 + diff --git a/src/test/ui/malformed/malformed-special-attrs.rs b/src/test/ui/malformed/malformed-special-attrs.rs new file mode 100644 index 0000000000000..f91c6bedb2b21 --- /dev/null +++ b/src/test/ui/malformed/malformed-special-attrs.rs @@ -0,0 +1,13 @@ +#[cfg_attr] //~ ERROR expected `(`, found `` +struct S1; + +#[cfg_attr = ""] //~ ERROR expected `(`, found `=` +struct S2; + +#[derive] //~ ERROR attribute must be of the form +struct S3; + +#[derive = ""] //~ ERROR attribute must be of the form +struct S4; + +fn main() {} diff --git a/src/test/ui/malformed/malformed-special-attrs.stderr b/src/test/ui/malformed/malformed-special-attrs.stderr new file mode 100644 index 0000000000000..1653aa150d578 --- /dev/null +++ b/src/test/ui/malformed/malformed-special-attrs.stderr @@ -0,0 +1,25 @@ +error: expected `(`, found `` + +error: expected `(`, found `=` + --> $DIR/malformed-special-attrs.rs:4:12 + | +LL | #[cfg_attr] //~ ERROR expected `(`, found `` + | - expected `(` +... +LL | #[cfg_attr = ""] //~ ERROR expected `(`, found `=` + | ^ unexpected token + +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` + --> $DIR/malformed-special-attrs.rs:7:1 + | +LL | #[derive] //~ ERROR attribute must be of the form + | ^^^^^^^^^ + +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` + --> $DIR/malformed-special-attrs.rs:10:1 + | +LL | #[derive = ""] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs index 4756bb11455c5..ea356d574f622 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs @@ -3,14 +3,14 @@ #[marker(always)] trait Marker1 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR attribute must be of the form #[marker("never")] trait Marker2 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR attribute must be of the form #[marker(key = value)] trait Marker3 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR expected unsuffixed literal or identifier, found value fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr index e7c1e90df33db..c683b393d84e9 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr @@ -1,20 +1,20 @@ -error: attribute should be empty +error: attribute must be of the form `#[marker]` --> $DIR/marker-attribute-with-values.rs:4:1 | LL | #[marker(always)] | ^^^^^^^^^^^^^^^^^ -error: attribute should be empty +error: attribute must be of the form `#[marker]` --> $DIR/marker-attribute-with-values.rs:8:1 | LL | #[marker("never")] | ^^^^^^^^^^^^^^^^^^ -error: attribute should be empty - --> $DIR/marker-attribute-with-values.rs:12:1 +error: expected unsuffixed literal or identifier, found value + --> $DIR/marker-attribute-with-values.rs:12:10 | LL | #[marker(key = value)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/normalization.rs b/src/test/ui/nll/user-annotations/normalization.rs index 51d9adccd7372..e0af2e67e1836 100644 --- a/src/test/ui/nll/user-annotations/normalization.rs +++ b/src/test/ui/nll/user-annotations/normalization.rs @@ -2,7 +2,6 @@ // after normalization. #![feature(nll)] -#![ignore(unused)] trait Foo { type Out; } impl Foo for () { type Out = &'static u32; } diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr index b059d5aa89ad0..71bf8507a735f 100644 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ b/src/test/ui/nll/user-annotations/normalization.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/normalization.rs:12:31 + --> $DIR/normalization.rs:11:31 | LL | let b: <() as Foo>::Out = &a; //~ ERROR | ---------------- ^^ borrowed value does not live long enough diff --git a/src/test/ui/no_crate_type.rs b/src/test/ui/no_crate_type.rs index 43efdac5e8c74..392c6fd0dfa13 100644 --- a/src/test/ui/no_crate_type.rs +++ b/src/test/ui/no_crate_type.rs @@ -1,5 +1,5 @@ // regression test for issue 11256 -#![crate_type] //~ ERROR `crate_type` requires a value +#![crate_type] //~ ERROR attribute must be of the form fn main() { return diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr index 9d691f3eb54ca..6b76ab68658cd 100644 --- a/src/test/ui/no_crate_type.stderr +++ b/src/test/ui/no_crate_type.stderr @@ -1,10 +1,8 @@ -error: `crate_type` requires a value +error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/no_crate_type.rs:2:1 | -LL | #![crate_type] //~ ERROR `crate_type` requires a value +LL | #![crate_type] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^ - | - = note: for example: `#![crate_type="lib"]` error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index e5e921ca28f95..6843c4bfa998a 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -14,7 +14,8 @@ trait MyFromIterator { fn my_from_iter>(iterator: T) -> Self; } -#[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value +#[rustc_on_unimplemented] +//~^ ERROR attribute must be of the form trait BadAnnotation1 {} diff --git a/src/test/ui/on-unimplemented/bad-annotation.stderr b/src/test/ui/on-unimplemented/bad-annotation.stderr index 70f693253ee08..31b626e0ff4c5 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.stderr +++ b/src/test/ui/on-unimplemented/bad-annotation.stderr @@ -1,25 +1,23 @@ -error[E0232]: `#[rustc_on_unimplemented]` requires a value +error: attribute must be of the form `#[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")]` or `#[rustc_on_unimplemented = "message"]` --> $DIR/bad-annotation.rs:17:1 | -LL | #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value - | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here - | - = note: eg `#[rustc_on_unimplemented(message="foo")]` +LL | #[rustc_on_unimplemented] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0230]: there is no parameter `C` on trait `BadAnnotation2` - --> $DIR/bad-annotation.rs:21:1 + --> $DIR/bad-annotation.rs:22:1 | LL | #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0231]: only named substitution parameters are allowed - --> $DIR/bad-annotation.rs:26:1 + --> $DIR/bad-annotation.rs:27:1 | LL | #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:31:26 + --> $DIR/bad-annotation.rs:32:26 | LL | #[rustc_on_unimplemented(lorem="")] | ^^^^^^^^ expected value here @@ -27,7 +25,7 @@ LL | #[rustc_on_unimplemented(lorem="")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:35:26 + --> $DIR/bad-annotation.rs:36:26 | LL | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] | ^^^^^^^^^^^^^^^^^^^ expected value here @@ -35,7 +33,7 @@ LL | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:39:39 + --> $DIR/bad-annotation.rs:40:39 | LL | #[rustc_on_unimplemented(message="x", message="y")] | ^^^^^^^^^^^ expected value here @@ -43,7 +41,7 @@ LL | #[rustc_on_unimplemented(message="x", message="y")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:43:39 + --> $DIR/bad-annotation.rs:44:39 | LL | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here @@ -51,13 +49,13 @@ LL | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: empty `on`-clause in `#[rustc_on_unimplemented]` - --> $DIR/bad-annotation.rs:47:26 + --> $DIR/bad-annotation.rs:48:26 | LL | #[rustc_on_unimplemented(on(), message="y")] | ^^^^ empty on-clause here error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:51:26 + --> $DIR/bad-annotation.rs:52:26 | LL | #[rustc_on_unimplemented(on="x", message="y")] | ^^^^^^ expected value here @@ -65,7 +63,7 @@ LL | #[rustc_on_unimplemented(on="x", message="y")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:58:40 + --> $DIR/bad-annotation.rs:59:40 | LL | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.rs b/src/test/ui/on-unimplemented/expected-comma-found-token.rs index a4e2a1754f013..d8717f360e9d2 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.rs +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.rs @@ -4,7 +4,7 @@ #![feature(on_unimplemented)] -#[rustc_on_unimplemented( //~ ERROR `#[rustc_on_unimplemented]` requires a value +#[rustc_on_unimplemented( message="the message" label="the label" //~ ERROR expected one of `)` or `,`, found `label` )] diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index aa1b520e01529..1e0808e1d8408 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -6,17 +6,5 @@ LL | message="the message" LL | label="the label" //~ ERROR expected one of `)` or `,`, found `label` | ^^^^^ unexpected token -error[E0232]: `#[rustc_on_unimplemented]` requires a value - --> $DIR/expected-comma-found-token.rs:7:1 - | -LL | / #[rustc_on_unimplemented( //~ ERROR `#[rustc_on_unimplemented]` requires a value -LL | | message="the message" -LL | | label="the label" //~ ERROR expected one of `)` or `,`, found `label` -LL | | )] - | |__^ value required here - | - = note: eg `#[rustc_on_unimplemented(message="foo")]` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0232`. diff --git a/src/test/ui/parser/attr.rs b/src/test/ui/parser/attr.rs index 041f30cd24272..91a4abbd03860 100644 --- a/src/test/ui/parser/attr.rs +++ b/src/test/ui/parser/attr.rs @@ -2,5 +2,6 @@ fn main() {} -#![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +#![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + //~| ERROR definition of an unknown language item: `foo` fn foo() {} diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 44714dc56eef3..8151bd7cdd7b1 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -1,10 +1,17 @@ error: an inner attribute is not permitted in this context --> $DIR/attr.rs:5:3 | -LL | #![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. -error: aborting due to previous error +error[E0522]: definition of an unknown language item: `foo` + --> $DIR/attr.rs:5:1 + | +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + | ^^^^^^^^^^^^^^^^ definition of unknown language item `foo` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0522`. diff --git a/src/test/ui/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs index 736030fca39b7..a0b982d75f519 100644 --- a/src/test/ui/proc-macro/attribute.rs +++ b/src/test/ui/proc-macro/attribute.rs @@ -6,13 +6,13 @@ extern crate proc_macro; #[proc_macro_derive] -//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)] +//~^ ERROR: attribute must be of the form pub fn foo1(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input } #[proc_macro_derive = "foo"] -//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)] +//~^ ERROR: attribute must be of the form pub fn foo2(input: proc_macro::TokenStream) -> proc_macro::TokenStream { input } diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr index a8fecd2d2dea8..c5dc3b8284ba8 100644 --- a/src/test/ui/proc-macro/attribute.stderr +++ b/src/test/ui/proc-macro/attribute.stderr @@ -1,15 +1,3 @@ -error: attribute must be of form: #[proc_macro_derive(TraitName)] - --> $DIR/attribute.rs:8:1 - | -LL | #[proc_macro_derive] - | ^^^^^^^^^^^^^^^^^^^^ - -error: attribute must be of form: #[proc_macro_derive(TraitName)] - --> $DIR/attribute.rs:14:1 - | -LL | #[proc_macro_derive = "foo"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: must only be one word --> $DIR/attribute.rs:21:5 | @@ -46,5 +34,17 @@ error: attribute must have either one or two arguments LL | #[proc_macro_derive(l, attributes(m), n)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: attribute must be of the form `#[proc_macro_derive(TraitName, attributes(name1, name2, ...))]` + --> $DIR/attribute.rs:8:1 + | +LL | #[proc_macro_derive] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_derive(TraitName, attributes(name1, name2, ...))]` + --> $DIR/attribute.rs:14:1 + | +LL | #[proc_macro_derive = "foo"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 8 previous errors diff --git a/src/test/ui/proc-macro/invalid-attributes.rs b/src/test/ui/proc-macro/invalid-attributes.rs index 22ebc77544082..c5ec4925e4310 100644 --- a/src/test/ui/proc-macro/invalid-attributes.rs +++ b/src/test/ui/proc-macro/invalid-attributes.rs @@ -7,20 +7,20 @@ extern crate proc_macro; use proc_macro::TokenStream; -#[proc_macro = "test"] //~ ERROR: does not take any arguments +#[proc_macro = "test"] //~ ERROR attribute must be of the form pub fn a(a: TokenStream) -> TokenStream { a } -#[proc_macro()] //~ ERROR: does not take any arguments +#[proc_macro()] //~ ERROR attribute must be of the form pub fn c(a: TokenStream) -> TokenStream { a } -#[proc_macro(x)] //~ ERROR: does not take any arguments +#[proc_macro(x)] //~ ERROR attribute must be of the form pub fn d(a: TokenStream) -> TokenStream { a } -#[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments +#[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form pub fn e(_: TokenStream, a: TokenStream) -> TokenStream { a } -#[proc_macro_attribute()] //~ ERROR: does not take any arguments +#[proc_macro_attribute()] //~ ERROR attribute must be of the form pub fn g(_: TokenStream, a: TokenStream) -> TokenStream { a } -#[proc_macro_attribute(x)] //~ ERROR: does not take any arguments +#[proc_macro_attribute(x)] //~ ERROR attribute must be of the form pub fn h(_: TokenStream, a: TokenStream) -> TokenStream { a } diff --git a/src/test/ui/proc-macro/invalid-attributes.stderr b/src/test/ui/proc-macro/invalid-attributes.stderr index 31c42bcb07d35..06a7ef2b206c7 100644 --- a/src/test/ui/proc-macro/invalid-attributes.stderr +++ b/src/test/ui/proc-macro/invalid-attributes.stderr @@ -1,37 +1,37 @@ -error: `#[proc_macro]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:10:1 | -LL | #[proc_macro = "test"] //~ ERROR: does not take any arguments +LL | #[proc_macro = "test"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^ -error: `#[proc_macro]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:13:1 | -LL | #[proc_macro()] //~ ERROR: does not take any arguments +LL | #[proc_macro()] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^ -error: `#[proc_macro]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:16:1 | -LL | #[proc_macro(x)] //~ ERROR: does not take any arguments +LL | #[proc_macro(x)] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^ -error: `#[proc_macro_attribute]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:19:1 | -LL | #[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments +LL | #[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[proc_macro_attribute]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:22:1 | -LL | #[proc_macro_attribute()] //~ ERROR: does not take any arguments +LL | #[proc_macro_attribute()] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[proc_macro_attribute]` attribute does not take any arguments +error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:25:1 | -LL | #[proc_macro_attribute(x)] //~ ERROR: does not take any arguments +LL | #[proc_macro_attribute(x)] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/repr.rs b/src/test/ui/repr.rs index a35252c41b8d9..9d844745f4299 100644 --- a/src/test/ui/repr.rs +++ b/src/test/ui/repr.rs @@ -1,15 +1,13 @@ -// compile-pass - #[repr] -//^ WARN `repr` attribute must have a hint +//~^ ERROR attribute must be of the form struct _A {} #[repr = "B"] -//^ WARN `repr` attribute isn't configurable with a literal +//~^ ERROR attribute must be of the form struct _B {} #[repr = "C"] -//^ WARN `repr` attribute isn't configurable with a literal +//~^ ERROR attribute must be of the form struct _C {} #[repr(C)] diff --git a/src/test/ui/repr.stderr b/src/test/ui/repr.stderr index 503d47c36c94a..7ebfe083ddd01 100644 --- a/src/test/ui/repr.stderr +++ b/src/test/ui/repr.stderr @@ -1,25 +1,20 @@ -warning: `repr` attribute must have a hint - --> $DIR/repr.rs:3:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:1:1 | LL | #[repr] - | ^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ -warning: `repr` attribute isn't configurable with a literal - --> $DIR/repr.rs:7:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:5:1 | LL | #[repr = "B"] - | ^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^^^^^^^ -warning: `repr` attribute isn't configurable with a literal - --> $DIR/repr.rs:11:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:9:1 | LL | #[repr = "C"] - | ^^^^^^^^^^^^^ help: give `repr` a hint: `#[repr(C)]` + | ^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs index 27db48998eb26..3375210fc59eb 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs @@ -1,7 +1,7 @@ #![feature(non_exhaustive)] #[non_exhaustive(anything)] -//~^ ERROR attribute should be empty [E0702] +//~^ ERROR attribute must be of the form struct Foo; #[non_exhaustive] diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr index c06999934e888..1d055fe8d4cb8 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -1,11 +1,8 @@ -error[E0702]: attribute should be empty +error: attribute must be of the form `#[non_exhaustive]` --> $DIR/invalid-attribute.rs:3:1 | LL | #[non_exhaustive(anything)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute should be empty [E0702] -LL | struct Foo; - | ----------- not empty error[E0701]: attribute can only be applied to a struct or enum --> $DIR/invalid-attribute.rs:7:1 @@ -30,5 +27,4 @@ LL | | } error: aborting due to 3 previous errors -Some errors occurred: E0701, E0702. -For more information about an error, try `rustc --explain E0701`. +For more information about this error, try `rustc --explain E0701`. diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs index 3c4d629f77fc7..1f0a7a8f8a5e6 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs @@ -1,6 +1,6 @@ // compile-flags:-Zforce-unstable-if-unmarked -#[unstable] //~ ERROR: stability attributes may not be used -#[stable] //~ ERROR: stability attributes may not be used -#[rustc_deprecated] //~ ERROR: stability attributes may not be used +#[unstable()] //~ ERROR: stability attributes may not be used +#[stable()] //~ ERROR: stability attributes may not be used +#[rustc_deprecated()] //~ ERROR: stability attributes may not be used fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index 2b8fb865fbe99..cd8ea921d3036 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -1,20 +1,20 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1 | -LL | #[unstable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^ +LL | #[unstable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1 | -LL | #[stable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^ +LL | #[stable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 | -LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs index 3b223851ce0fa..fc2c2b587fead 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs @@ -1,4 +1,4 @@ -#[unstable] //~ ERROR: stability attributes may not be used -#[stable] //~ ERROR: stability attributes may not be used -#[rustc_deprecated] //~ ERROR: stability attributes may not be used +#[unstable()] //~ ERROR: stability attributes may not be used +#[stable()] //~ ERROR: stability attributes may not be used +#[rustc_deprecated()] //~ ERROR: stability attributes may not be used fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index ad437dd2ebecc..67f6ef857f179 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -1,20 +1,20 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:1:1 | -LL | #[unstable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^ +LL | #[unstable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:2:1 | -LL | #[stable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^ +LL | #[stable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:3:1 | -LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs new file mode 100644 index 0000000000000..3fd54bc02e417 --- /dev/null +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs @@ -0,0 +1,29 @@ +// Various checks that stability attributes are used correctly, per RFC 507 + +#![feature(staged_api)] + +#![stable(feature = "rust1", since = "1.0.0")] + +mod bogus_attribute_types_2 { + #[unstable] //~ ERROR attribute must be of the form + fn f1() { } + + #[unstable = "b"] //~ ERROR attribute must be of the form + fn f2() { } + + #[stable] //~ ERROR attribute must be of the form + fn f3() { } + + #[stable = "a"] //~ ERROR attribute must be of the form + fn f4() { } + + #[stable(feature = "a", since = "b")] + #[rustc_deprecated] //~ ERROR attribute must be of the form + fn f5() { } + + #[stable(feature = "a", since = "b")] + #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form + fn f6() { } +} + +fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr new file mode 100644 index 0000000000000..4b4efe9d8cadd --- /dev/null +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -0,0 +1,38 @@ +error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` + --> $DIR/stability-attribute-sanity-4.rs:8:5 + | +LL | #[unstable] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^ + +error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` + --> $DIR/stability-attribute-sanity-4.rs:11:5 + | +LL | #[unstable = "b"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[stable(feature = "name", since = "version")]` + --> $DIR/stability-attribute-sanity-4.rs:14:5 + | +LL | #[stable] //~ ERROR attribute must be of the form + | ^^^^^^^^^ + +error: attribute must be of the form `#[stable(feature = "name", since = "version")]` + --> $DIR/stability-attribute-sanity-4.rs:17:5 + | +LL | #[stable = "a"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` + --> $DIR/stability-attribute-sanity-4.rs:21:5 + | +LL | #[rustc_deprecated] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` + --> $DIR/stability-attribute-sanity-4.rs:25:5 + | +LL | #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs index cb10df93708d5..aebdb3bdbf571 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs @@ -21,28 +21,6 @@ mod bogus_attribute_types_1 { fn f6() { } } -mod bogus_attribute_types_2 { - #[unstable] //~ ERROR incorrect stability attribute type [E0548] - fn f1() { } - - #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548] - fn f2() { } - - #[stable] //~ ERROR incorrect stability attribute type [E0548] - fn f3() { } - - #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548] - fn f4() { } - - #[stable(feature = "a", since = "b")] - #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548] - fn f5() { } - - #[stable(feature = "a", since = "b")] - #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548] - fn f6() { } -} - mod missing_feature_names { #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] fn f1() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index 14c0728c5c73a..74c1bbfed6f70 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -28,115 +28,79 @@ error[E0539]: incorrect meta item LL | #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539] | ^^^^^^^^^^ -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:25:5 - | -LL | #[unstable] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:28:5 - | -LL | #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:31:5 - | -LL | #[stable] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:34:5 - | -LL | #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:38:5 - | -LL | #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:42:5 - | -LL | #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0546]: missing 'feature' - --> $DIR/stability-attribute-sanity.rs:47:5 + --> $DIR/stability-attribute-sanity.rs:25:5 | LL | #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0547]: missing 'issue' - --> $DIR/stability-attribute-sanity.rs:50:5 + --> $DIR/stability-attribute-sanity.rs:28:5 | LL | #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0546]: missing 'feature' - --> $DIR/stability-attribute-sanity.rs:53:5 + --> $DIR/stability-attribute-sanity.rs:31:5 | LL | #[stable(since = "a")] //~ ERROR missing 'feature' [E0546] | ^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' - --> $DIR/stability-attribute-sanity.rs:58:5 + --> $DIR/stability-attribute-sanity.rs:36:5 | LL | #[stable(feature = "a")] //~ ERROR missing 'since' [E0542] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' - --> $DIR/stability-attribute-sanity.rs:62:5 + --> $DIR/stability-attribute-sanity.rs:40:5 | LL | #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:67:1 + --> $DIR/stability-attribute-sanity.rs:45:1 | LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:71:1 + --> $DIR/stability-attribute-sanity.rs:49:1 | LL | #[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:75:1 + --> $DIR/stability-attribute-sanity.rs:53:1 | LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0540]: multiple rustc_deprecated attributes - --> $DIR/stability-attribute-sanity.rs:83:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0553]: multiple rustc_const_unstable attributes - --> $DIR/stability-attribute-sanity.rs:83:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Invalid stability or deprecation version found - --> $DIR/stability-attribute-sanity.rs:83:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute - --> $DIR/stability-attribute-sanity.rs:88:1 + --> $DIR/stability-attribute-sanity.rs:66:1 | LL | fn deprecated_without_unstable_or_stable() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 23 previous errors +error: aborting due to 17 previous errors -Some errors occurred: E0539, E0540, E0541, E0542, E0544, E0546, E0547, E0548, E0549... +Some errors occurred: E0539, E0540, E0541, E0542, E0544, E0546, E0547, E0549, E0553. For more information about an error, try `rustc --explain E0539`. diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs index a311b65a63b05..bd2d6623d9104 100644 --- a/src/test/ui/suffixed-literal-meta.rs +++ b/src/test/ui/suffixed-literal-meta.rs @@ -1,13 +1,15 @@ -#[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes +#![feature(custom_attribute)] + +#[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes fn main() { } diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index 2f3ad8a1aedce..265aa78d53f12 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -1,96 +1,96 @@ error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:1:10 + --> $DIR/suffixed-literal-meta.rs:3:13 | -LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:2:10 + --> $DIR/suffixed-literal-meta.rs:4:13 | -LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^ +LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:3:10 + --> $DIR/suffixed-literal-meta.rs:5:13 | -LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:4:10 + --> $DIR/suffixed-literal-meta.rs:6:13 | -LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:5:10 + --> $DIR/suffixed-literal-meta.rs:7:13 | -LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:6:10 + --> $DIR/suffixed-literal-meta.rs:8:13 | -LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:7:10 + --> $DIR/suffixed-literal-meta.rs:9:13 | -LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^ +LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:8:10 + --> $DIR/suffixed-literal-meta.rs:10:13 | -LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:9:10 + --> $DIR/suffixed-literal-meta.rs:11:13 | -LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:10:10 + --> $DIR/suffixed-literal-meta.rs:12:13 | -LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:11:10 + --> $DIR/suffixed-literal-meta.rs:13:13 | -LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:12:10 + --> $DIR/suffixed-literal-meta.rs:14:13 | -LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). diff --git a/src/test/ui/target-feature-wrong.stderr b/src/test/ui/target-feature-wrong.stderr index 2eeaa10748c76..236f5c4afec39 100644 --- a/src/test/ui/target-feature-wrong.stderr +++ b/src/test/ui/target-feature-wrong.stderr @@ -1,4 +1,4 @@ -error: #[target_feature] attribute must be of the form #[target_feature(..)] +error: attribute must be of the form `#[target_feature(enable = "name")]` --> $DIR/target-feature-wrong.rs:16:1 | LL | #[target_feature = "+sse2"] diff --git a/src/test/ui/test-should-panic-attr.rs b/src/test/ui/test-should-panic-attr.rs index 1b5afdaa89b6c..f936dd5758747 100644 --- a/src/test/ui/test-should-panic-attr.rs +++ b/src/test/ui/test-should-panic-attr.rs @@ -1,9 +1,8 @@ -// run-pass +// compile-pass // compile-flags: --test #[test] #[should_panic = "foo"] -//~^ WARN: attribute must be of the form: fn test1() { panic!(); } diff --git a/src/test/ui/test-should-panic-attr.stderr b/src/test/ui/test-should-panic-attr.stderr index 0f25477e53f1a..4b032eba5f8d5 100644 --- a/src/test/ui/test-should-panic-attr.stderr +++ b/src/test/ui/test-should-panic-attr.stderr @@ -1,13 +1,5 @@ -warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]` - --> $DIR/test-should-panic-attr.rs:5:1 - | -LL | #[should_panic = "foo"] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. - warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:12:1 + --> $DIR/test-should-panic-attr.rs:11:1 | LL | #[should_panic(expected)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +7,7 @@ LL | #[should_panic(expected)] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:19:1 + --> $DIR/test-should-panic-attr.rs:18:1 | LL | #[should_panic(expect)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +15,7 @@ LL | #[should_panic(expect)] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:26:1 + --> $DIR/test-should-panic-attr.rs:25:1 | LL | #[should_panic(expected(foo, bar))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +23,7 @@ LL | #[should_panic(expected(foo, bar))] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:33:1 + --> $DIR/test-should-panic-attr.rs:32:1 | LL | #[should_panic(expected = "foo", bar)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From d3411d3ee8a350e2b8ec202a4a493e69c827245c Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 12 Jan 2019 19:00:42 +0300 Subject: [PATCH 2/2] Address review comments --- src/librustc_lint/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 15 +++++++++++---- .../issue-43106-gating-of-inline.stderr | 2 +- .../ui/malformed/malformed-regressions.stderr | 10 +++++----- src/test/ui/proc-macro/attribute.stderr | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 743287096202a..b644cafe4ecdd 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -338,7 +338,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { }, FutureIncompatibleInfo { id: LintId::of(ILL_FORMED_ATTRIBUTE_INPUT), - reference: "issue #57321 ", + reference: "issue #57571 ", edition: None, }, ]); diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index a483e35a5b516..09fdf2d661838 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -717,6 +717,8 @@ pub enum AttributeGate { Ungated, } +/// A template that the attribute input must match. +/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now. #[derive(Clone, Copy)] pub struct AttributeTemplate { word: bool, @@ -725,6 +727,7 @@ pub struct AttributeTemplate { } impl AttributeTemplate { + /// Check that the given meta-item is compatible with this template. fn compatible(&self, meta_item_kind: &ast::MetaItemKind) -> bool { match meta_item_kind { ast::MetaItemKind::Word => self.word, @@ -735,10 +738,10 @@ impl AttributeTemplate { } } +/// A convenience macro for constructing attribute templates. +/// E.g. `template!(Word, List: "description")` means that the attribute +/// supports forms `#[attr]` and `#[attr(description)]`. macro_rules! template { - (@ $word: expr, $list: expr, $name_value_str: expr) => { AttributeTemplate { - word: $word, list: $list, name_value_str: $name_value_str - } }; (Word) => { template!(@ true, None, None) }; (List: $descr: expr) => { template!(@ false, Some($descr), None) }; (NameValueStr: $descr: expr) => { template!(@ false, None, Some($descr)) }; @@ -750,6 +753,9 @@ macro_rules! template { (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => { template!(@ true, Some($descr1), Some($descr2)) }; + (@ $word: expr, $list: expr, $name_value_str: expr) => { AttributeTemplate { + word: $word, list: $list, name_value_str: $name_value_str + } }; } impl AttributeGate { @@ -1084,7 +1090,8 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeTemplate, Attribu is an experimental feature", cfg_fn!(fundamental))), - ("proc_macro_derive", Normal, template!(List: "TraitName, attributes(name1, name2, ...)"), + ("proc_macro_derive", Normal, template!(List: "TraitName, \ + /*opt*/ attributes(name1, name2, ...)"), Ungated), ("rustc_copy_clone_marker", Whitelisted, template!(Word), Gated(Stability::Unstable, diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 485ff11eea7bf..71e8f11ff078d 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -6,7 +6,7 @@ LL | #[inline = "2100"] fn f() { } | = note: #[warn(ill_formed_attribute_input)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43106-gating-of-inline.rs:11:1 diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr index f8dbfc04f1056..a3b2bda07f625 100644 --- a/src/test/ui/malformed/malformed-regressions.stderr +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -6,7 +6,7 @@ LL | #[doc] //~ WARN attribute must be of the form | = note: #[warn(ill_formed_attribute_input)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]` --> $DIR/malformed-regressions.rs:4:1 @@ -15,7 +15,7 @@ LL | #[ignore()] //~ WARN attribute must be of the form | ^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` --> $DIR/malformed-regressions.rs:5:1 @@ -24,7 +24,7 @@ LL | #[inline = ""] //~ WARN attribute must be of the form | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]` @@ -34,7 +34,7 @@ LL | #[link] //~ WARN attribute must be of the form | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ cfg = "...")]` @@ -44,5 +44,5 @@ LL | #[link = ""] //~ WARN attribute must be of the form | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57321 + = note: for more information, see issue #57571 diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr index c5dc3b8284ba8..231eb1f106898 100644 --- a/src/test/ui/proc-macro/attribute.stderr +++ b/src/test/ui/proc-macro/attribute.stderr @@ -34,13 +34,13 @@ error: attribute must have either one or two arguments LL | #[proc_macro_derive(l, attributes(m), n)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: attribute must be of the form `#[proc_macro_derive(TraitName, attributes(name1, name2, ...))]` +error: attribute must be of the form `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` --> $DIR/attribute.rs:8:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ -error: attribute must be of the form `#[proc_macro_derive(TraitName, attributes(name1, name2, ...))]` +error: attribute must be of the form `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` --> $DIR/attribute.rs:14:1 | LL | #[proc_macro_derive = "foo"]