-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
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
fn foo() {
let x = Vec::new();
x.push(Complete::Item { name: "hello" });
}Current output
Checking repro v0.1.0 (/home/pacak/tmp/repro)
error[E0433]: failed to resolve: use of undeclared type `Complete`
--> src/lib.rs:3:12
|
3 | x.push(Complete::Item { name: "hello" });
| ^^^^^^^^ use of undeclared type `Complete`
|
help: there is an enum variant `core::ops::CoroutineState::Complete` and 1 other; try using the variant's enum
|
3 - x.push(Complete::Item { name: "hello" });
3 + x.push(core::ops::CoroutineState::Item { name: "hello" });
|
3 - x.push(Complete::Item { name: "hello" });
3 + x.push(std::ops::CoroutineState::Item { name: "hello" });
|Desired output
Don't mention std::ops::CoroutineState and give up much earlier? Take into account available enum variant names when making a suggestion?
Rationale and extra context
I renamed enum Complete into CompleteRequest, on the next check rustc suggested me to use std::ops::CoroutineState. This is wrong for two reasons:
- I'm not using nightly so replacement won't work even if
CoroutineState::Itemexisted CoroutineState::Item { name ... }doesn't exist
pub enum CoroutineState<Y, R> {
Yielded(Y),
Complete(R),
}Other cases
Rust Version
rustc 1.91.1 (ed61e7d7e 2025-11-07)
binary: rustc
commit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb
commit-date: 2025-11-07
host: x86_64-unknown-linux-gnu
release: 1.91.1
LLVM version: 21.1.2Anything else?
No response
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.