Skip to content

Commit

Permalink
Fix diagnostic and add a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 10, 2024
1 parent df72e47 commit 12ae282
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
6 changes: 6 additions & 0 deletions tests/ui/tool-attributes/invalid-tool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![feature(register_tool)]

#![register_tool(1)]
//~^ ERROR `register_tool` only accepts identifiers

fn main() {}
8 changes: 8 additions & 0 deletions tests/ui/tool-attributes/invalid-tool.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 12ae282

Please sign in to comment.