-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Start emitting labels even if their pointed to file is not available locally #104449
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. Please see the contribution instructions for more information. |
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
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.
Can't check the emitter
stuff, but the CTFE part looks good!
652e268
to
8c99c63
Compare
The Miri subtree was changed cc @rust-lang/miri |
872ac59
to
ad41e6c
Compare
Nice redundancy reduction on the Miri backtraces. :) |
☔ The latest upstream changes (presumably #104492) made this pull request unmergeable. Please resolve the merge conflicts. |
ad41e6c
to
1aa0310
Compare
| inside `b` | ||
| inside `b` | ||
| inside `b` | ||
| inside `b` | ||
| inside `b` |
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.
It seems like we could afford to add some deduplication here (probably best on its own PR), maybe replacing this with a single span label message like "multiple times inside b
"
src/test/ui/consts/recursive.stderr
Outdated
| inside `f::<i32>` at $DIR/recursive.rs:4:5 | ||
| [... 126 additional calls inside `f::<i32>` at $DIR/recursive.rs:4:5 ...] | ||
| inside `f::<i32>` | ||
| [... 126 additional calls inside `f::<i32>` ...] |
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.
Oh! We already do some deduplication!
error[E0080]: evaluation of constant value failed | ||
/rustc/xyz/library/core/src/ptr/mod.rs:925:14: inside `swap_nonoverlapping::<MaybeUninit<u8>>` | ||
/rustc/xyz/library/core/src/ptr/mod.rs:944:9: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` | ||
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9 | ||
note: unable to copy parts of a pointer from memory at alloc10 | ||
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` | ||
/rustc/xyz/library/core/src/mem/mod.rs:773:17: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` | ||
| | ||
::: $DIR/missing_span_in_backtrace.rs:16:9 |
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 the expected output for these (which doesn't need to be followed, but I'd prefer to) would be
error[E0080]: evaluation of constant value failed | |
/rustc/xyz/library/core/src/ptr/mod.rs:925:14: inside `swap_nonoverlapping::<MaybeUninit<u8>>` | |
/rustc/xyz/library/core/src/ptr/mod.rs:944:9: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9 | |
note: unable to copy parts of a pointer from memory at alloc10 | |
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` | |
/rustc/xyz/library/core/src/mem/mod.rs:773:17: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` | |
| | |
::: $DIR/missing_span_in_backtrace.rs:16:9 | |
error[E0080]: evaluation of constant value failed | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9 | |
| | |
= /rustc/xyz/library/core/src/ptr/mod.rs:925:14: inside `swap_nonoverlapping::<MaybeUninit<u8>>` | |
= /rustc/xyz/library/core/src/ptr/mod.rs:944:9: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` | |
= note: unable to copy parts of a pointer from memory at alloc10 | |
= note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` | |
= /rustc/xyz/library/core/src/mem/mod.rs:773:17: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` | |
| | |
::: $DIR/missing_span_in_backtrace.rs:16:9 |
Aligning with the available path (so accounting for the biggest number shown in the gutter) and separating the message from the notes given no available span.
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.
Also, what about the following formatting?
error[E0080]: evaluation of constant value failed | |
/rustc/xyz/library/core/src/ptr/mod.rs:925:14: inside `swap_nonoverlapping::<MaybeUninit<u8>>` | |
/rustc/xyz/library/core/src/ptr/mod.rs:944:9: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9 | |
note: unable to copy parts of a pointer from memory at alloc10 | |
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` | |
/rustc/xyz/library/core/src/mem/mod.rs:773:17: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` | |
| | |
::: $DIR/missing_span_in_backtrace.rs:16:9 | |
error[E0080]: evaluation of constant value failed | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9 | |
| | |
note: inside `swap_nonoverlapping::<MaybeUninit<u8>>` | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:925:14 | |
| | |
note: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` | |
--> /rustc/xyz/library/core/src/ptr/mod.rs:944:9 | |
| | |
= note: unable to copy parts of a pointer from memory at alloc10 | |
= note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` | |
= /rustc/xyz/library/core/src/mem/mod.rs:773:17: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` | |
| | |
::: $DIR/missing_span_in_backtrace.rs:16:9 |
I also noticed that the new pseudo-notes come before the path for the main diagnostic, that should be changed.
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.
One last thing: if there are span labels for the primary span, they should be displayed first and as a = note:
without a path. I think that with all of these we stay inside the established grammar of the printed diagnostics. (But I don't think we have a test for that case.)
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.
At the emitter stage we do not have enough information to figure this out. Labels are reordered to fit the file structure. I will check if converting them to notes at const eval error time will still yield reasonable diagnostics
@@ -1410,6 +1406,42 @@ impl EmitterWriter { | |||
for annotated_file in annotated_files { | |||
// we can't annotate anything if the source is unavailable. | |||
if !sm.ensure_source_file_source_present(annotated_file.file.clone()) { | |||
if !self.short_message { | |||
// We'll just print an unannotated message. |
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.
Here is where we'd have to duplicate some of the printing logic for accurate gutter alignment. :-/
Ideally we'd dedup the logic, but it is fine as long as we have test coverage (which we do) and leave a comment in both places reminding us to modify logic in the other.
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 +1 on the changes as they are, but I have a bunch of nitpicks on the resulting output. The one I would love to have addressed before merging is ensuring the --> main diagnostic path
line comes before all the recovered span labels.
This comment has been minimized.
This comment has been minimized.
a9b2beb
to
c70be5d
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors r=estebank,RalfJung |
📌 Commit c6f80a80e5620f40a9c973c987a61fc2f6cf678d has been approved by It is now in the queue for this repository. |
💔 Test failed - checks-actions |
@bors retry run-make/coverage-reports |
Is it only this PR that keeps failing with coverage reports? That would be a bit suspicious. |
I can't even find an issue tracking that EDIT: opened #105475 |
@RalfJung It's all PRs. I started a thread on #t-infra. I'm tempted to close the tree, but it is not a 100% failure. |
☀️ Test successful - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Finished benchmarking commit (badd6a5): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…tebank Make some diagnostics not depend on the source of what they reference being available r? `@estebank` follow up to rust-lang#104449
…bank,RalfJung Start emitting labels even if their pointed to file is not available locally r? `@estebank` cc `@RalfJung` fixes rust-lang#97699
r? @estebank
cc @RalfJung
fixes #97699