Replace infallible name_or_empty methods with fallible name methods.
I'm removing empty identifiers everywhere, because in practice they always mean "no identifier" rather than "empty identifier". (An empty identifier is impossible.) It's better to use `Option` to mean "no identifier" because you then can't forget about the "no identifier" possibility. Some specifics: - When testing an attribute for a single name, the commit uses the `has_name` method. - When testing an attribute for multiple names, the commit uses the new `has_any_name` method. - When using `match` on an attribute, the match arms now have `Some` on them. In the tests, we now avoid printing empty identifiers by not printing the identifier in the `error:` line at all, instead letting the carets point out the problem.
This commit is contained in:
parent
7e1f2f9c54
commit
2fef0a30ae
40 changed files with 217 additions and 203 deletions
|
|
@ -53,5 +53,5 @@ type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
|
|||
#[rustc_abi(assert_eq)]
|
||||
type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
|
||||
|
||||
#[rustc_abi("assert_eq")] //~ ERROR unrecognized field name ``
|
||||
#[rustc_abi("assert_eq")] //~ ERROR unrecognized argument
|
||||
type Bad = u32;
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str)));
|
|||
= help: the trait `Sized` is not implemented for `str`
|
||||
= note: only the last element of a tuple may have a dynamically sized type
|
||||
|
||||
error: unrecognized field name ``
|
||||
error: unrecognized argument
|
||||
--> $DIR/debug.rs:56:13
|
||||
|
|
||||
LL | #[rustc_abi("assert_eq")]
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ note: the lint level is defined here
|
|||
LL | #![cfg_attr(deny, deny(invalid_macro_export_arguments))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `not_local_inner_macros` isn't a valid `#[macro_export]` argument
|
||||
error: invalid `#[macro_export]` argument
|
||||
--> $DIR/invalid_macro_export_argument.rs:13:16
|
||||
|
|
||||
LL | #[macro_export(not_local_inner_macros)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `` isn't a valid `#[macro_export]` argument
|
||||
error: invalid `#[macro_export]` argument
|
||||
--> $DIR/invalid_macro_export_argument.rs:33:16
|
||||
|
|
||||
LL | #[macro_export("blah")]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ macro_rules! a {
|
|||
}
|
||||
|
||||
#[macro_export(not_local_inner_macros)]
|
||||
//[deny]~^ ERROR `not_local_inner_macros` isn't a valid `#[macro_export]` argument
|
||||
//[deny]~^ ERROR invalid `#[macro_export]` argument
|
||||
macro_rules! b {
|
||||
() => ()
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ macro_rules! e {
|
|||
}
|
||||
|
||||
#[macro_export("blah")]
|
||||
//[deny]~^ ERROR `` isn't a valid `#[macro_export]` argument
|
||||
//[deny]~^ ERROR invalid `#[macro_export]` argument
|
||||
macro_rules! f {
|
||||
() => ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,6 @@ fn valid() {}
|
|||
static VALID : i32 = 0;
|
||||
|
||||
#[no_sanitize("address")]
|
||||
//~^ ERROR `#[no_sanitize()]` should be applied to a function
|
||||
//~^ ERROR `#[no_sanitize(...)]` should be applied to a function
|
||||
//~| ERROR invalid argument for `no_sanitize`
|
||||
static VALID2 : i32 = 0;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ LL | #[no_sanitize(address, memory)]
|
|||
LL | static INVALID : i32 = 0;
|
||||
| ------------------------- not a function
|
||||
|
||||
error: `#[no_sanitize()]` should be applied to a function
|
||||
error: `#[no_sanitize(...)]` should be applied to a function
|
||||
--> $DIR/no-sanitize.rs:42:15
|
||||
|
|
||||
LL | #[no_sanitize("address")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue