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

Mention traits and types involved in unstable trait upcasting #96378

Merged
merged 1 commit into from
May 18, 2022

Conversation

compiler-errors
Copy link
Member

Fixes #95972 by printing the traits being upcasted and the types being coerced that cause that upcasting...


the poor span mentioned in the original issue has nothing to do with trait upcasting diagnostic here...

The original example I had that made me run into this issue had an even longer expression there (multiple chained
iterator methods) which just got all highlighted as one big block saying "somewhere here trait coercion is used and it's not allowed".

I don't think I can solve that issue in general without fixing the ObligationCauseCode and span that gets passed into Coerce.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 25, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(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 Apr 25, 2022
@@ -1,20 +0,0 @@
error[E0310]: the parameter type `A` may not live long enough
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file supposed to be deleted?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, but it keeps showing up every time I make a new PR. I'll revert it...

Copy link
Contributor

Choose a reason for hiding this comment

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

I asked because I had the same problem locally and I could not understand why

Copy link
Member Author

@compiler-errors compiler-errors Apr 25, 2022

Choose a reason for hiding this comment

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

I think it might've just been a file that got deleted but the change never made it to master. It's probably happening for everyone 👀

@nagisa
Copy link
Member

nagisa commented May 1, 2022

This is nice.

r=me after a rebase.

@nagisa nagisa 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 May 10, 2022
@compiler-errors
Copy link
Member Author

@bors r=nagisa

@bors
Copy link
Contributor

bors commented May 18, 2022

📌 Commit 0de7568 has been approved by nagisa

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 18, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request May 18, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#94639 (Suggest dereferencing non-lval mutable reference on assignment)
 - rust-lang#95979 (update coherence docs, fix generator + opaque type ICE)
 - rust-lang#96378 (Mention traits and types involved in unstable trait upcasting)
 - rust-lang#96917 (Make HashMap fall back to RtlGenRandom if BCryptGenRandom fails)
 - rust-lang#97101 (Add tracking issue for ExitCode::exit_process)
 - rust-lang#97123 (Clean fix for rust-lang#96223)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 49048ea into rust-lang:master May 18, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 18, 2022
@compiler-errors compiler-errors deleted the trait-upcast-error branch August 11, 2023 20:21
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad error message on trait coercion
6 participants