diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-03-17 13:34:15 +0400 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-03-17 13:34:15 +0400 |
| commit | 2a5208011d2a78d441bb72492812f618a8c24cfb (patch) | |
| tree | 0dcbeac45e2fca898a529082d0adb1ad2339bd16 /compiler/rustc_resolve/src | |
| parent | 511364e7874dba9649a264100407e4bffe7b5425 (diff) | |
| download | rust-2a5208011d2a78d441bb72492812f618a8c24cfb.tar.gz rust-2a5208011d2a78d441bb72492812f618a8c24cfb.zip | |
resolve: Improve debug impls for `NameBinding`
Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 5d40c6e4e48..6e27bcc5bf3 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -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) |
