Skip to content

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Aug 3, 2025

This PR started as a fix for a rendering bug that got noticed in #143661, but turned into a fix for any rendering bugs related to files with no source.

  • Don't add an end column separator after a file with no source
  • Add column separator before secondary messages with no source
  • Render continuation between no source labels

Before

error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
   ╰╴
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ╰ note: private field
   │
   ╰ note: private field

After

error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╰╴
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ├ note: private field
   │
   ╰ note: private field

Note: This PR also makes it so rustc and annotate-snippets match in these cases

@rustbot
Copy link
Collaborator

rustbot commented Aug 3, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Aug 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 3, 2025

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@rust-log-analyzer

This comment has been minimized.

@Muscraft Muscraft force-pushed the no-source-fixes branch 2 times, most recently from 0349864 to e29c33f Compare August 4, 2025 06:06
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Aug 26, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@jieyouxu jieyouxu assigned jieyouxu and unassigned SparrowLii Aug 27, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

@@ -6,7 +6,6 @@ LL | fn new() -> NoResult<MyEnum, String> {
--> $SRC_DIR/core/src/result.rs:LL:COL
|
= note: similarly named enum `Result` defined here
|
Copy link
Member

@jieyouxu jieyouxu Aug 28, 2025

Choose a reason for hiding this comment

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

Remark: hm, I wonder if the spacing originally was intended to help make the separation between the note vs the subsequent help clearer, but IMO this is not very different, so it's fine.

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 28, 2025

📌 Commit 2bd47d2 has been approved by jieyouxu

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 Aug 28, 2025
bors added a commit that referenced this pull request Aug 28, 2025
Rollup of 9 pull requests

Successful merges:

 - #142727 (wasm: rm static mut)
 - #143193 (Port `#[link]` to the new attribute parsing infrastructure )
 - #144864 (No source fixes)
 - #145913 (Add spin_loop hint for LoongArch)
 - #145926 (compiletest: Remove several remnants of the old libtest-based executor)
 - #145928 (Rename `Location::file_with_nul` to `file_as_c_str`)
 - #145930 (`const`ify (the unstable) `str::as_str`)
 - #145941 (Disable `integer_to_ptr_transmutes` suggestion for unsized types)
 - #145953 (Update `icu_list` to 2.0)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2fae59a into rust-lang:master Aug 28, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 28, 2025
@Muscraft Muscraft deleted the no-source-fixes branch August 28, 2025 16:49
rust-timer added a commit that referenced this pull request Aug 28, 2025
Rollup merge of #144864 - Muscraft:no-source-fixes, r=jieyouxu

No source fixes

This PR started as a fix for a rendering bug that [got noticed in #143661](#143661 (comment)), but turned into a fix for any rendering bugs related to files with no source.
- Don't add an end column separator after a file with no source
- Add column separator before secondary messages with no source
- Render continuation between no source labels

Before
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
   ╰╴
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ╰ note: private field
   │
   ╰ note: private field
```

After
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╰╴
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ├ note: private field
   │
   ╰ note: private field
```

Note: This PR also makes it so `rustc` and `annotate-snippets` match in these cases
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.

6 participants