-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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=release&edition=2021&gist=b9b341939839ec733bf081c5ddf86e5b
enum OhNo<T, U> {
A(T),
B(U),
C,
}
fn uwu() {
OhNo::C::<u32, _>;
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[E0282]: type annotations needed
--> src/lib.rs:8:5
|
8 | OhNo::C::<u32, _>;
| ^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `U` declared on the enum `OhNo`
|
help: consider specifying the generic arguments
|
8 | OhNo::<u32, _>::C::<u32, _>;
| ++++++++++
For more information about this error, try `rustc --explain E0282`.
error: could not compile `playground` due to previous error
But applying this causes an error, saying that C
doesn't allow type arguments.
This happens on nightly and beta, but not on stable. I'm assuming the "consider specifying the generic arguments" was added recently.
I don't think we need the help here, because the generic arguments are already specified.
@rustbot label +D-invalid-suggestion
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-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.