-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Explain type mismatch cause pointing to return type when it is impl Trait
#57793
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
LL | / if false { | ||
LL | | //~^ ERROR mismatched types | ||
LL | | return 0i32; | ||
| | ---- expected because of this statement | ||
| | ---- ...is found to be `i32` here | ||
LL | | } else { | ||
LL | | 1u32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly unrelated to this PR, but shouldn't the type mismatch span point to this 1u32
instead of the entire if
expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a few changes recently to point at the tail expression in blocks instead of entire blocks, but haven't finished yet. This change is already in my plans :)
@bors r+ |
📌 Commit ab2479b has been approved by |
Explain type mismatch cause pointing to return type when it is `impl Trait` Fix rust-lang#57743.
Explain type mismatch cause pointing to return type when it is `impl Trait` Fix rust-lang#57743.
Rollup of 11 pull requests Successful merges: - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage) - #57730 (Merge visitors in AST validation) - #57779 (Recover from parse errors in literal struct fields and incorrect float literals) - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`) - #57795 (Use structured suggestion in stead of notes) - #57817 (Add error for trailing angle brackets.) - #57834 (Stabilize Any::get_type_id and rename to type_id) - #57836 (Fix some cross crate existential type ICEs) - #57840 (Fix issue 57762) - #57844 (use port 80 for retrieving GPG key) - #57858 (Ignore line ending on older git versions) Failed merges: r? @ghost
Fix #57743.