Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend multi-line errors to "method * has incompatible type for trait" #21332

Closed
mdinger opened this issue Jan 17, 2015 · 0 comments · Fixed by #27121
Closed

extend multi-line errors to "method * has incompatible type for trait" #21332

mdinger opened this issue Jan 17, 2015 · 0 comments · Fixed by #27121
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@mdinger
Copy link
Contributor

mdinger commented Jan 17, 2015

The multi-line errors should be extended to include this testcase. #19870 missed this because the msg: &str didn't go through Session::span_err. I tried Session::err but that didn't work either. If someone can point me to to where to catch it, I can probably fix this too.

cc @nick29581

Code:

struct S;

impl Iterator for S {
    type Item = i32;
    fn next(&mut self) -> Result<i32, i32> { Ok(7) }
}

fn main() {}

Error:

<anon>:5:5: 5:53 error: method `next` has an incompatible type for trait: expected enum `core::option::Option`, found enum `core::result::Result` [E0053]
<anon>:5     fn next(&mut self) -> Result<i32, i32> { Ok(7) }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101

Change to:

<anon>:5:5: 5:53 error: method `next` has an incompatible type for trait:
 expected enum `core::option::Option`,
    found enum `core::result::Result` [E0053]
<anon>:5     fn next(&mut self) -> Result<i32, i32> { Ok(7) }
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101
@kmcallister kmcallister added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 17, 2015
bors added a commit that referenced this issue Jul 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants