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

Explain type mismatch cause pointing to return type when it is impl Trait #57793

Merged
merged 2 commits into from
Jan 24, 2019

Conversation

estebank
Copy link
Contributor

Fix #57743.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 21, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Jan 21, 2019

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned eddyb Jan 21, 2019
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
Copy link
Contributor

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?

Copy link
Contributor Author

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 :)

@oli-obk
Copy link
Contributor

oli-obk commented Jan 22, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jan 22, 2019

📌 Commit ab2479b has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 22, 2019
Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019
Explain type mismatch cause pointing to return type when it is `impl Trait`

Fix rust-lang#57743.
Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019
Explain type mismatch cause pointing to return type when it is `impl Trait`

Fix rust-lang#57743.
bors added a commit that referenced this pull request Jan 24, 2019
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
@bors bors merged commit ab2479b into rust-lang:master Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants