pub enum Error {
Show 16 variants
Parse(String),
NamesDontMatch(Ident, Ident),
MultipleSingularValues(Ident),
MultipleLiteralValues(Ident),
SingularAttrRequired(Ident),
ParametrizedAttrRequired(Ident),
ArgMustBePath,
ArgNameRequired,
ArgNameMustBeIdent,
ArgNameMustBeUnique(Ident),
ArgValueRequired(Ident),
ArgValueMustBeLiteral,
ArgValueMustBeType,
ParametrizedAttrHasNoValue(Ident),
NamedArgRequired(String),
NestedListsNotSupported(Ident),
}
Expand description
Errors representing inconsistency in proc macro attribute structure
Variants§
Parse(String)
NamesDontMatch(Ident, Ident)
Names of two merged attributes must match each other
MultipleSingularValues(Ident)
Singular argument (of form #[attr = ...]
) has multiple occurrences
each assigned value. This is meaningless.
MultipleLiteralValues(Ident)
Multiple literal non-string values are given for a parametrized
attribute in form of #[attr(literal1, literal2)]
. This is
meaningless.
SingularAttrRequired(Ident)
Attribute must be in a singular form (#[attr]
or #[attr = ...]
)
ParametrizedAttrRequired(Ident)
Attribute must be in a parametrized form (#[attr(...)]
)
ArgMustBePath
Attribute argument must be a path identifier like #[attr(std::io)]
or #[attr = std::io]
ArgNameRequired
Attribute or attribute argument must has a name
ArgNameMustBeIdent
Attribute or attribute argument name (in form of #[attr(arg = ...)]
)
must be an identifier (like arg
) and not a path (like std::io
)
ArgNameMustBeUnique(Ident)
The same argument name is used multiple times within parametrized
attribute (like in #[attr(name1 = value1, name1 = value2)]
)
ArgValueRequired(Ident)
Attribute or attribute argument must has a value:
#[attr(arg = value)]
ArgValueMustBeLiteral
Parametrized attribute argument must have a literal value (string,
integer etc): #[attr(arg = "value")]
or #[arg = 4]
ArgValueMustBeType
Parametrized attribute argument must be a valid type name:
#[attr(arg = u8)]
or #[arg = String]
ParametrizedAttrHasNoValue(Ident)
Parametrized attribute (in form of #[attr(...)]
) does not
have a single value
NamedArgRequired(String)
Attribute named argument must be present
NestedListsNotSupported(Ident)
Lists nested within attribute arguments, like #[attr(arg(...))]
are not supported