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

New errors: expected/found types omitted #33366

Closed
birkenfeld opened this issue May 3, 2016 · 3 comments
Closed

New errors: expected/found types omitted #33366

birkenfeld opened this issue May 3, 2016 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@birkenfeld
Copy link
Contributor

I found this when I wanted to see how the new errors look. (If this is still expected to be WIP, let me know and I won't report other such cases for a while.)

In this test case, the "expected/found" notes don't appear:

$ x86_64-unknown-linux-gnu/stage1/bin/rustc src/test/compile-fail/wrong-ret-type.rs
src/test/compile-fail/wrong-ret-type.rs:12:49: 12:50 error: mismatched types [E0308]
src/test/compile-fail/wrong-ret-type.rs:12 fn mk_int() -> usize { let i: isize = 3; return i; }
                                                                                           ^
src/test/compile-fail/wrong-ret-type.rs:12:49: 12:50 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error

$ rustc src/test/compile-fail/wrong-ret-type.rs
src/test/compile-fail/wrong-ret-type.rs:12:49: 12:50 error: mismatched types:
 expected `usize`,
    found `isize` [E0308]
src/test/compile-fail/wrong-ret-type.rs:12 fn mk_int() -> usize { let i: isize = 3; return i; }
                                                                                           ^
src/test/compile-fail/wrong-ret-type.rs:12:49: 12:50 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
@birkenfeld
Copy link
Contributor Author

/cc @nikomatsakis

@birkenfeld
Copy link
Contributor Author

Ah, I can see that this is because both types are "primitive", i.e. bool/char/int/float. In this case is_simple_error is true here and note_expected_found is not called.

Previously, for these cases the "inner type error" in parens was omitted - which appears to be omitted in all cases now. I think the is_simple_error can just be removed, I'll open a PR.

birkenfeld added a commit to birkenfeld/rust that referenced this issue May 3, 2016
Previously, the second "expected X, found Y" in parens was omitted
for simple errors because it added no information.

Now that this is always omitted, there is no need for a distinction
anymore.  This change restores the "expected, found" message for
such errors.

Fixes: rust-lang#33366
@nikomatsakis
Copy link
Contributor

cc @jonathandturner

@nagisa nagisa added the A-diagnostics Area: Messages for errors, warnings, and lints label May 11, 2016
bors added a commit that referenced this issue May 19, 2016
Fix for old school error issues, improvements to new school

This PR:
* Fixes some old school error issues, specifically #33559, #33543, #33366
* Improves wording borrowck errors with match patterns
* De-emphasize multi-line spans, so we don't color the single source character when we're trying to say "span starts here"
* Rollup of #33392 (which should help fix #33390)

r? @nikomatsakis
@bors bors closed this as completed in 175ecfe May 19, 2016
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.

3 participants