Skip to content

Commit 0d4a56c

Browse files
authored
Rollup merge of rust-lang#109257 - petrochenkov:bindebug, r=WaffleLapkin
resolve: Improve debug impls for `NameBinding` Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves. Noticed while reviewing rust-lang#108729.
2 parents 01edab6 + 2a52080 commit 0d4a56c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler/rustc_resolve/src/imports.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,28 @@ impl<'a> std::fmt::Debug for ImportKind<'a> {
8585
Single {
8686
ref source,
8787
ref target,
88+
ref source_bindings,
89+
ref target_bindings,
8890
ref type_ns_only,
8991
ref nested,
9092
ref id,
91-
// Ignore the following to avoid an infinite loop while printing.
92-
source_bindings: _,
93-
target_bindings: _,
9493
} => f
9594
.debug_struct("Single")
9695
.field("source", source)
9796
.field("target", target)
97+
// Ignore the nested bindings to avoid an infinite loop while printing.
98+
.field(
99+
"source_bindings",
100+
&source_bindings.clone().map(|b| b.into_inner().map(|_| format_args!(".."))),
101+
)
102+
.field(
103+
"target_bindings",
104+
&target_bindings.clone().map(|b| b.into_inner().map(|_| format_args!(".."))),
105+
)
98106
.field("type_ns_only", type_ns_only)
99107
.field("nested", nested)
100108
.field("id", id)
101-
.finish_non_exhaustive(),
109+
.finish(),
102110
Glob { ref is_prelude, ref max_vis, ref id } => f
103111
.debug_struct("Glob")
104112
.field("is_prelude", is_prelude)

0 commit comments

Comments
 (0)