diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-26 18:57:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-26 18:57:01 +0200 |
| commit | 571a9651433c97b1865ae399003fe31de9d04191 (patch) | |
| tree | 523f7a01085c881ef49ba49e6c18dfdd96bc6781 /src/librustc_errors | |
| parent | 0614a94d67a5dadc8b7e8aba451cb4cee45c9192 (diff) | |
| parent | dd0f2ac250e0f733cfbff5498c04312c96bb34fa (diff) | |
| download | rust-571a9651433c97b1865ae399003fe31de9d04191.tar.gz rust-571a9651433c97b1865ae399003fe31de9d04191.zip | |
Rollup merge of #62985 - phansch:support_ui_testing_flag, r=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: * https://github.com/rust-lang/annotate-snippets-rs/pull/3 * https://github.com/rust-lang/annotate-snippets-rs/pull/5 r? @estebank Closes #61811
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/librustc_errors/annotate_snippet_emitter_writer.rs | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 5a192e472aa..32f121f18f6 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -17,4 +17,4 @@ rustc_data_structures = { path = "../librustc_data_structures" } unicode-width = "0.1.4" atty = "0.2" termcolor = "1.0" -annotate-snippets = "0.5.0" +annotate-snippets = "0.6.1" diff --git a/src/librustc_errors/annotate_snippet_emitter_writer.rs b/src/librustc_errors/annotate_snippet_emitter_writer.rs index 3641d355ef1..96a9b6c5c4f 100644 --- a/src/librustc_errors/annotate_snippet_emitter_writer.rs +++ b/src/librustc_errors/annotate_snippet_emitter_writer.rs @@ -23,7 +23,7 @@ pub struct AnnotateSnippetEmitterWriter { source_map: Option<Lrc<SourceMapperDyn>>, /// If true, hides the longer explanation text short_message: bool, - /// If true, will normalize line numbers with LL to prevent noise in UI test diffs. + /// If true, will normalize line numbers with `LL` to prevent noise in UI test diffs. ui_testing: bool, } @@ -173,10 +173,6 @@ impl AnnotateSnippetEmitterWriter { /// Allows to modify `Self` to enable or disable the `ui_testing` flag. /// /// If this is set to true, line numbers will be normalized as `LL` in the output. - // FIXME(#59346): This method is used via the public interface, but setting the `ui_testing` - // flag currently does not anonymize line numbers. We would have to add the `maybe_anonymized` - // method from `emitter.rs` and implement rust-lang/annotate-snippets-rs#2 in order to - // anonymize line numbers. pub fn ui_testing(mut self, ui_testing: bool) -> Self { self.ui_testing = ui_testing; self @@ -202,7 +198,7 @@ impl AnnotateSnippetEmitterWriter { }; if let Some(snippet) = converter.to_annotation_snippet() { let dl = DisplayList::from(snippet); - let dlf = DisplayListFormatter::new(true); + let dlf = DisplayListFormatter::new(true, self.ui_testing); // FIXME(#59346): Figure out if we can _always_ print to stderr or not. // `emitter.rs` has the `Destination` enum that lists various possible output // destinations. |
