Add more docs to templates for attrs with incorrect arguments
This commit is contained in:
@@ -16,7 +16,10 @@ use crate::{
|
||||
CfgMatchesLintEmitter, fluent_generated, parse_version, session_diagnostics, try_gate_cfg,
|
||||
};
|
||||
|
||||
pub const CFG_TEMPLATE: AttributeTemplate = template!(List: &["predicate"]);
|
||||
pub const CFG_TEMPLATE: AttributeTemplate = template!(
|
||||
List: &["predicate"],
|
||||
"https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute"
|
||||
);
|
||||
|
||||
pub fn parse_cfg_attr<'c, S: Stage>(
|
||||
cx: &'c mut AcceptContext<'_, '_, S>,
|
||||
|
||||
@@ -18,7 +18,11 @@ impl<S: Stage> SingleAttributeParser<S> for InlineParser {
|
||||
const PATH: &'static [Symbol] = &[sym::inline];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate = template!(Word, List: &["always", "never"]);
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
Word,
|
||||
List: &["always", "never"],
|
||||
"https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
match args {
|
||||
|
||||
@@ -16,7 +16,10 @@ impl<S: Stage> SingleAttributeParser<S> for LinkNameParser {
|
||||
const PATH: &[Symbol] = &[sym::link_name];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
NameValueStr: "name",
|
||||
"https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
let Some(nv) = args.name_value() else {
|
||||
@@ -38,7 +41,10 @@ impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
|
||||
const PATH: &[Symbol] = &[sym::link_section];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
NameValueStr: "name",
|
||||
"https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
let Some(nv) = args.name_value() else {
|
||||
@@ -94,7 +100,10 @@ impl<S: Stage> SingleAttributeParser<S> for LinkOrdinalParser {
|
||||
const PATH: &[Symbol] = &[sym::link_ordinal];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const TEMPLATE: AttributeTemplate = template!(List: &["ordinal"]);
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
List: &["ordinal"],
|
||||
"https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
let ordinal = parse_single_integer(cx, args)?;
|
||||
|
||||
@@ -31,7 +31,10 @@ pub(crate) struct MacroUseParser {
|
||||
first_span: Option<Span>,
|
||||
}
|
||||
|
||||
const MACRO_USE_TEMPLATE: AttributeTemplate = template!(Word, List: &["name1, name2, ..."]);
|
||||
const MACRO_USE_TEMPLATE: AttributeTemplate = template!(
|
||||
Word, List: &["name1, name2, ..."],
|
||||
"https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute"
|
||||
);
|
||||
|
||||
impl<S: Stage> AttributeParser<S> for MacroUseParser {
|
||||
const ATTRIBUTES: AcceptMapping<Self, S> = &[(
|
||||
|
||||
@@ -14,7 +14,10 @@ impl<S: Stage> SingleAttributeParser<S> for MustUseParser {
|
||||
const PATH: &[Symbol] = &[sym::must_use];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate = template!(Word, NameValueStr: "reason");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
Word, NameValueStr: "reason",
|
||||
"https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
Some(AttributeKind::MustUse {
|
||||
|
||||
@@ -12,7 +12,10 @@ impl<S: Stage> SingleAttributeParser<S> for PathParser {
|
||||
const PATH: &[Symbol] = &[sym::path];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "file");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
NameValueStr: "file",
|
||||
"https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
let Some(nv) = args.name_value() else {
|
||||
|
||||
@@ -28,8 +28,10 @@ impl<S: Stage> SingleAttributeParser<S> for ProcMacroDeriveParser {
|
||||
const PATH: &[Symbol] = &[sym::proc_macro_derive];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const TEMPLATE: AttributeTemplate =
|
||||
template!(List: &["TraitName", "TraitName, attributes(name1, name2, ...)"]);
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
List: &["TraitName", "TraitName, attributes(name1, name2, ...)"],
|
||||
"https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
let (trait_name, helper_attrs) = parse_derive_like(cx, args, true)?;
|
||||
|
||||
@@ -26,7 +26,10 @@ impl<S: Stage> CombineAttributeParser<S> for ReprParser {
|
||||
const CONVERT: ConvertFn<Self::Item> =
|
||||
|items, first_span| AttributeKind::Repr { reprs: items, first_span };
|
||||
// FIXME(jdonszelmann): never used
|
||||
const TEMPLATE: AttributeTemplate = template!(List: &["C", "Rust", "transparent", "align(...)", "packed(...)", "<integer type>"]);
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
List: &["C", "Rust", "transparent", "align(...)", "packed(...)", "<integer type>"],
|
||||
"https://doc.rust-lang.org/reference/type-layout.html#representations"
|
||||
);
|
||||
|
||||
fn extend<'c>(
|
||||
cx: &'c mut AcceptContext<'_, '_, S>,
|
||||
|
||||
@@ -13,7 +13,10 @@ impl<S: Stage> SingleAttributeParser<S> for IgnoreParser {
|
||||
const PATH: &[Symbol] = &[sym::ignore];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
|
||||
const TEMPLATE: AttributeTemplate = template!(Word, NameValueStr: "reason");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
Word, NameValueStr: "reason",
|
||||
"https://doc.rust-lang.org/reference/attributes/testing.html#the-ignore-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
Some(AttributeKind::Ignore {
|
||||
@@ -51,8 +54,10 @@ impl<S: Stage> SingleAttributeParser<S> for ShouldPanicParser {
|
||||
const PATH: &[Symbol] = &[sym::should_panic];
|
||||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
|
||||
const TEMPLATE: AttributeTemplate =
|
||||
template!(Word, List: &[r#"expected = "reason""#], NameValueStr: "reason");
|
||||
const TEMPLATE: AttributeTemplate = template!(
|
||||
Word, List: &[r#"expected = "reason""#], NameValueStr: "reason",
|
||||
"https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute"
|
||||
);
|
||||
|
||||
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
|
||||
Some(AttributeKind::ShouldPanic {
|
||||
|
||||
@@ -691,6 +691,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(link) = self.template.docs {
|
||||
diag.note(format!("for more information, visit <{link}>"));
|
||||
}
|
||||
let suggestions = self.template.suggestions(false, &name);
|
||||
diag.span_suggestions(
|
||||
self.attr_span,
|
||||
|
||||
@@ -609,7 +609,10 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
),
|
||||
ungated!(
|
||||
repr, Normal,
|
||||
template!(List: &["C"], "https://doc.rust-lang.org/reference/type-layout.html#representations"),
|
||||
template!(
|
||||
List: &["C", "Rust", "transparent", "align(...)", "packed(...)", "<integer type>"],
|
||||
"https://doc.rust-lang.org/reference/type-layout.html#representations"
|
||||
),
|
||||
DuplicatesOk, EncodeCrossCrate::No
|
||||
),
|
||||
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
|
||||
|
||||
@@ -8,21 +8,25 @@ extern crate std as s1;
|
||||
#[macro_use(5)]
|
||||
//~^ ERROR malformed `macro_use` attribute input
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
extern crate std as s2;
|
||||
|
||||
#[macro_use(a = "b")]
|
||||
//~^ ERROR malformed `macro_use` attribute input
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
extern crate std as s3;
|
||||
|
||||
#[macro_use(a(b))]
|
||||
//~^ ERROR malformed `macro_use` attribute input
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
extern crate std as s4;
|
||||
|
||||
#[macro_use(a::b)]
|
||||
//~^ ERROR malformed `macro_use` attribute input
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
extern crate std as s5;
|
||||
|
||||
#[macro_use(a)]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
error[E0469]: imported macro not found
|
||||
--> $DIR/invalid-macro-use.rs:47:13
|
||||
--> $DIR/invalid-macro-use.rs:51:13
|
||||
|
|
||||
LL | #[macro_use(a)]
|
||||
| ^
|
||||
|
||||
error[E0469]: imported macro not found
|
||||
--> $DIR/invalid-macro-use.rs:49:13
|
||||
--> $DIR/invalid-macro-use.rs:53:13
|
||||
|
|
||||
LL | #[macro_use(b)]
|
||||
| ^
|
||||
@@ -24,6 +24,7 @@ LL | #[macro_use(5)]
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(5)]
|
||||
@@ -34,13 +35,14 @@ LL + #[macro_use]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `macro_use` attribute input
|
||||
--> $DIR/invalid-macro-use.rs:13:1
|
||||
--> $DIR/invalid-macro-use.rs:14:1
|
||||
|
|
||||
LL | #[macro_use(a = "b")]
|
||||
| ^^^^^^^^^^^^^^-----^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(a = "b")]
|
||||
@@ -51,13 +53,14 @@ LL + #[macro_use]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `macro_use` attribute input
|
||||
--> $DIR/invalid-macro-use.rs:18:1
|
||||
--> $DIR/invalid-macro-use.rs:20:1
|
||||
|
|
||||
LL | #[macro_use(a(b))]
|
||||
| ^^^^^^^^^^^^^---^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(a(b))]
|
||||
@@ -68,13 +71,14 @@ LL + #[macro_use]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `macro_use` attribute input
|
||||
--> $DIR/invalid-macro-use.rs:23:1
|
||||
--> $DIR/invalid-macro-use.rs:26:1
|
||||
|
|
||||
LL | #[macro_use(a::b)]
|
||||
| ^^^^^^^^^^^^----^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(a::b)]
|
||||
@@ -85,13 +89,13 @@ LL + #[macro_use]
|
||||
|
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/invalid-macro-use.rs:28:1
|
||||
--> $DIR/invalid-macro-use.rs:32:1
|
||||
|
|
||||
LL | #[macro_use(a)]
|
||||
| ^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/invalid-macro-use.rs:30:1
|
||||
--> $DIR/invalid-macro-use.rs:34:1
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
@@ -102,25 +106,25 @@ LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/invalid-macro-use.rs:36:1
|
||||
--> $DIR/invalid-macro-use.rs:40:1
|
||||
|
|
||||
LL | #[macro_use(a)]
|
||||
| ^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/invalid-macro-use.rs:34:1
|
||||
--> $DIR/invalid-macro-use.rs:38:1
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/invalid-macro-use.rs:42:1
|
||||
--> $DIR/invalid-macro-use.rs:46:1
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
note: attribute also specified here
|
||||
--> $DIR/invalid-macro-use.rs:40:1
|
||||
--> $DIR/invalid-macro-use.rs:44:1
|
||||
|
|
||||
LL | #[macro_use]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
@@ -6,6 +6,8 @@ LL | #[cfg]
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error: malformed `cfg_attr` attribute input
|
||||
--> $DIR/malformed-attrs.rs:101:1
|
||||
@@ -354,7 +356,16 @@ error[E0539]: malformed `rustc_macro_transparency` attribute input
|
||||
--> $DIR/malformed-attrs.rs:43:1
|
||||
|
|
||||
LL | #[rustc_macro_transparency]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[rustc_macro_transparency = "opaque"]
|
||||
| ++++++++++
|
||||
LL | #[rustc_macro_transparency = "semitransparent"]
|
||||
| +++++++++++++++++++
|
||||
LL | #[rustc_macro_transparency = "transparent"]
|
||||
| +++++++++++++++
|
||||
|
||||
error[E0539]: malformed `repr` attribute input
|
||||
--> $DIR/malformed-attrs.rs:45:1
|
||||
@@ -362,6 +373,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #[repr]
|
||||
| ^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[repr(<integer type>)]
|
||||
@@ -496,12 +508,16 @@ error[E0539]: malformed `link_name` attribute input
|
||||
|
|
||||
LL | #[link_name]
|
||||
| ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
|
||||
|
||||
error[E0539]: malformed `link_section` attribute input
|
||||
--> $DIR/malformed-attrs.rs:85:1
|
||||
|
|
||||
LL | #[link_section]
|
||||
| ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
|
||||
|
||||
error[E0539]: malformed `coverage` attribute input
|
||||
--> $DIR/malformed-attrs.rs:87:1
|
||||
@@ -560,6 +576,7 @@ LL | #[must_use = 1]
|
||||
| |
|
||||
| expected a string literal here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[must_use = 1]
|
||||
@@ -575,6 +592,7 @@ error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
LL | #[proc_macro_derive]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[proc_macro_derive(TraitName)]
|
||||
@@ -635,6 +653,8 @@ LL | #[link_ordinal]
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error[E0565]: malformed `ffi_const` attribute input
|
||||
--> $DIR/malformed-attrs.rs:168:5
|
||||
|
||||
@@ -4,6 +4,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #![repr]
|
||||
| ^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #![repr]
|
||||
|
||||
@@ -122,6 +122,7 @@ LL | #[proc_macro_derive(unsafe(Foo))]
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(unsafe(Foo))]
|
||||
|
||||
@@ -6,6 +6,8 @@ LL | #[cfg(target(o::o))]
|
||||
| | |
|
||||
| | expected this to be of the form `... = "..."`
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-target-compact-errors.rs:9:1
|
||||
@@ -15,6 +17,8 @@ LL | #[cfg(target(os = 8))]
|
||||
| | |
|
||||
| | expected a string literal here
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-target-compact-errors.rs:13:1
|
||||
@@ -24,6 +28,8 @@ LL | #[cfg(target(os = "linux", pointer(width = "64")))]
|
||||
| | |
|
||||
| | expected this to be of the form `... = "..."`
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-target-compact-errors.rs:17:1
|
||||
@@ -33,6 +39,8 @@ LL | #[cfg(target(true))]
|
||||
| | |
|
||||
| | expected this to be of the form `... = "..."`
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error: `cfg` predicate key must be an identifier
|
||||
--> $DIR/cfg-target-compact-errors.rs:21:14
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
#[cfg]
|
||||
//~^ ERROR malformed `cfg` attribute
|
||||
//~| NOTE expected this to be a list
|
||||
//~| NOTE for more information, visit
|
||||
struct S1;
|
||||
|
||||
#[cfg = 10]
|
||||
//~^ ERROR malformed `cfg` attribute
|
||||
//~| NOTE expected this to be a list
|
||||
//~| NOTE for more information, visit
|
||||
struct S2;
|
||||
|
||||
#[cfg()]
|
||||
//~^ ERROR malformed `cfg` attribute
|
||||
//~| NOTE expected a single argument here
|
||||
//~| NOTE for more information, visit
|
||||
struct S3;
|
||||
|
||||
#[cfg(a, b)]
|
||||
//~^ ERROR malformed `cfg` attribute
|
||||
//~| NOTE expected a single argument here
|
||||
//~| NOTE for more information, visit
|
||||
struct S4;
|
||||
|
||||
#[cfg("str")] //~ ERROR `cfg` predicate key must be an identifier
|
||||
@@ -29,6 +33,7 @@ struct S7;
|
||||
|
||||
#[cfg(a = 10)] //~ ERROR malformed `cfg` attribute input
|
||||
//~^ NOTE expected a string literal here
|
||||
//~| NOTE for more information, visit
|
||||
struct S8;
|
||||
|
||||
#[cfg(a = b"hi")] //~ ERROR malformed `cfg` attribute input
|
||||
|
||||
@@ -6,63 +6,73 @@ LL | #[cfg]
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:6:1
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:7:1
|
||||
|
|
||||
LL | #[cfg = 10]
|
||||
| ^^^^^^^^^^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0805]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:11:1
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:13:1
|
||||
|
|
||||
LL | #[cfg()]
|
||||
| ^^^^^--^
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0805]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:16:1
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:19:1
|
||||
|
|
||||
LL | #[cfg(a, b)]
|
||||
| ^^^^^------^
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error: `cfg` predicate key must be an identifier
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:21:7
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:25:7
|
||||
|
|
||||
LL | #[cfg("str")]
|
||||
| ^^^^^
|
||||
|
||||
error: `cfg` predicate key must be an identifier
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:24:7
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:28:7
|
||||
|
|
||||
LL | #[cfg(a::b)]
|
||||
| ^^^^
|
||||
|
||||
error[E0537]: invalid predicate `a`
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:27:7
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:31:7
|
||||
|
|
||||
LL | #[cfg(a())]
|
||||
| ^^^
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:30:1
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:34:1
|
||||
|
|
||||
LL | #[cfg(a = 10)]
|
||||
| ^^^^^^^^^^--^^
|
||||
| | |
|
||||
| | expected a string literal here
|
||||
| help: must be of the form: `#[cfg(predicate)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
|
||||
|
||||
error[E0539]: malformed `cfg` attribute input
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:34:1
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:39:1
|
||||
|
|
||||
LL | #[cfg(a = b"hi")]
|
||||
| ^^^^^^^^^^-^^^^^^
|
||||
@@ -72,7 +82,7 @@ LL | #[cfg(a = b"hi")]
|
||||
= note: expected a normal string literal, not a byte string literal
|
||||
|
||||
error: expected unsuffixed literal, found `expr` metavariable
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:40:25
|
||||
--> $DIR/cfg-attr-syntax-validation.rs:45:25
|
||||
|
|
||||
LL | #[cfg(feature = $expr)]
|
||||
| ^^^^^
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[inline()]
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[inline(always)]
|
||||
|
||||
1
tests/ui/extern/issue-47725.rs
vendored
1
tests/ui/extern/issue-47725.rs
vendored
@@ -17,6 +17,7 @@ extern "C" {
|
||||
#[link_name]
|
||||
//~^ ERROR malformed `link_name` attribute input
|
||||
//~| HELP must be of the form
|
||||
//~| NOTE for more information, visit
|
||||
extern "C" {
|
||||
fn bar() -> u32;
|
||||
}
|
||||
|
||||
2
tests/ui/extern/issue-47725.stderr
vendored
2
tests/ui/extern/issue-47725.stderr
vendored
@@ -3,6 +3,8 @@ error[E0539]: malformed `link_name` attribute input
|
||||
|
|
||||
LL | #[link_name]
|
||||
| ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
|
||||
|
||||
warning: attribute should be applied to a foreign function or static
|
||||
--> $DIR/issue-47725.rs:3:1
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[inline(please,no)]
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[inline(please,no)]
|
||||
@@ -26,6 +27,7 @@ LL | #[inline()]
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[inline(always)]
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[inline(XYZ)]
|
||||
| |
|
||||
| valid arguments are `always` or `never`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[inline(XYZ)]
|
||||
@@ -42,6 +43,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #[repr]
|
||||
| ^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[repr(<integer type>)]
|
||||
@@ -62,6 +64,7 @@ LL | #[inline(ABC)]
|
||||
| |
|
||||
| valid arguments are `always` or `never`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[inline(ABC)]
|
||||
@@ -80,6 +83,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | let _z = #[repr] 1;
|
||||
| ^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | let _z = #[repr(<integer type>)] 1;
|
||||
|
||||
@@ -6,6 +6,8 @@ LL | #[link_ordinal("JustMonika")]
|
||||
| | |
|
||||
| | expected an integer literal here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error[E0539]: malformed `link_ordinal` attribute input
|
||||
--> $DIR/link-ordinal-invalid-format.rs:6:5
|
||||
@@ -15,6 +17,8 @@ LL | #[link_ordinal("JustMonika")]
|
||||
| | |
|
||||
| | expected an integer literal here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ extern "C" {
|
||||
#[link_ordinal()]
|
||||
//~^ ERROR malformed `link_ordinal` attribute input
|
||||
//~| NOTE expected a single argument
|
||||
//~| NOTE for more information, visit
|
||||
fn foo();
|
||||
#[link_ordinal()]
|
||||
//~^ ERROR malformed `link_ordinal` attribute input
|
||||
//~| NOTE expected a single argument
|
||||
//~| NOTE for more information, visit
|
||||
static mut imported_variable: i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,19 @@ LL | #[link_ordinal()]
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error[E0805]: malformed `link_ordinal` attribute input
|
||||
--> $DIR/link-ordinal-missing-argument.rs:7:5
|
||||
--> $DIR/link-ordinal-missing-argument.rs:8:5
|
||||
|
|
||||
LL | #[link_ordinal()]
|
||||
| ^^^^^^^^^^^^^^--^
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ extern "C" {
|
||||
#[link_ordinal(3, 4)]
|
||||
//~^ ERROR malformed `link_ordinal` attribute input
|
||||
//~| NOTE expected a single argument
|
||||
//~| NOTE for more information, visit
|
||||
fn foo();
|
||||
#[link_ordinal(3, 4)]
|
||||
//~^ ERROR malformed `link_ordinal` attribute input
|
||||
//~| NOTE expected a single argument
|
||||
//~| NOTE for more information, visit
|
||||
static mut imported_variable: i32;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,19 @@ LL | #[link_ordinal(3, 4)]
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error[E0805]: malformed `link_ordinal` attribute input
|
||||
--> $DIR/link-ordinal-too-many-arguments.rs:7:5
|
||||
--> $DIR/link-ordinal-too-many-arguments.rs:8:5
|
||||
|
|
||||
LL | #[link_ordinal(3, 4)]
|
||||
| ^^^^^^^^^^^^^^------^
|
||||
| | |
|
||||
| | expected a single argument here
|
||||
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[macro_use(foo(bar))]
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(foo(bar))]
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[macro_use(foo="bar")]
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[macro_use(foo="bar")]
|
||||
|
||||
@@ -158,6 +158,7 @@ LL | #[must_use = "string"suffix]
|
||||
| |
|
||||
| expected a string literal here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[must_use = "string"suffix]
|
||||
|
||||
@@ -9,46 +9,55 @@ use proc_macro::*;
|
||||
#[proc_macro_derive]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected this to be a list
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo1(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive = ""]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected this to be a list
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo2(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d3, a, b)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE the only valid argument here is `attributes`
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo3(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d4, attributes(a), b)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo4(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive("a")]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect a literal here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo5(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d6 = "")]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo6(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(m::d7)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo7(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d8(a))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo8(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(self)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo9(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(PartialEq)] // OK
|
||||
@@ -57,34 +66,41 @@ pub fn foo10(input: TokenStream) -> TokenStream { input }
|
||||
#[proc_macro_derive(d11, a)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE the only valid argument here is `attributes`
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo11(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d12, attributes)]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected this to be a list
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo12(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d13, attributes("a"))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo13(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d14, attributes(a = ""))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo14(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d15, attributes(m::a))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo15(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d16, attributes(a(b)))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE didn't expect any arguments here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo16(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
#[proc_macro_derive(d17, attributes(self))]
|
||||
//~^ ERROR malformed `proc_macro_derive` attribute
|
||||
//~| NOTE expected a valid identifier here
|
||||
//~| NOTE for more information, visit
|
||||
pub fn foo17(input: TokenStream) -> TokenStream { input }
|
||||
|
||||
@@ -4,6 +4,7 @@ error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
LL | #[proc_macro_derive]
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[proc_macro_derive(TraitName)]
|
||||
@@ -12,11 +13,12 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
| ++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:14:1
|
||||
--> $DIR/attribute.rs:15:1
|
||||
|
|
||||
LL | #[proc_macro_derive = ""]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive = ""]
|
||||
@@ -27,13 +29,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:19:1
|
||||
--> $DIR/attribute.rs:21:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d3, a, b)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^-^^^^^
|
||||
| |
|
||||
| the only valid argument here is `attributes`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d3, a, b)]
|
||||
@@ -44,13 +47,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:24:1
|
||||
--> $DIR/attribute.rs:27:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d4, attributes(a), b)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d4, attributes(a), b)]
|
||||
@@ -61,13 +65,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:29:1
|
||||
--> $DIR/attribute.rs:33:1
|
||||
|
|
||||
LL | #[proc_macro_derive("a")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^---^^
|
||||
| |
|
||||
| didn't expect a literal here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive("a")]
|
||||
@@ -78,13 +83,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:34:1
|
||||
--> $DIR/attribute.rs:39:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d6 = "")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^----^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d6 = "")]
|
||||
@@ -95,13 +101,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:39:1
|
||||
--> $DIR/attribute.rs:45:1
|
||||
|
|
||||
LL | #[proc_macro_derive(m::d7)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^-----^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(m::d7)]
|
||||
@@ -112,13 +119,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:44:1
|
||||
--> $DIR/attribute.rs:51:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d8(a))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^---^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d8(a))]
|
||||
@@ -128,31 +136,33 @@ LL - #[proc_macro_derive(d8(a))]
|
||||
LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:49:1
|
||||
|
|
||||
LL | #[proc_macro_derive(self)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^----^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(self)]
|
||||
LL + #[proc_macro_derive(TraitName)]
|
||||
|
|
||||
LL - #[proc_macro_derive(self)]
|
||||
LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:57:1
|
||||
|
|
||||
LL | #[proc_macro_derive(self)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^----^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(self)]
|
||||
LL + #[proc_macro_derive(TraitName)]
|
||||
|
|
||||
LL - #[proc_macro_derive(self)]
|
||||
LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:66:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d11, a)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^-^^
|
||||
| |
|
||||
| the only valid argument here is `attributes`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d11, a)]
|
||||
@@ -163,13 +173,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:62:1
|
||||
--> $DIR/attribute.rs:72:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d12, attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^----------^^
|
||||
| |
|
||||
| expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d12, attributes)]
|
||||
@@ -180,13 +191,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:67:1
|
||||
--> $DIR/attribute.rs:78:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d13, attributes("a"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d13, attributes("a"))]
|
||||
@@ -197,13 +209,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:72:1
|
||||
--> $DIR/attribute.rs:84:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d14, attributes(a = ""))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----^^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d14, attributes(a = ""))]
|
||||
@@ -214,13 +227,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:77:1
|
||||
--> $DIR/attribute.rs:90:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d15, attributes(m::a))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----^^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d15, attributes(m::a))]
|
||||
@@ -231,13 +245,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0565]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:82:1
|
||||
--> $DIR/attribute.rs:96:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d16, attributes(a(b)))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^
|
||||
| |
|
||||
| didn't expect any arguments here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d16, attributes(a(b)))]
|
||||
@@ -248,13 +263,14 @@ LL + #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `proc_macro_derive` attribute input
|
||||
--> $DIR/attribute.rs:87:1
|
||||
--> $DIR/attribute.rs:102:1
|
||||
|
|
||||
LL | #[proc_macro_derive(d17, attributes(self))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----^^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[proc_macro_derive(d17, attributes(self))]
|
||||
|
||||
@@ -4,6 +4,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #[repr]
|
||||
| ^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[repr(<integer type>)]
|
||||
@@ -22,6 +23,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #[repr = "B"]
|
||||
| ^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[repr = "B"]
|
||||
@@ -44,6 +46,7 @@ error[E0539]: malformed `repr` attribute input
|
||||
LL | #[repr = "C"]
|
||||
| ^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html#representations>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[repr = "C"]
|
||||
|
||||
@@ -12,6 +12,8 @@ LL | #![path = foo!()]
|
||||
| | |
|
||||
| | expected a string literal here
|
||||
| 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 2 previous errors
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[inline(unknown)]
|
||||
| |
|
||||
| valid arguments are `always` or `never`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[inline(unknown)]
|
||||
|
||||
@@ -10,6 +10,7 @@ fn test1() {
|
||||
#[should_panic(expected)]
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected this to be of the form `expected = "..."`
|
||||
//~| NOTE for more information, visit
|
||||
fn test2() {
|
||||
panic!();
|
||||
}
|
||||
@@ -18,6 +19,7 @@ fn test2() {
|
||||
#[should_panic(expect)]
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE the only valid argument here is "expected"
|
||||
//~| NOTE for more information, visit
|
||||
fn test3() {
|
||||
panic!();
|
||||
}
|
||||
@@ -26,6 +28,7 @@ fn test3() {
|
||||
#[should_panic(expected(foo, bar))]
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected this to be of the form `expected = "..."`
|
||||
//~| NOTE for more information, visit
|
||||
fn test4() {
|
||||
panic!();
|
||||
}
|
||||
@@ -34,6 +37,7 @@ fn test4() {
|
||||
#[should_panic(expected = "foo", bar)]
|
||||
//~^ ERROR malformed `should_panic` attribute input
|
||||
//~| NOTE expected a single argument here
|
||||
//~| NOTE for more information, visit
|
||||
fn test5() {
|
||||
panic!();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ LL | #[should_panic(expected)]
|
||||
| |
|
||||
| expected this to be of the form `expected = "..."`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected)]
|
||||
@@ -18,13 +19,14 @@ LL + #[should_panic]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:18:1
|
||||
--> $DIR/test-should-panic-attr.rs:19:1
|
||||
|
|
||||
LL | #[should_panic(expect)]
|
||||
| ^^^^^^^^^^^^^^--------^
|
||||
| |
|
||||
| the only valid argument here is "expected"
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expect)]
|
||||
@@ -37,13 +39,14 @@ LL + #[should_panic]
|
||||
|
|
||||
|
||||
error[E0539]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:26:1
|
||||
--> $DIR/test-should-panic-attr.rs:28:1
|
||||
|
|
||||
LL | #[should_panic(expected(foo, bar))]
|
||||
| ^^^^^^^^^^^^^^^------------------^^
|
||||
| |
|
||||
| expected this to be of the form `expected = "..."`
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected(foo, bar))]
|
||||
@@ -57,13 +60,14 @@ LL + #[should_panic]
|
||||
|
|
||||
|
||||
error[E0805]: malformed `should_panic` attribute input
|
||||
--> $DIR/test-should-panic-attr.rs:34:1
|
||||
--> $DIR/test-should-panic-attr.rs:37:1
|
||||
|
|
||||
LL | #[should_panic(expected = "foo", bar)]
|
||||
| ^^^^^^^^^^^^^^-----------------------^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute>
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[should_panic(expected = "foo", bar)]
|
||||
|
||||
Reference in New Issue
Block a user