Add link to docs on malformed attributes

This commit is contained in:
Esteban Küber
2025-08-11 04:21:09 +00:00
parent 189f264926
commit 625143bac3
23 changed files with 344 additions and 87 deletions

View File

@@ -127,6 +127,8 @@ pub struct AttributeTemplate {
/// If `Some`, the attribute is allowed to be a name/value pair where the /// If `Some`, the attribute is allowed to be a name/value pair where the
/// value is a string, like `#[must_use = "reason"]`. /// value is a string, like `#[must_use = "reason"]`.
pub name_value_str: Option<&'static [&'static str]>, pub name_value_str: Option<&'static [&'static str]>,
/// A link to the document for this attribute.
pub docs: Option<&'static str>,
} }
impl AttributeTemplate { impl AttributeTemplate {
@@ -209,21 +211,33 @@ pub enum AttributeDuplicates {
/// supports forms `#[attr]` and `#[attr(description)]`. /// supports forms `#[attr]` and `#[attr(description)]`.
#[macro_export] #[macro_export]
macro_rules! template { macro_rules! template {
(Word) => { $crate::template!(@ true, None, &[], None) }; (Word) => { $crate::template!(@ true, None, &[], None, None) };
(List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None) }; (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
(OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None) }; (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
(NameValueStr: $descr: expr) => { $crate::template!(@ false, None, &[], Some(&[$descr])) }; (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
(OneOfNameValueStr: $descr: expr) => { $crate::template!(@ false, None, &[], Some($descr)) }; (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
(Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None) }; (NameValueStr: $descr: expr) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
(Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr])) }; (NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
(OneOfNameValueStr: $descr: expr) => { $crate::template!(@ false, None, &[], Some($descr), None) };
(OneOfNameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ false, None, &[], Some($descr), Some($link)) };
(Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
(Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
(Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
(Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
(List: $descr1: expr, NameValueStr: $descr2: expr) => { (List: $descr1: expr, NameValueStr: $descr2: expr) => {
$crate::template!(@ false, Some($descr1), &[], Some(&[$descr2])) $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
};
(List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
$crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
}; };
(Word, List: $descr1: expr, NameValueStr: $descr2: expr) => { (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
$crate::template!(@ true, Some($descr1), &[], Some(&[$descr2])) $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
}; };
(@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr) => { $crate::AttributeTemplate { (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
};
(@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
} }; } };
} }
@@ -396,18 +410,42 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// ========================================================================== // ==========================================================================
// Conditional compilation: // Conditional compilation:
ungated!(cfg, Normal, template!(List: &["predicate"]), DuplicatesOk, EncodeCrossCrate::Yes), ungated!(
ungated!(cfg_attr, Normal, template!(List: &["predicate, attr1, attr2, ..."]), DuplicatesOk, EncodeCrossCrate::Yes), cfg, Normal,
template!(
List: &["predicate"],
"https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute"
),
DuplicatesOk, EncodeCrossCrate::Yes
),
ungated!(
cfg_attr, Normal,
template!(
List: &["predicate, attr1, attr2, ..."],
"https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute"
),
DuplicatesOk, EncodeCrossCrate::Yes
),
// Testing: // Testing:
ungated!( ungated!(
ignore, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing, ignore, Normal,
EncodeCrossCrate::No, template!(
Word,
NameValueStr: "reason",
"https://doc.rust-lang.org/reference/attributes/testing.html#the-ignore-attribute"
),
WarnFollowing, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
should_panic, Normal, should_panic, Normal,
template!(Word, List: &[r#"expected = "reason""#], NameValueStr: "reason"), FutureWarnFollowing, template!(
EncodeCrossCrate::No, Word,
List: &[r#"expected = "reason""#],
NameValueStr: "reason",
"https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute"
),
FutureWarnFollowing, EncodeCrossCrate::No,
), ),
// FIXME(Centril): This can be used on stable but shouldn't. // FIXME(Centril): This can be used on stable but shouldn't.
ungated!( ungated!(
@@ -416,46 +454,102 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
), ),
// Macros: // Macros:
ungated!(automatically_derived, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes),
ungated!( ungated!(
macro_use, Normal, template!(Word, List: &["name1, name2, ..."]), WarnFollowingWordOnly, automatically_derived, Normal,
EncodeCrossCrate::No, template!(
Word,
"https://doc.rust-lang.org/reference/attributes/derive.html#the-automatically_derived-attribute"
),
WarnFollowing, EncodeCrossCrate::Yes
),
ungated!(
macro_use, Normal,
template!(
Word,
List: &["name1, name2, ..."],
"https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute"
),
WarnFollowingWordOnly, EncodeCrossCrate::No,
), ),
ungated!(macro_escape, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), // Deprecated synonym for `macro_use`. ungated!(macro_escape, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), // Deprecated synonym for `macro_use`.
ungated!( ungated!(
macro_export, Normal, template!(Word, List: &["local_inner_macros"]), macro_export, Normal,
template!(
Word,
List: &["local_inner_macros"],
"https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope"
),
WarnFollowing, EncodeCrossCrate::Yes WarnFollowing, EncodeCrossCrate::Yes
), ),
ungated!(proc_macro, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::No),
ungated!( ungated!(
proc_macro_derive, Normal, template!(List: &["TraitName", "TraitName, attributes(name1, name2, ...)"]), proc_macro, Normal,
template!(
Word,
"https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros"),
ErrorFollowing, EncodeCrossCrate::No
),
ungated!(
proc_macro_derive, Normal,
template!(
List: &["TraitName", "TraitName, attributes(name1, name2, ...)"],
"https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
),
ErrorFollowing, EncodeCrossCrate::No, ErrorFollowing, EncodeCrossCrate::No,
), ),
ungated!(proc_macro_attribute, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::No), ungated!(
proc_macro_attribute, Normal,
template!(Word, "https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros"),
ErrorFollowing, EncodeCrossCrate::No
),
// Lints: // Lints:
ungated!( ungated!(
warn, Normal, template!(List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#]), warn, Normal,
template!(
List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
),
DuplicatesOk, EncodeCrossCrate::No, DuplicatesOk, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
allow, Normal, template!(List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#]), allow, Normal,
template!(
List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
),
DuplicatesOk, EncodeCrossCrate::No, DuplicatesOk, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
expect, Normal, template!(List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#]), expect, Normal,
template!(
List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
),
DuplicatesOk, EncodeCrossCrate::No, DuplicatesOk, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
forbid, Normal, template!(List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#]), forbid, Normal,
template!(
List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
),
DuplicatesOk, EncodeCrossCrate::No DuplicatesOk, EncodeCrossCrate::No
), ),
ungated!( ungated!(
deny, Normal, template!(List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#]), deny, Normal,
template!(
List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
),
DuplicatesOk, EncodeCrossCrate::No DuplicatesOk, EncodeCrossCrate::No
), ),
ungated!( ungated!(
must_use, Normal, template!(Word, NameValueStr: "reason"), must_use, Normal,
template!(
Word,
NameValueStr: "reason",
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"
),
FutureWarnFollowing, EncodeCrossCrate::Yes FutureWarnFollowing, EncodeCrossCrate::Yes
), ),
gated!( gated!(
@@ -467,19 +561,28 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
template!( template!(
Word, Word,
List: &[r#"/*opt*/ since = "version", /*opt*/ note = "reason""#], List: &[r#"/*opt*/ since = "version", /*opt*/ note = "reason""#],
NameValueStr: "reason" NameValueStr: "reason",
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"
), ),
ErrorFollowing, EncodeCrossCrate::Yes ErrorFollowing, EncodeCrossCrate::Yes
), ),
// Crate properties: // Crate properties:
ungated!( ungated!(
crate_name, CrateLevel, template!(NameValueStr: "name"), FutureWarnFollowing, crate_name, CrateLevel,
EncodeCrossCrate::No, template!(
NameValueStr: "name",
"https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute"
),
FutureWarnFollowing, EncodeCrossCrate::No,
), ),
ungated!( ungated!(
crate_type, CrateLevel, template!(OneOfNameValueStr: &["bin", "lib", "dylib", "cdylib", "rlib", "staticlib", "sdylib", "proc-macro"]), DuplicatesOk, crate_type, CrateLevel,
EncodeCrossCrate::No, template!(
OneOfNameValueStr: &["bin", "lib", "dylib", "cdylib", "rlib", "staticlib", "sdylib", "proc-macro"],
"https://doc.rust-lang.org/reference/linkage.html"
),
DuplicatesOk, EncodeCrossCrate::No,
), ),
// ABI, linking, symbols, and FFI // ABI, linking, symbols, and FFI
@@ -491,33 +594,67 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
r#"name = "...", wasm_import_module = "...""#, r#"name = "...", wasm_import_module = "...""#,
r#"name = "...", import_name_type = "decorated|noprefix|undecorated""#, r#"name = "...", import_name_type = "decorated|noprefix|undecorated""#,
r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#, r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#,
]), ], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute"),
DuplicatesOk, DuplicatesOk, EncodeCrossCrate::No,
EncodeCrossCrate::No,
), ),
ungated!( ungated!(
link_name, Normal, template!(NameValueStr: "name"), link_name, Normal,
template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"),
FutureWarnPreceding, EncodeCrossCrate::Yes FutureWarnPreceding, EncodeCrossCrate::Yes
), ),
ungated!(no_link, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), ungated!(
ungated!(repr, Normal, template!(List: &["C"]), DuplicatesOk, EncodeCrossCrate::No), no_link, Normal,
template!(Word, "https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
repr, Normal,
template!(List: &["C"], "https://doc.rust-lang.org/reference/type-layout.html#representations"),
DuplicatesOk, EncodeCrossCrate::No
),
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
gated!(rustc_align, Normal, template!(List: &["alignment"]), DuplicatesOk, EncodeCrossCrate::No, fn_align, experimental!(rustc_align)), gated!(rustc_align, Normal, template!(List: &["alignment"]), DuplicatesOk, EncodeCrossCrate::No, fn_align, experimental!(rustc_align)),
ungated!(unsafe(Edition2024) export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding, EncodeCrossCrate::No), ungated!(
ungated!(unsafe(Edition2024) link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding, EncodeCrossCrate::No), unsafe(Edition2024) export_name, Normal,
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute"),
ungated!(used, Normal, template!(Word, List: &["compiler", "linker"]), WarnFollowing, EncodeCrossCrate::No), FutureWarnPreceding, EncodeCrossCrate::No
ungated!(link_ordinal, Normal, template!(List: &["ordinal"]), ErrorPreceding, EncodeCrossCrate::Yes), ),
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), ungated!(
unsafe(Edition2024) link_section, Normal,
template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"),
FutureWarnPreceding, EncodeCrossCrate::No
),
ungated!(
unsafe(Edition2024) no_mangle, Normal,
template!(Word, "https://doc.rust-lang.org/reference/abi.html#the-no_mangle-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
used, Normal,
template!(Word, List: &["compiler", "linker"], "https://doc.rust-lang.org/reference/abi.html#the-used-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
link_ordinal, Normal,
template!(List: &["ordinal"], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"),
ErrorPreceding, EncodeCrossCrate::Yes
),
ungated!(
unsafe naked, Normal,
template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-naked-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
// Limits: // Limits:
ungated!( ungated!(
recursion_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing, recursion_limit, CrateLevel,
EncodeCrossCrate::No template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute"),
FutureWarnFollowing, EncodeCrossCrate::No
), ),
ungated!( ungated!(
type_length_limit, CrateLevel, template!(NameValueStr: "N"), FutureWarnFollowing, type_length_limit, CrateLevel,
EncodeCrossCrate::No template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-type_length_limit-attribute"),
FutureWarnFollowing, EncodeCrossCrate::No
), ),
gated!( gated!(
move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing, move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing,
@@ -525,32 +662,81 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
), ),
// Entry point: // Entry point:
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No), ungated!(
no_main, CrateLevel,
template!(Word, "https://doc.rust-lang.org/reference/crates-and-source-files.html#the-no_main-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
// Modules, prelude, and resolution: // Modules, prelude, and resolution:
ungated!(path, Normal, template!(NameValueStr: "file"), FutureWarnFollowing, EncodeCrossCrate::No), ungated!(
ungated!(no_std, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No), path, Normal,
ungated!(no_implicit_prelude, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), template!(NameValueStr: "file", "https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute"),
ungated!(non_exhaustive, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes), FutureWarnFollowing, EncodeCrossCrate::No
),
ungated!(
no_std, CrateLevel,
template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
no_implicit_prelude, Normal,
template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_implicit_prelude-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
non_exhaustive, Normal,
template!(Word, "https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute"),
WarnFollowing, EncodeCrossCrate::Yes
),
// Runtime // Runtime
ungated!( ungated!(
windows_subsystem, CrateLevel, windows_subsystem, CrateLevel,
template!(OneOfNameValueStr: &["windows", "console"]), FutureWarnFollowing, template!(OneOfNameValueStr: &["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute"),
EncodeCrossCrate::No FutureWarnFollowing, EncodeCrossCrate::No
),
ungated!( // RFC 2070
panic_handler, Normal,
template!(Word, "https://doc.rust-lang.org/reference/panic.html#the-panic_handler-attribute"),
WarnFollowing, EncodeCrossCrate::Yes
), ),
ungated!(panic_handler, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes), // RFC 2070
// Code generation: // Code generation:
ungated!(inline, Normal, template!(Word, List: &["always", "never"]), FutureWarnFollowing, EncodeCrossCrate::No),
ungated!(cold, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
ungated!(no_builtins, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::Yes),
ungated!( ungated!(
target_feature, Normal, template!(List: &[r#"enable = "name""#]), inline, Normal,
template!(
Word,
List: &["always", "never"],
"https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute"
),
FutureWarnFollowing, EncodeCrossCrate::No
),
ungated!(
cold, Normal,
template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-cold-attribute"),
WarnFollowing, EncodeCrossCrate::No
),
ungated!(
no_builtins, CrateLevel,
template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-no_builtins-attribute"),
WarnFollowing, EncodeCrossCrate::Yes
),
ungated!(
target_feature, Normal,
template!(List: &[r#"enable = "name""#], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-target_feature-attribute"),
DuplicatesOk, EncodeCrossCrate::No, DuplicatesOk, EncodeCrossCrate::No,
), ),
ungated!(track_caller, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes), ungated!(
ungated!(instruction_set, Normal, template!(List: &["set"]), ErrorPreceding, EncodeCrossCrate::No), track_caller, Normal,
template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute"),
WarnFollowing, EncodeCrossCrate::Yes
),
ungated!(
instruction_set, Normal,
template!(List: &["set"], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute"),
ErrorPreceding, EncodeCrossCrate::No
),
gated!( gated!(
no_sanitize, Normal, no_sanitize, Normal,
template!(List: &["address, kcfi, memory, thread"]), DuplicatesOk, template!(List: &["address, kcfi, memory, thread"]), DuplicatesOk,
@@ -563,18 +749,31 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
), ),
ungated!( ungated!(
doc, Normal, template!(List: &["hidden", "inline"], NameValueStr: "string"), DuplicatesOk, doc, Normal,
EncodeCrossCrate::Yes template!(
List: &["hidden", "inline"],
NameValueStr: "string",
"https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html"
),
DuplicatesOk, EncodeCrossCrate::Yes
), ),
// Debugging // Debugging
ungated!( ungated!(
debugger_visualizer, Normal, debugger_visualizer, Normal,
template!(List: &[r#"natvis_file = "...", gdb_script_file = "...""#]), template!(
List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
"https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
),
DuplicatesOk, EncodeCrossCrate::No DuplicatesOk, EncodeCrossCrate::No
), ),
ungated!(collapse_debuginfo, Normal, template!(List: &["no", "external", "yes"]), ErrorFollowing, ungated!(
EncodeCrossCrate::Yes collapse_debuginfo, Normal,
template!(
List: &["no", "external", "yes"],
"https://doc.rust-lang.org/reference/attributes/debugger.html#the-collapse_debuginfo-attribute"
),
ErrorFollowing, EncodeCrossCrate::Yes
), ),
// ========================================================================== // ==========================================================================
@@ -835,7 +1034,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
"linkonce_odr", "linkonce_odr",
"weak", "weak",
"weak_odr", "weak_odr",
]), ], "https://doc.rust-lang.org/reference/linkage.html"),
ErrorPreceding, EncodeCrossCrate::No, ErrorPreceding, EncodeCrossCrate::No,
"the `linkage` attribute is experimental and not portable across platforms", "the `linkage` attribute is experimental and not portable across platforms",
), ),

View File

@@ -349,6 +349,7 @@ lint_ill_formed_attribute_input = {$num_suggestions ->
[1] attribute must be of the form {$suggestions} [1] attribute must be of the form {$suggestions}
*[other] valid forms for the attribute are {$suggestions} *[other] valid forms for the attribute are {$suggestions}
} }
.note = for more information, visit <{$docs}>
lint_impl_trait_overcaptures = `{$self_ty}` will capture more lifetimes than possibly intended in edition 2024 lint_impl_trait_overcaptures = `{$self_ty}` will capture more lifetimes than possibly intended in edition 2024
.note = specifically, {$num_captured -> .note = specifically, {$num_captured ->

View File

@@ -447,12 +447,14 @@ pub fn decorate_builtin_lint(
BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => { BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => {
lints::UnusedCrateDependency { extern_crate, local_crate }.decorate_lint(diag) lints::UnusedCrateDependency { extern_crate, local_crate }.decorate_lint(diag)
} }
BuiltinLintDiag::IllFormedAttributeInput { suggestions } => { BuiltinLintDiag::IllFormedAttributeInput { suggestions, docs } => {
lints::IllFormedAttributeInput { lints::IllFormedAttributeInput {
num_suggestions: suggestions.len(), num_suggestions: suggestions.len(),
suggestions: DiagArgValue::StrListSepByAnd( suggestions: DiagArgValue::StrListSepByAnd(
suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(),
), ),
has_docs: docs.is_some(),
docs: docs.unwrap_or(""),
} }
.decorate_lint(diag) .decorate_lint(diag)
} }

View File

@@ -2685,6 +2685,9 @@ pub(crate) struct UnusedCrateDependency {
pub(crate) struct IllFormedAttributeInput { pub(crate) struct IllFormedAttributeInput {
pub num_suggestions: usize, pub num_suggestions: usize,
pub suggestions: DiagArgValue, pub suggestions: DiagArgValue,
#[note]
pub has_docs: bool,
pub docs: &'static str,
} }
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]

View File

@@ -793,6 +793,7 @@ pub enum BuiltinLintDiag {
}, },
IllFormedAttributeInput { IllFormedAttributeInput {
suggestions: Vec<String>, suggestions: Vec<String>,
docs: Option<&'static str>,
}, },
InnerAttributeUnstable { InnerAttributeUnstable {
is_macro: bool, is_macro: bool,

View File

@@ -313,24 +313,27 @@ fn emit_malformed_attribute(
ILL_FORMED_ATTRIBUTE_INPUT, ILL_FORMED_ATTRIBUTE_INPUT,
span, span,
ast::CRATE_NODE_ID, ast::CRATE_NODE_ID,
BuiltinLintDiag::IllFormedAttributeInput { suggestions: suggestions.clone() }, BuiltinLintDiag::IllFormedAttributeInput {
suggestions: suggestions.clone(),
docs: template.docs,
},
); );
} else { } else {
suggestions.sort(); suggestions.sort();
psess let mut err = psess.dcx().struct_span_err(span, error_msg).with_span_suggestions(
.dcx() span,
.struct_span_err(span, error_msg) if suggestions.len() == 1 {
.with_span_suggestions( "must be of the form"
span, } else {
if suggestions.len() == 1 { "the following are the possible correct uses"
"must be of the form" },
} else { suggestions,
"the following are the possible correct uses" Applicability::HasPlaceholders,
}, );
suggestions, if let Some(link) = template.docs {
Applicability::HasPlaceholders, err.note(format!("for more information, visit <{link}>"));
) }
.emit(); err.emit();
} }
} }

View File

@@ -3,6 +3,8 @@ error: malformed `crate_name` attribute input
| |
LL | #![crate_name = concat!("my", "crate")] LL | #![crate_name = concat!("my", "crate")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -4,6 +4,7 @@ error: malformed `crate_type` attribute input
LL | #![crate_type(lib)] LL | #![crate_type(lib)]
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL - #![crate_type(lib)] LL - #![crate_type(lib)]

View File

@@ -4,6 +4,7 @@ error: malformed `crate_type` attribute input
LL | #![crate_type] LL | #![crate_type]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #![crate_type = "bin"] LL | #![crate_type = "bin"]

View File

@@ -4,6 +4,7 @@ error: malformed `crate_type` attribute input
LL | #![crate_type = foo!()] LL | #![crate_type = foo!()]
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL - #![crate_type = foo!()] LL - #![crate_type = foo!()]

View File

@@ -31,6 +31,7 @@ error: malformed `windows_subsystem` attribute input
LL | #![windows_subsystem] LL | #![windows_subsystem]
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #![windows_subsystem = "console"] LL | #![windows_subsystem = "console"]
@@ -43,6 +44,8 @@ error: malformed `crate_name` attribute input
| |
LL | #[crate_name] LL | #[crate_name]
| ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]` | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: malformed `no_sanitize` attribute input error: malformed `no_sanitize` attribute input
--> $DIR/malformed-attrs.rs:89:1 --> $DIR/malformed-attrs.rs:89:1
@@ -55,6 +58,8 @@ error: malformed `instruction_set` attribute input
| |
LL | #[instruction_set] LL | #[instruction_set]
| ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]` | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
error: malformed `patchable_function_entry` attribute input error: malformed `patchable_function_entry` attribute input
--> $DIR/malformed-attrs.rs:105:1 --> $DIR/malformed-attrs.rs:105:1
@@ -89,6 +94,7 @@ error: malformed `linkage` attribute input
LL | #[linkage] LL | #[linkage]
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[linkage = "available_externally"] LL | #[linkage = "available_externally"]
@@ -107,6 +113,7 @@ error: malformed `allow` attribute input
LL | #[allow] LL | #[allow]
| ^^^^^^^^ | ^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[allow(lint1)] LL | #[allow(lint1)]
@@ -122,6 +129,7 @@ error: malformed `expect` attribute input
LL | #[expect] LL | #[expect]
| ^^^^^^^^^ | ^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[expect(lint1)] LL | #[expect(lint1)]
@@ -137,6 +145,7 @@ error: malformed `warn` attribute input
LL | #[warn] LL | #[warn]
| ^^^^^^^ | ^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[warn(lint1)] LL | #[warn(lint1)]
@@ -152,6 +161,7 @@ error: malformed `deny` attribute input
LL | #[deny] LL | #[deny]
| ^^^^^^^ | ^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[deny(lint1)] LL | #[deny(lint1)]
@@ -167,6 +177,7 @@ error: malformed `forbid` attribute input
LL | #[forbid] LL | #[forbid]
| ^^^^^^^^^ | ^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL | #[forbid(lint1)] LL | #[forbid(lint1)]
@@ -181,6 +192,8 @@ error: malformed `debugger_visualizer` attribute input
| |
LL | #[debugger_visualizer] LL | #[debugger_visualizer]
| ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]` | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
error: malformed `thread_local` attribute input error: malformed `thread_local` attribute input
--> $DIR/malformed-attrs.rs:200:1 --> $DIR/malformed-attrs.rs:200:1
@@ -193,6 +206,8 @@ error: malformed `no_link` attribute input
| |
LL | #[no_link()] LL | #[no_link()]
| ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute>
error: malformed `macro_export` attribute input error: malformed `macro_export` attribute input
--> $DIR/malformed-attrs.rs:211:1 --> $DIR/malformed-attrs.rs:211:1
@@ -200,6 +215,7 @@ error: malformed `macro_export` attribute input
LL | #[macro_export = 18] LL | #[macro_export = 18]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL - #[macro_export = 18] LL - #[macro_export = 18]
@@ -250,6 +266,7 @@ LL | #[doc]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` on by default = note: `#[deny(ill_formed_attribute_input)]` on by default
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]` error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
@@ -260,6 +277,7 @@ LL | #[doc]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
--> $DIR/malformed-attrs.rs:80:1 --> $DIR/malformed-attrs.rs:80:1
@@ -269,6 +287,7 @@ LL | #[link]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
error: invalid argument error: invalid argument
--> $DIR/malformed-attrs.rs:185:1 --> $DIR/malformed-attrs.rs:185:1

View File

@@ -3,6 +3,8 @@ error: malformed `crate_name` attribute input
| |
LL | #![crate_name = concat!("wrapped")] LL | #![crate_name = concat!("wrapped")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `crate_name` attribute input
| |
LL | #![crate_name] LL | #![crate_name]
| ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `crate_name` attribute input
| |
LL | #![crate_name = concat!("this_one_is_not")] LL | #![crate_name = concat!("this_one_is_not")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `crate_name` attribute input
| |
LL | #![crate_name = concat!("wrapped")] LL | #![crate_name = concat!("wrapped")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -6,6 +6,7 @@ LL | #[link]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
= note: `#[deny(ill_formed_attribute_input)]` on by default = note: `#[deny(ill_formed_attribute_input)]` on by default
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
@@ -16,6 +17,7 @@ LL | #[link = "foo"]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@@ -18,6 +18,7 @@ error: malformed `deny` attribute input
LL | #![deny = "foo"] LL | #![deny = "foo"]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
help: the following are the possible correct uses help: the following are the possible correct uses
| |
LL - #![deny = "foo"] LL - #![deny = "foo"]

View File

@@ -6,6 +6,7 @@ LL | #[doc]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
= note: `#[deny(ill_formed_attribute_input)]` on by default = note: `#[deny(ill_formed_attribute_input)]` on by default
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
@@ -16,6 +17,7 @@ LL | #[link]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]` error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
--> $DIR/malformed-regressions.rs:9:1 --> $DIR/malformed-regressions.rs:9:1
@@ -25,6 +27,7 @@ LL | #[link = ""]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = 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 #57571 <https://github.com/rust-lang/rust/issues/57571> = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-regressions.rs:3:1 --> $DIR/malformed-regressions.rs:3:1

View File

@@ -3,6 +3,8 @@ error: malformed `path` attribute input
| |
LL | #[path = 123] LL | #[path = 123]
| ^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]` | ^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `path` attribute input
| |
LL | #[path = foo!()] LL | #[path = foo!()]
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]` | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `recursion_limit` attribute input
| |
LL | #![recursion_limit = 123] LL | #![recursion_limit = 123]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `recursion_limit` attribute input
| |
LL | #![recursion_limit = foo!()] LL | #![recursion_limit = foo!()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@@ -3,6 +3,8 @@ error: malformed `recursion_limit` attribute input
| |
LL | #![recursion_limit] LL | #![recursion_limit]
| ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]` | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![recursion_limit = "N"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute>
error: aborting due to 1 previous error error: aborting due to 1 previous error