-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Remove textual span from diagnostic string #89555
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { | ||
| ^^^^^^^^^^^^^^ | ||
| -- ^^^^^^^^^^^^^^ | ||
| | | ||
| hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here |
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.
Should we mention that "hidden type &'a mut &'b T
" is impl Swap + 'a
in some way? Either with a label on the primary span or mentioning it explicitly in a note? (Doesn't need to be addressed in this PR)
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'll also wait with this until the primary span stops pointing to the return type with lazy TAIT
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds | ||
--> $DIR/error-handling-2.rs:13:60 | ||
--> $DIR/error-handling-2.rs:10:60 | ||
| | ||
LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | ||
| ^^^^^^^^^ | ||
| | ||
note: hidden type `*mut &'a i32` captures the lifetime `'a` as defined on the function body at 13:8 | ||
--> $DIR/error-handling-2.rs:13:8 | ||
| | ||
LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | ||
| ^^ | ||
| -- ^^^^^^^^^ | ||
| | | ||
| hidden type `*mut &'a i32` captures the lifetime `'a` as defined here |
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.
In this case, then we should maybe have a label pointing at the type E
definition saying "this is the hidden type", if we do what I mentioned earlier?
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 am not sure. Is is helpful to know where the opaque type is declared? If it were a struct or just a regular type alias, we would not be pointing at the definition either.
I could see it making sense to point at the definition for trait bound mismatches, as these are only written at the definition, but all the lifetimes are local to this function and could have confusingly different names on the declaration
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.
What about having a primary span saying "hiden type returned here" or something along those lines?
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.
🤣 yes, that is exactly what we need, but without lazy TAIT that is going to be a pain to figure out... or... hmm maybe not, I have an idea
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.
The idea would kind of work, but it's horrible and not something to do quickly
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'll love to hear about it
r? @estebank r=me with or without the nitpicks addressed (I see that this is blocking another PR, so if you don't want to deal with it we can create an E-easy ticket for someone else to tackle it) |
@bors r=estebank |
📌 Commit d3871f5 has been approved by |
… r=estebank Remove textual span from diagnostic string This is an unnecessary repetition, as the diagnostic prints the span anyway in the source path right below the message. I further removed the identification of the node, as that does not give any new information in any of the cases that are changed in tests. EDIT: also inserted a suggestion that other diagnostics were already emitting
@bors r- Failed in rollup: #89671 (comment) Looks like some more tests may need to be blessed. |
@bors r=estebank |
📌 Commit 09d1774 has been approved by |
… r=estebank Remove textual span from diagnostic string This is an unnecessary repetition, as the diagnostic prints the span anyway in the source path right below the message. I further removed the identification of the node, as that does not give any new information in any of the cases that are changed in tests. EDIT: also inserted a suggestion that other diagnostics were already emitting
@bors rollup=iffy |
09d1774
to
724bc1c
Compare
@bors r=estebank |
📌 Commit 724bc1cbd3161ab1581ab54789807731f3628056 has been approved by |
⌛ Testing commit 724bc1cbd3161ab1581ab54789807731f3628056 with merge 8e9f48623c91b6baadd21004928795845c9baa98... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
… on an impl trait
724bc1c
to
20d6aad
Compare
@bors r=estebank |
📌 Commit 20d6aad has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (dfc5add): comparison url. Summary: This change led to moderate relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
This is an unnecessary repetition, as the diagnostic prints the span anyway in the source path right below the message.
I further removed the identification of the node, as that does not give any new information in any of the cases that are changed in tests.
EDIT: also inserted a suggestion that other diagnostics were already emitting