diff options
| author | Michael Goulet <michael@errs.io> | 2024-07-10 18:55:51 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-07-10 18:56:06 -0400 |
| commit | 12ae282987762a71cf146efa3fb6c6fcf4956475 (patch) | |
| tree | 8cae3f07bfee58d1b3a1bd33ac4782d38c2d6755 | |
| parent | df72e478b0179581c985ec53ebd6a0d14a330366 (diff) | |
| download | rust-12ae282987762a71cf146efa3fb6c6fcf4956475.tar.gz rust-12ae282987762a71cf146efa3fb6c6fcf4956475.zip | |
Fix diagnostic and add a test for it
| -rw-r--r-- | compiler/rustc_resolve/src/errors.rs | 2 | ||||
| -rw-r--r-- | tests/ui/tool-attributes/invalid-tool.rs | 6 | ||||
| -rw-r--r-- | tests/ui/tool-attributes/invalid-tool.stderr | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 0620f3d709e..cd6503ae444 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -1089,8 +1089,8 @@ pub(crate) struct ToolWasAlreadyRegistered { #[derive(Diagnostic)] #[diag(resolve_tool_only_accepts_identifiers)] pub(crate) struct ToolOnlyAcceptsIdentifiers { - #[label] #[primary_span] + #[label] pub(crate) span: Span, pub(crate) tool: Symbol, } diff --git a/tests/ui/tool-attributes/invalid-tool.rs b/tests/ui/tool-attributes/invalid-tool.rs new file mode 100644 index 00000000000..125333231d2 --- /dev/null +++ b/tests/ui/tool-attributes/invalid-tool.rs @@ -0,0 +1,6 @@ +#![feature(register_tool)] + +#![register_tool(1)] +//~^ ERROR `register_tool` only accepts identifiers + +fn main() {} diff --git a/tests/ui/tool-attributes/invalid-tool.stderr b/tests/ui/tool-attributes/invalid-tool.stderr new file mode 100644 index 00000000000..deafa6d167c --- /dev/null +++ b/tests/ui/tool-attributes/invalid-tool.stderr @@ -0,0 +1,8 @@ +error: `register_tool` only accepts identifiers + --> $DIR/invalid-tool.rs:3:18 + | +LL | #![register_tool(1)] + | ^ not an identifier + +error: aborting due to 1 previous error + |
