Skip to content

Commit 6f3df08

Browse files
committed
Auto merge of rust-lang#125378 - lcnr:tracing-no-lines, r=oli-obk
remove tracing tree indent lines This allows vscode to collapse nested spans without having to manually remove the indent lines. This is incredibly useful when logging the new solver. I don't mind making them optional depending on some environment flag if you prefer using indent lines For a gist of the new output, see https://gist.github.com/lcnr/bb4360ddbc5cd4631f2fbc569057e5eb#file-example-output-L181 r? `@oli-obk`
2 parents 7feb191 + 8160974 commit 6f3df08

File tree

12 files changed

+48
-43
lines changed

12 files changed

+48
-43
lines changed

compiler/rustc_log/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
103103

104104
let mut layer = tracing_tree::HierarchicalLayer::default()
105105
.with_writer(io::stderr)
106-
.with_indent_lines(true)
107106
.with_ansi(color_logs)
108107
.with_targets(true)
109108
.with_verbose_exit(verbose_entry_exit)

compiler/rustc_pattern_analysis/tests/common/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn init_tracing() {
1313
use tracing_subscriber::Layer;
1414
let _ = tracing_tree::HierarchicalLayer::default()
1515
.with_writer(std::io::stderr)
16-
.with_indent_lines(true)
1716
.with_ansi(true)
1817
.with_targets(true)
1918
.with_indent_amount(2)

compiler/rustc_trait_selection/src/solve/search_graph.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ impl<'tcx> SearchGraph<TyCtxt<'tcx>> {
281281
};
282282

283283
if let Some(result) = self.lookup_global_cache(tcx, input, available_depth, inspect) {
284+
debug!("global cache hit");
284285
return result;
285286
}
286287

@@ -365,7 +366,7 @@ impl<'tcx> SearchGraph<TyCtxt<'tcx>> {
365366
for _ in 0..FIXPOINT_STEP_LIMIT {
366367
match self.fixpoint_step_in_task(tcx, input, inspect, &mut prove_goal) {
367368
StepResult::Done(final_entry, result) => return (final_entry, result),
368-
StepResult::HasChanged => {}
369+
StepResult::HasChanged => debug!("fixpoint changed provisional results"),
369370
}
370371
}
371372

src/librustdoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ fn init_logging(early_dcx: &EarlyDiagCtxt) {
200200
let filter = tracing_subscriber::EnvFilter::from_env("RUSTDOC_LOG");
201201
let layer = tracing_tree::HierarchicalLayer::default()
202202
.with_writer(io::stderr)
203-
.with_indent_lines(true)
204203
.with_ansi(color_logs)
205204
.with_targets(true)
206205
.with_wraparound(10)

tests/run-make/rust-lld-by-default/rmake.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ fn main() {
1717
.input("main.rs")
1818
.run();
1919
assert!(
20-
find_lld_version_in_logs(output),
21-
"the LLD version string should be present in the output logs"
20+
find_lld_version_in_logs(&output),
21+
"the LLD version string should be present in the output logs:\n{}",
22+
std::str::from_utf8(&output.stderr).unwrap()
2223
);
2324

2425
// But it can still be disabled by turning the linker feature off.
@@ -29,13 +30,14 @@ fn main() {
2930
.input("main.rs")
3031
.run();
3132
assert!(
32-
!find_lld_version_in_logs(output),
33-
"the LLD version string should not be present in the output logs"
33+
!find_lld_version_in_logs(&output),
34+
"the LLD version string should not be present in the output logs:\n{}",
35+
std::str::from_utf8(&output.stderr).unwrap()
3436
);
3537
}
3638

37-
fn find_lld_version_in_logs(output: Output) -> bool {
39+
fn find_lld_version_in_logs(output: &Output) -> bool {
3840
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
3941
let stderr = std::str::from_utf8(&output.stderr).unwrap();
40-
stderr.lines().any(|line| lld_version_re.is_match(line))
42+
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
4143
}

tests/run-make/rust-lld-custom-target/rmake.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ fn main() {
2323
.input("lib.rs")
2424
.run();
2525
assert!(
26-
find_lld_version_in_logs(output),
27-
"the LLD version string should be present in the output logs"
26+
find_lld_version_in_logs(&output),
27+
"the LLD version string should be present in the output logs:\n{}",
28+
std::str::from_utf8(&output.stderr).unwrap()
2829
);
2930

3031
// But it can also be disabled via linker features.
@@ -37,13 +38,14 @@ fn main() {
3738
.input("lib.rs")
3839
.run();
3940
assert!(
40-
!find_lld_version_in_logs(output),
41-
"the LLD version string should not be present in the output logs"
41+
!find_lld_version_in_logs(&output),
42+
"the LLD version string should not be present in the output logs:\n{}",
43+
std::str::from_utf8(&output.stderr).unwrap()
4244
);
4345
}
4446

45-
fn find_lld_version_in_logs(output: Output) -> bool {
47+
fn find_lld_version_in_logs(output: &Output) -> bool {
4648
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
4749
let stderr = std::str::from_utf8(&output.stderr).unwrap();
48-
stderr.lines().any(|line| lld_version_re.is_match(line))
50+
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
4951
}

tests/run-make/rust-lld/rmake.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ fn main() {
2121
.input("main.rs")
2222
.run();
2323
assert!(
24-
find_lld_version_in_logs(output),
25-
"the LLD version string should be present in the output logs"
24+
find_lld_version_in_logs(&output),
25+
"the LLD version string should be present in the output logs:\n{}",
26+
std::str::from_utf8(&output.stderr).unwrap()
2627
);
2728

2829
// It should not be used when we explictly opt-out of lld.
@@ -33,8 +34,9 @@ fn main() {
3334
.input("main.rs")
3435
.run();
3536
assert!(
36-
!find_lld_version_in_logs(output),
37-
"the LLD version string should not be present in the output logs"
37+
!find_lld_version_in_logs(&output),
38+
"the LLD version string should not be present in the output logs:\n{}",
39+
std::str::from_utf8(&output.stderr).unwrap()
3840
);
3941

4042
// While we're here, also check that the last linker feature flag "wins" when passed multiple
@@ -50,13 +52,14 @@ fn main() {
5052
.input("main.rs")
5153
.run();
5254
assert!(
53-
find_lld_version_in_logs(output),
54-
"the LLD version string should be present in the output logs"
55+
find_lld_version_in_logs(&output),
56+
"the LLD version string should be present in the output logs:\n{}",
57+
std::str::from_utf8(&output.stderr).unwrap()
5558
);
5659
}
5760

58-
fn find_lld_version_in_logs(output: Output) -> bool {
61+
fn find_lld_version_in_logs(output: &Output) -> bool {
5962
let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
6063
let stderr = std::str::from_utf8(&output.stderr).unwrap();
61-
stderr.lines().any(|line| lld_version_re.is_match(line))
64+
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
6265
}

tests/ui/coherence/occurs-check/associated-type.next.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
2-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
3-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
4-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
1+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
2+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
3+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
4+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
55
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
66
--> $DIR/associated-type.rs:31:1
77
|

tests/ui/coherence/occurs-check/associated-type.old.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
2-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
3-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
4-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
5-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
6-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
7-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
8-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
1+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
2+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
3+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
4+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
5+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
6+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
7+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
8+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
99
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)`
1010
--> $DIR/associated-type.rs:31:1
1111
|

tests/ui/higher-ranked/structually-relate-aliases.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
2-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
1+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
2+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
33
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
44
--> $DIR/structually-relate-aliases.rs:13:36
55
|

tests/ui/self/arbitrary-self-from-method-substs.default.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 {
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
1111

12-
ERROR rustc_hir_typeck::method::confirm Foo was a subtype of &Foo but now is not?
12+
ERROR rustc_hir_typeck::method::confirm Foo was a subtype of &Foo but now is not?
1313
error: aborting due to 1 previous error
1414

1515
For more information about this error, try `rustc --explain E0658`.

tests/ui/traits/next-solver/issue-118950-root-region.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ help: this trait has no implementations, consider adding one
2525
LL | trait ToUnit<'a> {
2626
| ^^^^^^^^^^^^^^^^
2727

28-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
29-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
30-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
31-
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
28+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
29+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
30+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
31+
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
3232
error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
3333
--> $DIR/issue-118950-root-region.rs:19:1
3434
|

0 commit comments

Comments
 (0)