-
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 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
Given the following code: link
struct Foo;
impl Foo {
fn get() -> u8 {
42
}
}
fn main() {
let res: Result<_, ()> = Ok(Foo);
res.get();
}
The current output is:
error[E0599]: no method named `get` found for enum `Result` in the current scope
--> src/main.rs:11:9
|
11 | res.get();
| ^^^ method not found in `Result<Foo, ()>`
For more information about this error, try `rustc --explain E0599`.
Ideally the output should look like:
error[E0599]: no method named `get` found for enum `Result` in the current scope
--> src/main.rs:11:9
|
11 | res.get();
| ^^^ method not found in `Result<Foo, ()>`
note: `Result<Foo, ()>`'s success value, `Foo`, has a method named `get`.
note: To get to the success value of a Result, the error case must be handled first.
For more information about this error, try `rustc --explain E0599`.
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.