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

Projects
None yet
5 participants
@estebank
Copy link
Contributor

estebank commented Jan 21, 2019

Fix #57743.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 21, 2019

r? @eddyb

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

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 21, 2019

@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

This comment has been minimized.

@oli-obk

oli-obk Jan 21, 2019

Contributor

Mostly unrelated to this PR, but shouldn't the type mismatch span point to this 1u32 instead of the entire if expression?

This comment has been minimized.

@estebank

estebank Jan 21, 2019

Author Contributor

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

This comment has been minimized.

Copy link
Contributor

oli-obk commented Jan 22, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 22, 2019

📌 Commit ab2479b has been approved by oli-obk

Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019

Rollup merge of rust-lang#57793 - estebank:impl-trait-resolve, r=oli-obk
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 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #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)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #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)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #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)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #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)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019

Rollup merge of rust-lang#57793 - estebank:impl-trait-resolve, r=oli-obk
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

Auto merge of #57869 - Centril:rollup, r=Centril
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