Address some comments
This commit is contained in:
parent
406e1dc8eb
commit
854b3166a0
9 changed files with 42 additions and 6 deletions
|
@ -559,7 +559,7 @@ impl Emitter for EmitterWriter {
|
|||
&primary_span,
|
||||
&children,
|
||||
&suggestions,
|
||||
Some(&diag.emitted_at),
|
||||
self.track_diagnostics.then_some(&diag.emitted_at),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1661,7 +1661,7 @@ impl EmitterWriter {
|
|||
}
|
||||
}
|
||||
|
||||
if self.track_diagnostics && let Some(tracked) = emitted_at {
|
||||
if let Some(tracked) = emitted_at {
|
||||
let track = format!("-Ztrack-diagnostics: created at {tracked}");
|
||||
let len = buffer.num_lines();
|
||||
buffer.append(len, &track, Style::NoStyle);
|
||||
|
|
|
@ -689,6 +689,7 @@ fn test_unstable_options_tracking_hash() {
|
|||
untracked!(time_llvm_passes, true);
|
||||
untracked!(time_passes, true);
|
||||
untracked!(trace_macros, true);
|
||||
untracked!(track_diagnostics, false);
|
||||
untracked!(trim_diagnostic_paths, false);
|
||||
untracked!(ui_testing, true);
|
||||
untracked!(unpretty, Some("expanded".to_string()));
|
||||
|
|
|
@ -1585,8 +1585,8 @@ options! {
|
|||
"choose the TLS model to use (`rustc --print tls-models` for details)"),
|
||||
trace_macros: bool = (false, parse_bool, [UNTRACKED],
|
||||
"for every macro invocation, print its name and arguments (default: no)"),
|
||||
track_diagnostics: bool = (false, parse_bool, [TRACKED],
|
||||
"Tracks where in rustc a diagnostic was emitted"),
|
||||
track_diagnostics: bool = (false, parse_bool, [UNTRACKED],
|
||||
"tracks where in rustc a diagnostic was emitted"),
|
||||
// Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved
|
||||
// alongside query results and changes to translation options can affect diagnostics - so
|
||||
// translation options should be tracked.
|
||||
|
|
|
@ -172,7 +172,7 @@ pub(crate) fn new_handler(
|
|||
unstable_opts.teach,
|
||||
diagnostic_width,
|
||||
false,
|
||||
false,
|
||||
unstable_opts.track_diagnostics,
|
||||
)
|
||||
.ui_testing(unstable_opts.ui_testing),
|
||||
)
|
||||
|
@ -191,7 +191,7 @@ pub(crate) fn new_handler(
|
|||
json_rendered,
|
||||
diagnostic_width,
|
||||
false,
|
||||
false,
|
||||
unstable_opts.track_diagnostics,
|
||||
)
|
||||
.ui_testing(unstable_opts.ui_testing),
|
||||
)
|
||||
|
|
6
src/test/rustdoc-ui/track-diagnostics.rs
Normal file
6
src/test/rustdoc-ui/track-diagnostics.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// compile-flags: -Z track-diagnostics
|
||||
// error-pattern: created at
|
||||
|
||||
struct A;
|
||||
struct B;
|
||||
const S: A = B;
|
10
src/test/rustdoc-ui/track-diagnostics.stderr
Normal file
10
src/test/rustdoc-ui/track-diagnostics.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/track-diagnostics.rs:6:14
|
||||
|
|
||||
LL | const S: A = B;
|
||||
| ^ expected struct `A`, found struct `B`
|
||||
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:2275:31
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -170,6 +170,7 @@
|
|||
-Z time-passes=val -- measure time of each rustc pass (default: no)
|
||||
-Z tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details)
|
||||
-Z trace-macros=val -- for every macro invocation, print its name and arguments (default: no)
|
||||
-Z track-diagnostics=val -- Tracks where in rustc a diagnostic was emitted
|
||||
-Z translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation)
|
||||
-Z translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics
|
||||
-Z translate-lang=val -- language identifier for diagnostic output
|
||||
|
|
8
src/tools/clippy/tests/ui/track-diagnostics.rs
Normal file
8
src/tools/clippy/tests/ui/track-diagnostics.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -Z track-diagnostics
|
||||
// error-pattern: created at
|
||||
|
||||
struct A;
|
||||
struct B;
|
||||
const S: A = B;
|
||||
|
||||
fn main() {}
|
10
src/tools/clippy/tests/ui/track-diagnostics.stderr
Normal file
10
src/tools/clippy/tests/ui/track-diagnostics.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/track-diagnostics.rs:6:14
|
||||
|
|
||||
LL | const S: A = B;
|
||||
| ^ expected struct `A`, found struct `B`
|
||||
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:2275:31
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Add table
Add a link
Reference in a new issue