Skip to content

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

Merged
bors merged 8 commits into
rust-lang:masterfrom
estebank:point-at-closure-and-opaque-types
Jan 10, 2020
Merged

Point at opaque and closure type definitions in type errors#66463
bors merged 8 commits into
rust-lang:masterfrom
estebank:point-at-closure-and-opaque-types

Conversation

@estebank

@estebankestebank commented Nov 16, 2019

Copy link
Copy Markdown
Contributor

Fixes#57266, fixes#67117.

@rust-highfive

This comment has been minimized.

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

This comment has been minimized.

Comment threadsrc/test/ui/async-await/suggest-missing-await.stderr Outdated
Comment threadsrc/test/ui/impl-trait/equality2.stderr Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
@Centril

Copy link
Copy Markdown
Contributor

r? @Centril

@CentrilCentril 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.

@hdhoanghdhoang 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.

@estebankestebank changed the title [WIP] Point at opaque and closure type definitions in type errorsPoint at opaque and closure type definitions in type errorsDec 15, 2019
@estebank
estebankforce-pushed the point-at-closure-and-opaque-types branch 2 times, most recently from f0219b0 to bbab797CompareDecember 16, 2019 06:20
Comment threadsrc/test/ui/async-await/suggest-missing-await.stderr Outdated
@estebank
estebankforce-pushed the point-at-closure-and-opaque-types branch from 4ebcc3f to 6678094CompareDecember 16, 2019 19:44
@bors

This comment has been minimized.

@Aaron1011Aaron1011Jan 1, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opened #68020

@estebank
estebankforce-pushed the point-at-closure-and-opaque-types branch from 6678094 to 3efc92aCompareJanuary 8, 2020 00:58
Comment threadsrc/librustc/traits/error_reporting.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
Comment threadsrc/librustc/infer/error_reporting/mod.rs Outdated
@bors

This comment has been minimized.

@estebank
estebankforce-pushed the point-at-closure-and-opaque-types branch from 0c03db6 to 33ae322CompareJanuary 8, 2020 17:30
@estebankestebank 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

estebank commented Jan 8, 2020

Copy link
Copy Markdown
ContributorAuthor

Addressed the comments and rebased.

@Centril

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 9, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 33ae322 has been approved by Centril

@borsbors 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
Fixesrust-lang#57266, fixesrust-lang#67117.
@CentrilCentril mentioned this pull request Jan 10, 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
Fixesrust-lang#57266, fixesrust-lang#67117.
@CentrilCentril mentioned this pull request Jan 10, 2020
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:masterJan 10, 2020
@estebank
estebank deleted the point-at-closure-and-opaque-types branch November 9, 2023 05:17
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.S-waiting-on-borsStatus: 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.

Print better auto-trait diagnostics when opaque return type is involved Error message for type mismatch between impl Traits needs better explanation

8 participants

@estebank@rust-highfive@Centril@bors@JohnCSimon@Aaron1011@hdhoang@petrochenkov