-
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 lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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
struct Foo {
x: Option<NotInScope>,
}
fn main() {
let f = Foo {
x: None,
};
}
error[E0412]: cannot find type `NotInScope` in this scope
--> src/main.rs:2:15
|
2 | x: Option<NotInScope>,
| ^^^^^^^^^^ not found in this scope
error[E0282]: type annotations needed
--> src/main.rs:7:12
|
7 | x: None,
| ^^^^ cannot infer type for `T`
error: aborting due to 2 previous errors
This "type annotations needed" error is confusing, especially if the two error messages are apart.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.