Skip to content

Commit

Permalink
Rollup merge of #109257 - petrochenkov:bindebug, r=WaffleLapkin
Browse files Browse the repository at this point in the history
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 #108729.
  • Loading branch information
matthiaskrgr authored Mar 17, 2023
2 parents 01edab6 + 2a52080 commit 0d4a56c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,28 @@ impl<'a> std::fmt::Debug for ImportKind<'a> {
Single {
ref source,
ref target,
ref source_bindings,
ref target_bindings,
ref type_ns_only,
ref nested,
ref id,
// Ignore the following to avoid an infinite loop while printing.
source_bindings: _,
target_bindings: _,
} => f
.debug_struct("Single")
.field("source", source)
.field("target", target)
// Ignore the nested bindings to avoid an infinite loop while printing.
.field(
"source_bindings",
&source_bindings.clone().map(|b| b.into_inner().map(|_| format_args!(".."))),
)
.field(
"target_bindings",
&target_bindings.clone().map(|b| b.into_inner().map(|_| format_args!(".."))),
)
.field("type_ns_only", type_ns_only)
.field("nested", nested)
.field("id", id)
.finish_non_exhaustive(),
.finish(),
Glob { ref is_prelude, ref max_vis, ref id } => f
.debug_struct("Glob")
.field("is_prelude", is_prelude)
Expand Down

0 comments on commit 0d4a56c

Please sign in to comment.