-
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
Code
// https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=59feacaf2986a2fd0b2510b2c225ae41
enum Magic {
Value { count: usize },
}
fn create() {
Magic::Value(42);
}
Current output
Compiling playground v0.0.1 (/playground)
error[E0533]: expected value, found struct variant `Magic::Value`
--> src/lib.rs:6:5
|
6 | Magic::Value(42);
| ^^^^^^^^^^^^ not a value
|
help: you might have meant to create a new value of the struct
|
6 | Magic::Value { count: /* value */ };
| ~~~~~~~~~~~~~~~~~~~~~~
For more information about this error, try `rustc --explain E0533`.
error: could not compile `playground` (lib) due to 1 previous error
Desired output
Either of:
Magic::Value { count: 42 };
Or:
Fix the applicability of the diagnostic to indicate it contains placeholder text.
Rationale and extra context
The diagnostic is taken by Rust Analyzer and applied, as it is marked applicable. It should either not be marked applicable, OR (preferably) fixed so that it doesn't contain the placeholder /* value */
.
Originally reported at rust-lang/rust-analyzer#18302, since it causes incorrect replacements in the IDE
Other cases
No response
Rust Version
I'm running on the nightly in the playground (https://play.rust-lang.org/), since I'm at a company that internally has a patched rustc. The playground reports:
Build using the Nightly version: 1.84.0-nightly (2024-10-17 3ed6e3cc69857129c1d3)
Anything else?
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.