-
Notifications
You must be signed in to change notification settings - Fork 47
Add option to anonymize line numbers #3
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
Conversation
|
One of my small gripes with Rust is that it doesn't have keyword arguments (yet?). That would make passing these boolean options much more understandable at the call sites. I'm not sure if there's currently a clearer way? |
you can always create structs with appropriate field names ;) |
With the current diagnostics emitter of Rust, the `-Z ui-testing` flag
allows to 'anonymize' line numbers in the UI test output.
This means that a line such as:
2 | concat!(b'f');
is turned into:
LL | concat!(b'f');
This is done because it makes the diff of UI test output changes much
less noisy.
To support this with `annotate-snippet`, we add a second parameter to
`DisplayListFormatter` that, when true, replaces the line numbers in the
left column with the text `LL`. The replacement text is always `LL` and
it does not affect the initial location line number.
In the new `annotate-snippet` emitter in rustc, we can then use this
parameter depending on whether the `-Z ui-testing` flag is set or not.
3d97fb9 to
d6c36a6
Compare
|
Replaced the magic constant. @zbraniecki what are your feelings regarding the change of the api of the |
Yep, it's an internal API, I'm fine with adjusting it later. |
|
I wonder... @bors r+ |
|
I guess not |
|
Thanks! I think this will also need a new release before it can be used in rustc, right? |
|
@zbraniecki (or someone else?) could you push a new version to crates.io? |
|
yeah, will do. |
|
done. 0.6.0 released. |
|
@phansch did you intend to turn also context lines (without numbers) to I see this: turned into: I think I'd expect: instead. |
|
Yeah I noticed that, too. That's a bug of the current implementation. My current plan is to only show (I've been a bit time restricted the past month or so but I want to get back into it again this month) |
This adds support for the `-Z ui-testing` flag to the new annotate-snippet diagnostic emitter. The support for the flag was added to `annotate-snippet-rs` in these PRs: * rust-lang/annotate-snippets-rs#3 * rust-lang/annotate-snippets-rs#5 Closes rust-lang#61811
…estebank librustc_errors: Support ui-testing flag in annotate-snippet emitter This adds support for the `-Z ui-testing` flag to the new annotate-snippet diagnostic emitter. Support for the flag was added to `annotate-snippet-rs` in these PRs: * rust-lang/annotate-snippets-rs#3 * rust-lang/annotate-snippets-rs#5 r? @estebank Closes rust-lang#61811
…estebank librustc_errors: Support ui-testing flag in annotate-snippet emitter This adds support for the `-Z ui-testing` flag to the new annotate-snippet diagnostic emitter. Support for the flag was added to `annotate-snippet-rs` in these PRs: * rust-lang/annotate-snippets-rs#3 * rust-lang/annotate-snippets-rs#5 r? @estebank Closes rust-lang#61811
…estebank librustc_errors: Support ui-testing flag in annotate-snippet emitter This adds support for the `-Z ui-testing` flag to the new annotate-snippet diagnostic emitter. Support for the flag was added to `annotate-snippet-rs` in these PRs: * rust-lang/annotate-snippets-rs#3 * rust-lang/annotate-snippets-rs#5 r? @estebank Closes rust-lang#61811
With the current diagnostics emitter of Rust, the
-Z ui-testingflagallows to 'anonymize' line numbers in the UI test output.
This means that a line such as:
is turned into:
This is done because it makes the diff of UI test output changes much
less noisy.
To support this with
annotate-snippet, we add a second parameter toDisplayListFormatterthat, when true, replaces the line numbers in theleft column with the text
LL. The replacement text is alwaysLLandit does not affect the initial location line number.
In the new
annotate-snippetemitter in rustc, we can then use thisparameter depending on whether the
-Z ui-testingflag is set or not.Closes #2
cc rust-lang/rust#59346