-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add long error explanation for E0495 #64404
Conversation
Some changes occurred in diagnostic error codes |
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
Erroneous code example: | ||
|
||
```compile_fail,E0495 | ||
fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the single-field tuple necessary here? and the match
(could it be a let
)? It seems like they're adding extra confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, I was too focused on simplifying the lifetime change.
let x = transmute_lifetime(&y); | ||
``` | ||
|
||
In this code, you have two ways to solve this issue: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this example is representative of the majority of places where users encounter this error-- if users are hitting an error due to mismatched lifetimes, IME it's rare that it's easily solvable by just adding a bound in one location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have another example in mind by any chance? Maybe another example would be the best thing to do to avoid confusing users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an easy one that would be representative offhand, sorry. There are a number of things I've seen cause this error, and I don't have a good idea which is the most important to cover, nor what broader categories issues fall into.
Ping from triage. |
☔ The latest upstream changes (presumably #64658) made this pull request unmergeable. Please resolve the merge conflicts. |
@GuillaumeGomez can you rebase this? looks good to me |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@Dylan-DPC Don't know what you did but that suddenly broke badly. :p I'll take a look tomorrow. |
☔ The latest upstream changes (presumably #64886) made this pull request unmergeable. Please resolve the merge conflicts. |
e17987f
to
37b5efa
Compare
Updated. |
@bors r+ rollup Seems fine to land to me, thanks! |
📌 Commit 37b5efa has been approved by |
Add long error explanation for E0495 Part of rust-lang#61137.
37b5efa
to
be89e52
Compare
I rebased and tests passed so I assume the error doesn't come from here but from its merge with another PR. Therefore this r- shouldn't be here. @bors: r=cramertj rollup- |
📌 Commit be89e52 has been approved by |
@bors retry rolled up. |
Add long error explanation for E0495 Part of rust-lang#61137.
@GuillaumeGomez In general you can reproduce failures like this by running tl;dr I think you need to update the nll output. |
Hey @Centril maybe scenarios like this are a reason for us to remove compare-mode=nll ... or at least stop gating CI on it |
@tmandry That explains why I couldn't reproduce. Thanks for the info! I'll update the PR tomorrow. |
@pnkfelix we should probably inventory the reasons why we still use compare-mode=nll and then see if removing it would be safe (but that's for a different issue). |
be89e52
to
9bf9aea
Compare
Updated btw. |
☔ The latest upstream changes (presumably #65178) made this pull request unmergeable. Please resolve the merge conflicts. |
9bf9aea
to
7fb2820
Compare
7fb2820
to
96efaad
Compare
Updated. |
@bors r+ rollup |
📌 Commit 96efaad has been approved by |
Add long error explanation for E0495 Part of rust-lang#61137.
Add long error explanation for E0495 Part of rust-lang#61137.
Rollup of 8 pull requests Successful merges: - #64404 (Add long error explanation for E0495) - #64918 (Add long error explanation for E0551) - #65102 (Disable stack probe when thread sanitizer is enabled) - #65120 (Correctly estimate the required space for string in `StyledBuffer::prepend`) - #65145 (When suggesting assoc function with type params, include turbofish) - #65162 (Remove loaded_from_cache map from DepGraph) - #65176 (Remove query-related macros) - #65179 (Add long error explanation for E0567) Failed merges: r? @ghost
Part of #61137.