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

Start emitting labels even if their pointed to file is not available locally #104449

Merged
merged 14 commits into from
Dec 9, 2022

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Nov 15, 2022

r? @estebank

cc @RalfJung

fixes #97699

@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2022

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.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 15, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2022

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Copy link
Member

@RalfJung RalfJung left a 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!

@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2022

The Miri subtree was changed

cc @rust-lang/miri

@oli-obk oli-obk force-pushed the unhide_unknown_spans branch 3 times, most recently from 872ac59 to ad41e6c Compare November 15, 2022 17:04
@RalfJung
Copy link
Member

Nice redundancy reduction on the Miri backtraces. :)

@bors
Copy link
Contributor

bors commented Nov 16, 2022

☔ The latest upstream changes (presumably #104492) made this pull request unmergeable. Please resolve the merge conflicts.

Comment on lines 76 to 80
| inside `b`
| inside `b`
| inside `b`
| inside `b`
| inside `b`
Copy link
Contributor

@estebank estebank Nov 23, 2022

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"

| 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>` ...]
Copy link
Contributor

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!

Comment on lines 1 to 9
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
Copy link
Contributor

@estebank estebank Nov 23, 2022

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

Suggested change
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.

Copy link
Contributor

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?

Suggested change
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.

Copy link
Contributor

@estebank estebank Nov 23, 2022

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.)

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor

@estebank estebank left a 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.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 1, 2022

@bors r=estebank,RalfJung

@bors
Copy link
Contributor

bors commented Dec 1, 2022

📌 Commit c6f80a80e5620f40a9c973c987a61fc2f6cf678d has been approved by estebank,RalfJung

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2022
@bors
Copy link
Contributor

bors commented Dec 8, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 8, 2022
@ehuss
Copy link
Contributor

ehuss commented Dec 8, 2022

@bors retry

run-make/coverage-reports

@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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2022
@RalfJung
Copy link
Member

RalfJung commented Dec 8, 2022

Is it only this PR that keeps failing with coverage reports? That would be a bit suspicious.
@bors retry

@RalfJung
Copy link
Member

RalfJung commented Dec 8, 2022

I can't even find an issue tracking that clear_expected_if_blessed is noisy?

EDIT: opened #105475

@ehuss
Copy link
Contributor

ehuss commented Dec 8, 2022

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

@bors
Copy link
Contributor

bors commented Dec 9, 2022

⌛ Testing commit 717fdb5 with merge badd6a5...

@bors
Copy link
Contributor

bors commented Dec 9, 2022

☀️ Test successful - checks-actions
Approved by: estebank,RalfJung
Pushing badd6a5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 9, 2022
@bors bors merged commit badd6a5 into rust-lang:master Dec 9, 2022
@rustbot rustbot added this to the 1.67.0 milestone Dec 9, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-msvc-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

test result: FAILED. 46 passed; 1 failed; 29 ignored; 0 measured; 0 filtered out; finished in 13.26s

Build completed unsuccessfully in 1:05:42
make: *** [Makefile:73: ci-subset-1] Error 1

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (badd6a5): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
7.1% [7.1%, 7.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.9%, -1.8%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

@oli-obk oli-obk deleted the unhide_unknown_spans branch December 9, 2022 14:30
@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 13, 2022
…tebank

Make some diagnostics not depend on the source of what they reference being available

r? `@estebank`

follow up to rust-lang#104449
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…bank,RalfJung

Start emitting labels even if their pointed to file is not available locally

r? `@estebank`

cc `@RalfJung`

fixes rust-lang#97699
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. 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.

const_err spans not rendered when rust-src not installed
10 participants