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

Tweak E0308 on opaque types #63796

Merged
merged 3 commits into from
Aug 22, 2019
Merged

Tweak E0308 on opaque types #63796

merged 3 commits into from
Aug 22, 2019

Conversation

estebank
Copy link
Contributor

error[E0308]: if and else have incompatible types
  --> file.rs:21:9
   |
18 | /     if true {
19 | |         thing_one()
   | |         ----------- expected because of this
20 | |     } else {
21 | |         thing_two()
   | |         ^^^^^^^^^^^ expected opaque type, found a different opaque type
22 | |     }.await
   | |_____- if and else have incompatible types
   |
   = note: expected type `impl std::future::Future` (opaque type)
              found type `impl std::future::Future` (opaque type)
   = note: distinct uses of `impl Trait` result in different opaque types
   = help: if both futures resolve to the same type, consider `await`ing on both of them

r? @Centril
CC #63167

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

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks OK aside from the FIXME -- some tests would be nice tho :)

src/librustc/ty/error.rs Outdated Show resolved Hide resolved
src/librustc/ty/error.rs Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Aug 21, 2019

r=me rollup with a test that exercises the behaviors we're adding (e.g. from the issue) and with or without changing the message per #63796 (comment).

@estebank
Copy link
Contributor Author

@bors r=Centril rollup

@bors
Copy link
Contributor

bors commented Aug 21, 2019

📌 Commit 02a80f79c160435a19d7f769c710d183329efdf0 has been approved by Centril

@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 Aug 21, 2019
@estebank
Copy link
Contributor Author

@bors r=Centril rollup

cleaned up an unnecessary "missing main" error

@bors
Copy link
Contributor

bors commented Aug 21, 2019

📌 Commit 4889e2e1ab72d2038d8413a39bef664cd0387e2d has been approved by Centril

@rust-highfive

This comment has been minimized.

@estebank
Copy link
Contributor Author

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 21, 2019

📌 Commit a710c61 has been approved by Centril

Centril added a commit to Centril/rust that referenced this pull request Aug 22, 2019
Tweak E0308 on opaque types

```
error[E0308]: if and else have incompatible types
  --> file.rs:21:9
   |
18 | /     if true {
19 | |         thing_one()
   | |         ----------- expected because of this
20 | |     } else {
21 | |         thing_two()
   | |         ^^^^^^^^^^^ expected opaque type, found a different opaque type
22 | |     }.await
   | |_____- if and else have incompatible types
   |
   = note: expected type `impl std::future::Future` (opaque type)
              found type `impl std::future::Future` (opaque type)
   = note: distinct uses of `impl Trait` result in different opaque types
   = help: if both futures resolve to the same type, consider `await`ing on both of them
```

r? @Centril
CC rust-lang#63167
bors added a commit that referenced this pull request Aug 22, 2019
Rollup of 7 pull requests

Successful merges:

 - #63624 (When declaring a declarative macro in an item it's only accessible inside it)
 - #63737 (Fix naming misspelling)
 - #63767 (Use more optimal Ord implementation for integers)
 - #63782 (Fix confusion in theme picker functions)
 - #63788 (Add amanjeev to rustc-guide toolstate)
 - #63796 (Tweak E0308 on opaque types)
 - #63805 (Apply few Clippy suggestions)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Aug 22, 2019
Rollup of 7 pull requests

Successful merges:

 - #63624 (When declaring a declarative macro in an item it's only accessible inside it)
 - #63737 (Fix naming misspelling)
 - #63767 (Use more optimal Ord implementation for integers)
 - #63782 (Fix confusion in theme picker functions)
 - #63788 (Add amanjeev to rustc-guide toolstate)
 - #63796 (Tweak E0308 on opaque types)
 - #63805 (Apply few Clippy suggestions)

Failed merges:

r? @ghost
@bors bors merged commit a710c61 into rust-lang:master Aug 22, 2019
@uberjay
Copy link

uberjay commented Aug 22, 2019

= help: if both futures resolve to the same type, consider awaiting on both of them

Could rustc provide that suggestion iff both futures resolve to the same type? Sounds challenging to me, but I know nothing about rustc diagnostics! 😬

@estebank
Copy link
Contributor Author

@uberjay it could but first we need to set some extra machinery around associated types to be able to do that.

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