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::Item existed
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.2
Anything else?
No response
Code
Current output
Desired output
Don't mention
std::ops::CoroutineStateand give up much earlier? Take into account available enum variant names when making a suggestion?Rationale and extra context
I renamed enum
CompleteintoCompleteRequest, on the next checkrustcsuggested me to usestd::ops::CoroutineState. This is wrong for two reasons:CoroutineState::ItemexistedCoroutineState::Item { name ... }doesn't existOther cases
Rust Version
Anything else?
No response