-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f5f8842e55751ce384c7d40390bde7e1
#[should_panic = 1]
fn test() {}
The current output is:
error: malformed `should_panic` attribute input
--> src/lib.rs:1:1
|
1 | #[should_panic = 1]
| ^^^^^^^^^^^^^^^^^^^
|
help: the following are the possible correct uses
|
1 | #[should_panic = "reason"]
|
1 | #[should_panic(expected = "reason)]
|
1 | #[should_panic]
|
Note that in #[should_panic(expected = "reason)]
we miss the closing quotes.
This is because the attribute template is missing it:
rust/compiler/rustc_feature/src/builtin_attrs.rs
Lines 278 to 281 in 80ed61f
ungated!( | |
should_panic, Normal, | |
template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), FutureWarnFollowing, | |
), |
Fixing that should be simple as introducing it there.
compiler-errors
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.