-
Notifications
You must be signed in to change notification settings - Fork 13.9k
feat: Right align line numbers #144609
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
feat: Right align line numbers #144609
Conversation
|
|
|
This PR modifies cc @jieyouxu |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
@bors r+ rollup |
…rrors feat: Right align line numbers As part of my work on getting `annotate-snipptes` to be used as `rustc`'s renderer, I realized that `rustc` left-aligned line numbers, while `annotate-snippets` right-aligned them. This PR switches `rustc` to right-align the line numbers, matching `annotate-snippets`. In practice, this change isn't very noticeable in day-to-day output, as it only shows up when a diagnostic span contains line numbers with different lengths (9->10, 99->100, 999->1000, etc.). `rustc` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` `annotate-snippets` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` r? `@compiler-errors`
Rollup of 14 pull requests Successful merges: - #144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`) - #144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.) - #144407 (fix(debuginfo): disable overflow check for recursive non-enum types) - #144451 (fix: Reject upvar scrutinees for `loop_match`) - #144482 (Add explicit download methods to download module in bootstrap) - #144500 (thread name in stack overflow message) - #144511 (tidy: increase performance of auto extra checks feature) - #144586 (Update wasi-sdk to 27.0 in CI) - #144599 (bootstrap: enable tidy auto extra checks on tools profile) - #144600 (Ensure external paths passed via flags end up in rustdoc depinfo) - #144609 (feat: Right align line numbers) - #144623 (miri subtree update) - #144626 (cc dependencies: clarify comment) - #144627 (Add a test case for the issue #129882) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 13 pull requests Successful merges: - #144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`) - #144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.) - #144407 (fix(debuginfo): disable overflow check for recursive non-enum types) - #144451 (fix: Reject upvar scrutinees for `loop_match`) - #144482 (Add explicit download methods to download module in bootstrap) - #144500 (thread name in stack overflow message) - #144511 (tidy: increase performance of auto extra checks feature) - #144599 (bootstrap: enable tidy auto extra checks on tools profile) - #144600 (Ensure external paths passed via flags end up in rustdoc depinfo) - #144609 (feat: Right align line numbers) - #144623 (miri subtree update) - #144626 (cc dependencies: clarify comment) - #144627 (Add a test case for the issue #129882) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144609 - Muscraft:right-align, r=compiler-errors feat: Right align line numbers As part of my work on getting `annotate-snipptes` to be used as `rustc`'s renderer, I realized that `rustc` left-aligned line numbers, while `annotate-snippets` right-aligned them. This PR switches `rustc` to right-align the line numbers, matching `annotate-snippets`. In practice, this change isn't very noticeable in day-to-day output, as it only shows up when a diagnostic span contains line numbers with different lengths (9->10, 99->100, 999->1000, etc.). `rustc` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` `annotate-snippets` ``` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:92:10 | 4 | type A = B; | ----------- similarly named type alias `A` defined here ... 92 | type E = F; | ^ help: a type alias with a similar name exists: `A` ``` r? ``@compiler-errors``
Rollup of 13 pull requests Successful merges: - rust-lang/rust#144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`) - rust-lang/rust#144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.) - rust-lang/rust#144407 (fix(debuginfo): disable overflow check for recursive non-enum types) - rust-lang/rust#144451 (fix: Reject upvar scrutinees for `loop_match`) - rust-lang/rust#144482 (Add explicit download methods to download module in bootstrap) - rust-lang/rust#144500 (thread name in stack overflow message) - rust-lang/rust#144511 (tidy: increase performance of auto extra checks feature) - rust-lang/rust#144599 (bootstrap: enable tidy auto extra checks on tools profile) - rust-lang/rust#144600 (Ensure external paths passed via flags end up in rustdoc depinfo) - rust-lang/rust#144609 (feat: Right align line numbers) - rust-lang/rust#144623 (miri subtree update) - rust-lang/rust#144626 (cc dependencies: clarify comment) - rust-lang/rust#144627 (Add a test case for the issue rust-lang/rust#129882) r? `@ghost` `@rustbot` modify labels: rollup
|
EDIT: Ah sorry I think this may have been an issue with an older version of trybuild's normalization combined with this PR, rather than this PR itself, my apologies. It looks fixed in trybuild 1.0.110. Original report below. Original reportI've noticed (I think after this change) on beta and nightly, the indentation of the I don't see any test cases covering this in the PR, perhaps it was overlooked? Example on NightlySee the third line here above the |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [trybuild](https://redirect.github.com/dtolnay/trybuild) | workspace.dependencies | patch | `1.0.106` -> `1.0.110` | --- ### Release Notes <details> <summary>dtolnay/trybuild (trybuild)</summary> ### [`v1.0.110`](https://redirect.github.com/dtolnay/trybuild/releases/tag/1.0.110) [Compare Source](https://redirect.github.com/dtolnay/trybuild/compare/1.0.109...1.0.110) - Fix permissions\_set\_readonly\_false warning ([#​312](https://redirect.github.com/dtolnay/trybuild/issues/312)) ### [`v1.0.109`](https://redirect.github.com/dtolnay/trybuild/releases/tag/1.0.109) [Compare Source](https://redirect.github.com/dtolnay/trybuild/compare/1.0.108...1.0.109) - Support read-only Cargo.lock files ([#​310](https://redirect.github.com/dtolnay/trybuild/issues/310), thanks [@​MingweiSamuel](https://redirect.github.com/MingweiSamuel)) ### [`v1.0.108`](https://redirect.github.com/dtolnay/trybuild/releases/tag/1.0.108) [Compare Source](https://redirect.github.com/dtolnay/trybuild/compare/1.0.107...1.0.108) - More right-aligned line number fixes ([#​309](https://redirect.github.com/dtolnay/trybuild/issues/309)) ### [`v1.0.107`](https://redirect.github.com/dtolnay/trybuild/releases/tag/1.0.107) [Compare Source](https://redirect.github.com/dtolnay/trybuild/compare/1.0.106...1.0.107) - Recognize right aligned line numbers ([#​308](https://redirect.github.com/dtolnay/trybuild/issues/308), [rust-lang/rust#144609](https://redirect.github.com/rust-lang/rust/pull/144609)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 05:59 AM, on day 24 of the month ( * 0-5 24 * * ) (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/jerus-org/captval). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS44MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuODIuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Problem: rust-lang/rust@aa97672 right aligned line numbers & this change was released in Rust 1.90. This causes our trybuild driven ui-tests to fail because the line number differs. Solution: Fix the line numbering in the test's stderr file & bump our min trybuild dependency to v1.0.107 because that is the first version that recognizes right aligned line numbers. Testing: Ran `cargo +1.90 test` and saw that it worked. Also tested specifying `trybuild = "=1.0.n" and saw that n=108 was the lowest working version. Ref: rust-lang/rust#144609 Ref: dtolnay/trybuild#308 Ref: dtolnay/trybuild#315
Problem: rust-lang/rust@aa97672 right aligned line numbers & this change was released in Rust 1.90. This causes our trybuild driven ui-tests to fail because the line number differs. Solution: Fix the line numbering in the test's stderr file & bump our min trybuild dependency to v1.0.108 because that is the first version that recognizes right aligned line numbers. Testing: Ran `cargo +1.90 test` and saw that it worked. Also tested specifying `trybuild = "=1.0.n" and saw that n=108 was the lowest working version. Ref: rust-lang/rust#144609 Ref: dtolnay/trybuild#308 Ref: dtolnay/trybuild#315
As part of my work on getting
annotate-snipptesto be used asrustc's renderer, I realized thatrustcleft-aligned line numbers, whileannotate-snippetsright-aligned them. This PR switchesrustcto right-align the line numbers, matchingannotate-snippets. In practice, this change isn't very noticeable in day-to-day output, as it only shows up when a diagnostic span contains line numbers with different lengths (9->10, 99->100, 999->1000, etc.).rustcannotate-snippetsr? @compiler-errors