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

Point at opaque and closure type definitions in type errors #66463

Merged
merged 8 commits into from
Jan 10, 2020

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Nov 16, 2019

Fixes #57266, fixes #67117.

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 16, 2019
@estebank estebank changed the title Point at opaque and closure type definitions in type errors [WIP] Point at opaque and closure type definitions in type errors Nov 16, 2019
@estebank

This comment has been minimized.

src/test/ui/async-await/suggest-missing-await.stderr Outdated Show resolved Hide resolved
src/test/ui/impl-trait/equality2.stderr Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Nov 16, 2019

r? @Centril

@Centril Centril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2019
@bors

This comment has been minimized.

@JohnCSimon

This comment has been minimized.

@Centril

This comment has been minimized.

@hdhoang hdhoang added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 12, 2019
@estebank

This comment has been minimized.

@estebank estebank changed the title [WIP] Point at opaque and closure type definitions in type errors Point at opaque and closure type definitions in type errors Dec 15, 2019
@estebank estebank force-pushed the point-at-closure-and-opaque-types branch 2 times, most recently from f0219b0 to bbab797 Compare December 16, 2019 06:20
@estebank estebank force-pushed the point-at-closure-and-opaque-types branch from 4ebcc3f to 6678094 Compare December 16, 2019 19:44
@bors

This comment has been minimized.

@@ -25,6 +31,12 @@ LL | let _: i32 = Leak::leak(hide(0_i32));
error[E0308]: mismatched types
--> $DIR/equality2.rs:38:10
|
LL | fn hide<T: Foo>(x: T) -> impl Foo {
Copy link
Member

@Aaron1011 Aaron1011 Jan 1, 2020

Choose a reason for hiding this comment

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

I think it would be a good idea to add an additional explanation when the mismatch is due to the substs of an opaque type, as the current message seems quite self-contradictory. Maybe something like:

the expected opaque type (created from foo::<u32>)
the found opaque type (created from foo::<i32>)
note: a distinct opaque type is created for each distinct set of generic arguments provided to `foo`

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'm thinking about how to properly tackle this case. It is certainly confusing, but I would like to tackle it specifically and not as part of this PR. Would you mind filing a follow up ticket for this with your thoughts, @Aaron1011?

I think the wording you present is reasonable, but might require some tweaking, as the created from foo::<_> messages might be hard to accomplish.

Copy link
Member

Choose a reason for hiding this comment

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

Opened #68020

@estebank estebank force-pushed the point-at-closure-and-opaque-types branch from 6678094 to 3efc92a Compare January 8, 2020 00:58
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Show resolved Hide resolved
src/librustc/infer/error_reporting/mod.rs Outdated Show resolved Hide resolved
@bors

This comment has been minimized.

@estebank estebank force-pushed the point-at-closure-and-opaque-types branch from 0c03db6 to 33ae322 Compare January 8, 2020 17:30
@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 8, 2020
@estebank
Copy link
Contributor Author

estebank commented Jan 8, 2020

Addressed the comments and rebased.

@Centril
Copy link
Contributor

Centril commented Jan 9, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jan 9, 2020

📌 Commit 33ae322 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 Jan 9, 2020
Centril added a commit to Centril/rust that referenced this pull request Jan 10, 2020
…e-types, r=Centril

Point at opaque and closure type definitions in type errors

Fixes rust-lang#57266, fixes rust-lang#67117.
Centril added a commit to Centril/rust that referenced this pull request Jan 10, 2020
…e-types, r=Centril

Point at opaque and closure type definitions in type errors

Fixes rust-lang#57266, fixes rust-lang#67117.
bors added a commit that referenced this pull request Jan 10, 2020
Rollup of 6 pull requests

Successful merges:

 - #66463 (Point at opaque and closure type definitions in type errors)
 - #67501 (Reduce special treatment for zsts)
 - #67820 (Parse the syntax described in RFC 2632)
 - #67922 (rustc_ast_lowering: misc cleanup & rustc dep reductions)
 - #68071 (Extend support of `_` in type parameters)
 - #68073 (expect `fn` after `const unsafe` / `const extern`)

Failed merges:

r? @ghost
@bors bors merged commit 33ae322 into rust-lang:master Jan 10, 2020
@estebank estebank deleted the point-at-closure-and-opaque-types branch November 9, 2023 05:17
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 C-enhancement Category: An issue proposing an enhancement or a PR with one. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
8 participants