1
Fork 0

Use enum2<_> instead of enum<_> for Cpp-like debuginfo enum type names.

And add more comments about niche tag enum encoding.
This commit is contained in:
Michael Woerister 2022-07-07 15:01:43 +02:00
parent 622da5d834
commit 063ebfa570
10 changed files with 87 additions and 73 deletions

View file

@ -68,7 +68,7 @@ const SINGLE_VARIANT_VIRTUAL_DISR: u64 = 0;
/// It's roughly equivalent to the following C/C++ code: /// It's roughly equivalent to the following C/C++ code:
/// ///
/// ```c /// ```c
/// union enum$<{fully-qualified-name}> { /// union enum2$<{fully-qualified-name}> {
/// struct Variant0 { /// struct Variant0 {
/// struct {name-of-variant-0} { /// struct {name-of-variant-0} {
/// <variant 0 fields> /// <variant 0 fields>
@ -91,12 +91,27 @@ const SINGLE_VARIANT_VIRTUAL_DISR: u64 = 0;
/// } /// }
/// ``` /// ```
/// ///
/// As you can see, the type name is wrapped `enum$`. This way we can have a /// As you can see, the type name is wrapped in `enum2$<_>`. This way we can
/// single NatVis rule for handling all enums. /// have a single NatVis rule for handling all enums. The `2` in `enum2$<_>`
/// is an encoding version tag, so that debuggers can decide to decode this
/// differently than the previous `enum$<_>` encoding emitted by earlier
/// compiler versions.
/// ///
/// For niche-tag enums, a variant might correspond to a range of tag values. /// Niche-tag enums have one special variant, usually called the
/// In that case the variant struct has a `DISCR_BEGIN` and `DISCR_END` field /// "dataful variant". This variant has a field that
/// instead of DISCR_EXACT. /// doubles as the tag of the enum. The variant is active when the value of
/// that field is within a pre-defined range. Therefore the variant struct
/// has a `DISCR_BEGIN` and `DISCR_END` field instead of `DISCR_EXACT` in
/// that case. Both `DISCR_BEGIN` and `DISCR_END` are inclusive bounds.
/// Note that these ranges can wrap around, so that `DISCR_END < DISCR_BEGIN`.
///
/// The field in the top-level union that corresponds to the dataful variant
/// is called `variant_fallback` instead of `variant<index>`. This is mainly
/// an optimization that enables a shorter NatVis definition. That way we
/// only need to specify a `tag == variantX.DISCR_EXACT` entry for the indexed
/// variants. Otherwise we'd need to have that and then an additional entry
/// checking `in_range(variantX.DISCR_BEGIN, variantX.DISCR_END)` for each
/// index.
/// ///
/// Single-variant enums don't actually have a tag field. In this case we /// Single-variant enums don't actually have a tag field. In this case we
/// emit a static tag field (that always has the value 0) so we can use the /// emit a static tag field (that always has the value 0) so we can use the

View file

@ -389,7 +389,7 @@ fn push_debuginfo_type_name<'tcx>(
// Name will be "{closure_env#0}<T1, T2, ...>", "{generator_env#0}<T1, T2, ...>", or // Name will be "{closure_env#0}<T1, T2, ...>", "{generator_env#0}<T1, T2, ...>", or
// "{async_fn_env#0}<T1, T2, ...>", etc. // "{async_fn_env#0}<T1, T2, ...>", etc.
// In the case of cpp-like debuginfo, the name additionally gets wrapped inside of // In the case of cpp-like debuginfo, the name additionally gets wrapped inside of
// an artificial `enum$<>` type, as defined in msvc_enum_fallback(). // an artificial `enum2$<>` type, as defined in msvc_enum_fallback().
if cpp_like_debuginfo && t.is_generator() { if cpp_like_debuginfo && t.is_generator() {
let ty_and_layout = tcx.layout_of(ParamEnv::reveal_all().and(t)).unwrap(); let ty_and_layout = tcx.layout_of(ParamEnv::reveal_all().and(t)).unwrap();
msvc_enum_fallback( msvc_enum_fallback(
@ -434,7 +434,7 @@ fn push_debuginfo_type_name<'tcx>(
visited: &mut FxHashSet<Ty<'tcx>>, visited: &mut FxHashSet<Ty<'tcx>>,
) { ) {
debug_assert!(!wants_c_like_enum_debuginfo(ty_and_layout)); debug_assert!(!wants_c_like_enum_debuginfo(ty_and_layout));
output.push_str("enum$<"); output.push_str("enum2$<");
push_inner(output, visited); push_inner(output, visited);
push_close_angle_bracket(true, output); push_close_angle_bracket(true, output);
} }

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="str"> <Type Name="str">
<DisplayString>{(char*)data_ptr,[length]s8}</DisplayString> <DisplayString>{(char*)data_ptr,[length]s8}</DisplayString>
@ -154,7 +154,7 @@
This is the visualizer for all enums. It takes care of selecting the active variant. This is the visualizer for all enums. It takes care of selecting the active variant.
See `compiler\rustc_codegen_llvm\src\debuginfo\metadata\enums\cpp_like.rs` for more information. See `compiler\rustc_codegen_llvm\src\debuginfo\metadata\enums\cpp_like.rs` for more information.
--> -->
<Type Name="enum$&lt;*&gt;"> <Type Name="enum2$&lt;*&gt;">
<Intrinsic Name="in_range" Expression="(start &lt;= end) ? ((tag &gt;= start) &amp;&amp; (tag &lt;= end)) : ((tag &gt;= start) || (tag &lt;= end))"> <Intrinsic Name="in_range" Expression="(start &lt;= end) ? ((tag &gt;= start) &amp;&amp; (tag &lt;= end)) : ((tag &gt;= start) || (tag &lt;= end))">
<Parameter Name="start" Type="unsigned __int64" /> <Parameter Name="start" Type="unsigned __int64" />
<Parameter Name="end" Type="unsigned __int64" /> <Parameter Name="end" Type="unsigned __int64" />

View file

@ -41,26 +41,26 @@
// cdb-command: g // cdb-command: g
// cdb-command: dx b // cdb-command: dx b
// cdb-check: b : Unresumed [Type: enum$<generator_objects::main::generator_env$0>] // cdb-check: b : Unresumed [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g // cdb-command: g
// cdb-command: dx b // cdb-command: dx b
// cdb-check: b : Suspend0 [Type: enum$<generator_objects::main::generator_env$0>] // cdb-check: b : Suspend0 [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] c : 6 [Type: int] // cdb-check: [+0x[...]] c : 6 [Type: int]
// cdb-check: [+0x[...]] d : 7 [Type: int] // cdb-check: [+0x[...]] d : 7 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g // cdb-command: g
// cdb-command: dx b // cdb-command: dx b
// cdb-check: b : Suspend1 [Type: enum$<generator_objects::main::generator_env$0>] // cdb-check: b : Suspend1 [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] c : 7 [Type: int] // cdb-check: [+0x[...]] c : 7 [Type: int]
// cdb-check: [+0x[...]] d : 8 [Type: int] // cdb-check: [+0x[...]] d : 8 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
// cdb-command: g // cdb-command: g
// cdb-command: dx b // cdb-command: dx b
// cdb-check: b : Returned [Type: enum$<generator_objects::main::generator_env$0>] // cdb-check: b : Returned [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *] // cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] #![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]

View file

@ -4,106 +4,105 @@
// cdb-command: g // cdb-command: g
// cdb-command: dx a // cdb-command: dx a
// cdb-check:a : Some [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum> >] // cdb-check:a : Some [Type: enum2$<core::option::Option<msvc_pretty_enums::CStyleEnum> >]
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum] // cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx b // cdb-command: dx b
// cdb-check:b : None [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum> >] // cdb-check:b : None [Type: enum2$<core::option::Option<msvc_pretty_enums::CStyleEnum> >]
// cdb-command: dx c // cdb-command: dx c
// cdb-check:c : Tag1 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum>] // cdb-check:c : Tag1 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-command: dx d // cdb-command: dx d
// cdb-check:d : Data [Type: enum$<msvc_pretty_enums::NicheLayoutEnum>] // cdb-check:d : Data [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum] // cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx e // cdb-command: dx e
// cdb-check:e : Tag2 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum>] // cdb-check:e : Tag2 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-command: dx f // cdb-command: dx f
// cdb-check:f : Some [Type: enum$<core::option::Option<ref$<u32> > >] // cdb-check:f : Some [Type: enum2$<core::option::Option<ref$<u32> > >]
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *] // cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
// cdb-command: dx g // cdb-command: dx g
// cdb-check:g : None [Type: enum$<core::option::Option<ref$<u32> > >] // cdb-check:g : None [Type: enum2$<core::option::Option<ref$<u32> > >]
// cdb-command: dx h // cdb-command: dx h
// cdb-check:h : Some [Type: enum$<core::option::Option<u32> >] // cdb-check:h : Some [Type: enum2$<core::option::Option<u32> >]
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int] // cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
// cdb-command: dx i // cdb-command: dx i
// cdb-check:i : None [Type: enum$<core::option::Option<u32> >] // cdb-check:i : None [Type: enum2$<core::option::Option<u32> >]
// cdb-command: dx j // cdb-command: dx j
// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum] // cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx k // cdb-command: dx k
// cdb-check:k : Some [Type: enum$<core::option::Option<alloc::string::String> >] // cdb-check:k : Some [Type: enum2$<core::option::Option<alloc::string::String> >]
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String] // cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
// cdb-command: dx l // cdb-command: dx l
// cdb-check:l : Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> > >] // cdb-check:l : Ok [Type: enum2$<core::result::Result<u32,enum2$<msvc_pretty_enums::Empty> > >]
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int] // cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
// cdb-command: dx niche128_some // cdb-command: dx niche128_some
// cdb-check:niche128_some : Some [Type: enum$<core::option::Option<core::num::nonzero::NonZeroI128> >] // cdb-check: niche128_some : Some [Type: enum2$<core::option::Option<core::num::nonzero::NonZeroI128> >]
// Note: we can't actually read the value of the field because CDB cannot handle 128 bit integers. // Note: we can't actually read the value of the field because CDB cannot handle 128 bit integers.
// cdb-check: [+0x000] __0 [...] [Type: core::num::nonzero::NonZeroI128] // cdb-check: [+0x000] __0 [...] [Type: core::num::nonzero::NonZeroI128]
// cdb-command: dx niche128_none // cdb-command: dx niche128_none
// cdb-check: niche128_none : None [Type: enum$<core::option::Option<core::num::nonzero::NonZeroI128> >] // cdb-check: niche128_none : None [Type: enum2$<core::option::Option<core::num::nonzero::NonZeroI128> >]
// cdb-command: dx niche_w_fields_1_some,d // cdb-command: dx niche_w_fields_1_some,d
// cdb-check: niche_w_fields_1_some,d : A [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields1>] // cdb-check: niche_w_fields_1_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields1>]
// cdb-check: [+0x[...]] __0 : 0x[...] : 77 [Type: unsigned char *] // cdb-check: [+0x[...]] __0 : 0x[...] : 77 [Type: unsigned char *]
// cdb-check: [+0x[...]] __1 : 7 [Type: unsigned int] // cdb-check: [+0x[...]] __1 : 7 [Type: unsigned int]
// cdb-command: dx niche_w_fields_1_none,d // cdb-command: dx niche_w_fields_1_none,d
// cdb-check: niche_w_fields_1_none,d : B [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields1>] // cdb-check: niche_w_fields_1_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields1>]
// cdb-check: [+0x[...]] __0 : 99 [Type: unsigned int] // cdb-check: [+0x[...]] __0 : 99 [Type: unsigned int]
// cdb-command: dx niche_w_fields_2_some,d // cdb-command: dx niche_w_fields_2_some,d
// cdb-check: niche_w_fields_2_some,d : A [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields2>] // cdb-check: niche_w_fields_2_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields2>]
// cdb-check: [+0x[...]] __0 : 800 [Type: core::num::nonzero::NonZeroU32] // cdb-check: [+0x[...]] __0 : 800 [Type: core::num::nonzero::NonZeroU32]
// cdb-check: [+0x[...]] __1 : 900 [Type: unsigned __int64] // cdb-check: [+0x[...]] __1 : 900 [Type: unsigned __int64]
// cdb-command: dx niche_w_fields_2_none,d // cdb-command: dx niche_w_fields_2_none,d
// cdb-check: niche_w_fields_2_none,d : B [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields2>] // cdb-check: niche_w_fields_2_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
// cdb-check: [+0x[...]] __0 : 1000 [Type: unsigned __int64] // cdb-check: [+0x[...]] __0 : 1000 [Type: unsigned __int64]
// cdb-command: dx niche_w_fields_3_some,d // cdb-command: dx niche_w_fields_3_some,d
// cdb-check: niche_w_fields_3_some,d : A [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-check: [+0x[...]] __0 : 137 [Type: unsigned char] // cdb-check: [+0x[...]] __0 : 137 [Type: unsigned char]
// cdb-check: [+0x[...]] __1 : true [Type: bool] // cdb-check: [+0x[...]] __1 : true [Type: bool]
// cdb-command: dx niche_w_fields_3_niche1,d // cdb-command: dx niche_w_fields_3_niche1,d
// cdb-check: niche_w_fields_3_niche1,d : B [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_niche1,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-check: [+0x[...]] __0 : 12 [Type: unsigned char] // cdb-check: [+0x[...]] __0 : 12 [Type: unsigned char]
// cdb-command: dx niche_w_fields_3_niche2,d // cdb-command: dx niche_w_fields_3_niche2,d
// cdb-check: niche_w_fields_3_niche2,d : C [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_niche2,d : C [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-check: [+0x[...]] __0 : false [Type: bool] // cdb-check: [+0x[...]] __0 : false [Type: bool]
// cdb-command: dx niche_w_fields_3_niche3,d // cdb-command: dx niche_w_fields_3_niche3,d
// cdb-check: niche_w_fields_3_niche3,d : D [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_niche3,d : D [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-check: [+0x[...]] __0 : 34 [Type: unsigned char] // cdb-check: [+0x[...]] __0 : 34 [Type: unsigned char]
// cdb-command: dx niche_w_fields_3_niche4,d // cdb-command: dx niche_w_fields_3_niche4,d
// cdb-check: niche_w_fields_3_niche4,d : E [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_niche4,d : E [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-check: [+0x[...]] __0 : 56 [Type: unsigned char] // cdb-check: [+0x[...]] __0 : 56 [Type: unsigned char]
// cdb-command: dx niche_w_fields_3_niche5,d // cdb-command: dx niche_w_fields_3_niche5,d
// cdb-check: niche_w_fields_3_niche5,d : F [Type: enum$<msvc_pretty_enums::NicheLayoutWithFields3>] // cdb-check: niche_w_fields_3_niche5,d : F [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
// cdb-command: dx -r3 niche_w_fields_std_result_ok,d // cdb-command: dx -r3 niche_w_fields_std_result_ok,d
// cdb-check: niche_w_fields_std_result_ok,d : Ok [Type: enum$<core::result::Result<alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>,u64> >] // cdb-check: niche_w_fields_std_result_ok,d : Ok [Type: enum2$<core::result::Result<alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>,u64> >]
// cdb-check: [+0x[...]] __0 [Type: alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>] // cdb-check: [+0x[...]] __0 [Type: alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>]
// cdb-check: [+0x[...]] data_ptr : [...] // cdb-check: [+0x[...]] data_ptr : [...]
// cdb-check: [+0x[...]] length : 3 [...] // cdb-check: [+0x[...]] length : 3 [...]
// cdb-command: dx -r3 niche_w_fields_std_result_err,d // cdb-command: dx -r3 niche_w_fields_std_result_err,d
// cdb-check: niche_w_fields_std_result_err,d : Err [Type: enum$<core::result::Result<alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>,u64> >] // cdb-check: niche_w_fields_std_result_err,d : Err [Type: enum2$<core::result::Result<alloc::boxed::Box<slice$<u8>,alloc::alloc::Global>,u64> >]
// cdb-check: [+0x[...]] __0 : 789 [Type: unsigned __int64] // cdb-check: [+0x[...]] __0 : 789 [Type: unsigned __int64]
use std::num::{NonZeroI128, NonZeroU32}; use std::num::{NonZeroI128, NonZeroU32};

View file

@ -18,10 +18,10 @@
// cdb-command: g // cdb-command: g
// cdb-command: dx o1 // cdb-command: dx o1
// cdb-check:o1 : Some [Type: enum$<core::option::Option<u32> >] // cdb-check:o1 : Some [Type: enum2$<core::option::Option<u32> >]
// cdb-check: [+0x004] __0 : 0x4d2 [Type: [...]] // cdb-check: [+0x004] __0 : 0x4d2 [Type: [...]]
// cdb-command: dx o2 // cdb-command: dx o2
// cdb-check:o2 : Some [Type: enum$<core::option::Option<u64> >] // cdb-check:o2 : Some [Type: enum2$<core::option::Option<u64> >]
// cdb-check: [+0x008] __0 : 0x162e [Type: unsigned __int64] // cdb-check: [+0x008] __0 : 0x162e [Type: unsigned __int64]
// cdb-command: g // cdb-command: g

View file

@ -21,15 +21,14 @@
// //
// cdb-command:dx lock,d // cdb-command:dx lock,d
// cdb-check:lock,d : Ok [Type: enum$<core::result::Result<std::sync::mutex::MutexGuard<i32>,enum$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> >, 0, 1, Poisoned> > >] // cdb-check:lock,d : Ok [Type: enum2$<core::result::Result<std::sync::mutex::MutexGuard<i32>,enum2$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> >, 0, 1, Poisoned> > >]
// cdb-check: [variant] : Ok // cdb-check: [variant] : Ok
// cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>] // cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>]
use std::sync::Mutex; use std::sync::Mutex;
#[allow(unused_variables)] #[allow(unused_variables)]
fn main() fn main() {
{
let m = Mutex::new(0); let m = Mutex::new(0);
let lock = m.try_lock(); let lock = m.try_lock();
zzz(); // #break zzz(); // #break

View file

@ -116,17 +116,17 @@
// cdb-check: [chars] : "IAMA OS string [...]" // cdb-check: [chars] : "IAMA OS string [...]"
// cdb-command: dx some // cdb-command: dx some
// cdb-check:some : Some [Type: enum$<core::option::Option<i16> >] // cdb-check:some : Some [Type: enum2$<core::option::Option<i16> >]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i16> >] // cdb-check: [<Raw View>] [Type: enum2$<core::option::Option<i16> >]
// cdb-check: [+0x002] __0 : 8 [Type: short] // cdb-check: [+0x002] __0 : 8 [Type: short]
// cdb-command: dx none // cdb-command: dx none
// cdb-check:none : None [Type: enum$<core::option::Option<i64> >] // cdb-check:none : None [Type: enum2$<core::option::Option<i64> >]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i64> >] // cdb-check: [<Raw View>] [Type: enum2$<core::option::Option<i64> >]
// cdb-command: dx some_string // cdb-command: dx some_string
// cdb-check:some_string : Some [Type: enum$<core::option::Option<alloc::string::String> >] // cdb-check:some_string : Some [Type: enum2$<core::option::Option<alloc::string::String> >]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String> >] // cdb-check: [<Raw View>] [Type: enum2$<core::option::Option<alloc::string::String> >]
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String] // cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
// cdb-command: dx linkedlist // cdb-command: dx linkedlist

View file

@ -7,15 +7,14 @@
// cdb-command: g // cdb-command: g
// cdb-command: dx x,d // cdb-command: dx x,d
// cdb-check:x,d : Ok [Type: enum$<core::result::Result<i32,str> >] // cdb-check:x,d : Ok [Type: enum2$<core::result::Result<i32,str> >]
// cdb-check: [...] __0 : -3 [Type: int] // cdb-check: [...] __0 : -3 [Type: int]
// cdb-command: dx y // cdb-command: dx y
// cdb-check:y : Err [Type: enum$<core::result::Result<i32,str> >] // cdb-check:y : Err [Type: enum2$<core::result::Result<i32,str> >]
// cdb-check: [...] __0 : "Some error message" [Type: str] // cdb-check: [...] __0 : "Some error message" [Type: str]
fn main() fn main() {
{
let x: Result<i32, &str> = Ok(-3); let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_ok(), true); assert_eq!(x.is_ok(), true);
@ -25,4 +24,6 @@ fn main()
zzz(); // #break. zzz(); // #break.
} }
fn zzz() { () } fn zzz() {
()
}

View file

@ -175,51 +175,51 @@
// 0-sized structs appear to be optimized away in some cases, so only check the structs that do // 0-sized structs appear to be optimized away in some cases, so only check the structs that do
// actually appear. // actually appear.
// cdb-command:dv /t *_struct // cdb-command:dv /t *_struct
// cdb-check:struct type_names::GenericStruct<enum$<type_names::mod1::Enum2>,f64> mut_generic_struct = [...] // cdb-check:struct type_names::GenericStruct<enum2$<type_names::mod1::Enum2>,f64> mut_generic_struct = [...]
// ENUMS // ENUMS
// cdb-command:dv /t *_enum_* // cdb-command:dv /t *_enum_*
// cdb-check:union enum$<type_names::Enum1> simple_enum_1 = [...] // cdb-check:union enum2$<type_names::Enum1> simple_enum_1 = [...]
// cdb-check:union enum$<type_names::Enum1> simple_enum_2 = [...] // cdb-check:union enum2$<type_names::Enum1> simple_enum_2 = [...]
// cdb-check:union enum$<type_names::mod1::Enum2> simple_enum_3 = [...] // cdb-check:union enum2$<type_names::mod1::Enum2> simple_enum_3 = [...]
// cdb-check:union enum$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > generic_enum_1 = [...] // cdb-check:union enum2$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > generic_enum_1 = [...]
// cdb-check:union enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > generic_enum_2 = [...] // cdb-check:union enum2$<type_names::mod1::mod2::Enum3<type_names::Struct1> > generic_enum_2 = [...]
// TUPLES // TUPLES
// cdb-command:dv /t tuple* // cdb-command:dv /t tuple*
// cdb-check:struct tuple$<u32,type_names::Struct1,enum$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > > tuple1 = [...] // cdb-check:struct tuple$<u32,type_names::Struct1,enum2$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > > tuple1 = [...]
// cdb-check:struct tuple$<tuple$<type_names::Struct1,type_names::mod1::mod2::Struct3>,enum$<type_names::mod1::Enum2>,char> tuple2 = [...] // cdb-check:struct tuple$<tuple$<type_names::Struct1,type_names::mod1::mod2::Struct3>,enum2$<type_names::mod1::Enum2>,char> tuple2 = [...]
// BOX // BOX
// cdb-command:dv /t box* // cdb-command:dv /t box*
// cdb-check:struct tuple$<alloc::boxed::Box<f32,alloc::alloc::Global>,i32> box1 = [...] // cdb-check:struct tuple$<alloc::boxed::Box<f32,alloc::alloc::Global>,i32> box1 = [...]
// cdb-check:struct tuple$<alloc::boxed::Box<enum$<type_names::mod1::mod2::Enum3<f32> >,alloc::alloc::Global>,i32> box2 = [...] // cdb-check:struct tuple$<alloc::boxed::Box<enum2$<type_names::mod1::mod2::Enum3<f32> >,alloc::alloc::Global>,i32> box2 = [...]
// REFERENCES // REFERENCES
// cdb-command:dv /t *ref* // cdb-command:dv /t *ref*
// cdb-check:struct tuple$<ref$<type_names::Struct1>,i32> ref1 = [...] // cdb-check:struct tuple$<ref$<type_names::Struct1>,i32> ref1 = [...]
// cdb-check:struct tuple$<ref$<type_names::GenericStruct<char,type_names::Struct1> >,i32> ref2 = [...] // cdb-check:struct tuple$<ref$<type_names::GenericStruct<char,type_names::Struct1> >,i32> ref2 = [...]
// cdb-check:struct tuple$<ref_mut$<type_names::Struct1>,i32> mut_ref1 = [...] // cdb-check:struct tuple$<ref_mut$<type_names::Struct1>,i32> mut_ref1 = [...]
// cdb-check:struct tuple$<ref_mut$<type_names::GenericStruct<enum$<type_names::mod1::Enum2>,f64> >,i32> mut_ref2 = [...] // cdb-check:struct tuple$<ref_mut$<type_names::GenericStruct<enum2$<type_names::mod1::Enum2>,f64> >,i32> mut_ref2 = [...]
// RAW POINTERS // RAW POINTERS
// cdb-command:dv /t *_ptr* // cdb-command:dv /t *_ptr*
// cdb-check:struct tuple$<ptr_mut$<type_names::Struct1>,isize> mut_ptr1 = [...] // cdb-check:struct tuple$<ptr_mut$<type_names::Struct1>,isize> mut_ptr1 = [...]
// cdb-check:struct tuple$<ptr_mut$<isize>,isize> mut_ptr2 = [...] // cdb-check:struct tuple$<ptr_mut$<isize>,isize> mut_ptr2 = [...]
// cdb-check:struct tuple$<ptr_mut$<enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> mut_ptr3 = [...] // cdb-check:struct tuple$<ptr_mut$<enum2$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> mut_ptr3 = [...]
// cdb-check:struct tuple$<ptr_const$<type_names::Struct1>,isize> const_ptr1 = [...] // cdb-check:struct tuple$<ptr_const$<type_names::Struct1>,isize> const_ptr1 = [...]
// cdb-check:struct tuple$<ptr_const$<isize>,isize> const_ptr2 = [...] // cdb-check:struct tuple$<ptr_const$<isize>,isize> const_ptr2 = [...]
// cdb-check:struct tuple$<ptr_const$<enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> const_ptr3 = [...] // cdb-check:struct tuple$<ptr_const$<enum2$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> const_ptr3 = [...]
// VECTORS // VECTORS
// cdb-command:dv /t *vec* // cdb-command:dv /t *vec*
// cdb-check:struct tuple$<array$<type_names::Struct1,3>,i16> fixed_size_vec1 = [...] // cdb-check:struct tuple$<array$<type_names::Struct1,3>,i16> fixed_size_vec1 = [...]
// cdb-check:struct tuple$<array$<usize,3>,i16> fixed_size_vec2 = [...] // cdb-check:struct tuple$<array$<usize,3>,i16> fixed_size_vec2 = [...]
// cdb-check:struct alloc::vec::Vec<usize,alloc::alloc::Global> vec1 = [...] // cdb-check:struct alloc::vec::Vec<usize,alloc::alloc::Global> vec1 = [...]
// cdb-check:struct alloc::vec::Vec<enum$<type_names::mod1::Enum2>,alloc::alloc::Global> vec2 = [...] // cdb-check:struct alloc::vec::Vec<enum2$<type_names::mod1::Enum2>,alloc::alloc::Global> vec2 = [...]
// cdb-command:dv /t slice* // cdb-command:dv /t slice*
// cdb-check:struct slice$<usize> slice1 = [...] // cdb-check:struct slice$<usize> slice1 = [...]
// cdb-check:struct slice$<enum$<type_names::mod1::Enum2> > slice2 = [...] // cdb-check:struct slice$<enum2$<type_names::mod1::Enum2> > slice2 = [...]
// TRAITS // TRAITS
// cdb-command:dv /t *_trait // cdb-command:dv /t *_trait
@ -238,16 +238,16 @@
// cdb-check:struct tuple$<type_names::mod1::Struct2 (*)(type_names::GenericStruct<u16,u8>),usize> unsafe_fn_with_return_value = [...] // cdb-check:struct tuple$<type_names::mod1::Struct2 (*)(type_names::GenericStruct<u16,u8>),usize> unsafe_fn_with_return_value = [...]
// cdb-check:struct tuple$<type_names::Struct1 (*)(),usize> extern_c_fn_with_return_value = [...] // cdb-check:struct tuple$<type_names::Struct1 (*)(),usize> extern_c_fn_with_return_value = [...]
// cdb-check:struct tuple$<usize (*)(f64),usize> rust_fn_with_return_value = [...] // cdb-check:struct tuple$<usize (*)(f64),usize> rust_fn_with_return_value = [...]
// cdb-check:struct tuple$<void (*)(enum$<core::result::Result<char,f64> >),usize> unsafe_fn = [...] // cdb-check:struct tuple$<void (*)(enum2$<core::result::Result<char,f64> >),usize> unsafe_fn = [...]
// cdb-check:struct tuple$<void (*)(isize),usize> extern_c_fn = [...] // cdb-check:struct tuple$<void (*)(isize),usize> extern_c_fn = [...]
// cdb-check:struct tuple$<void (*)(enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> > >),usize> rust_fn = [...] // cdb-check:struct tuple$<void (*)(enum2$<core::option::Option<isize> >,enum2$<core::option::Option<ref$<type_names::mod1::Struct2> > >),usize> rust_fn = [...]
// cdb-command:dv /t *_function* // cdb-command:dv /t *_function*
// cdb-check:struct tuple$<isize (*)(ptr_const$<u8>, ...),usize> variadic_function = [...] // cdb-check:struct tuple$<isize (*)(ptr_const$<u8>, ...),usize> variadic_function = [...]
// cdb-check:struct tuple$<type_names::mod1::mod2::Struct3 (*)(type_names::mod1::mod2::Struct3),usize> generic_function_struct3 = [...] // cdb-check:struct tuple$<type_names::mod1::mod2::Struct3 (*)(type_names::mod1::mod2::Struct3),usize> generic_function_struct3 = [...]
// cdb-check:struct tuple$<isize (*)(isize),usize> generic_function_int = [...] // cdb-check:struct tuple$<isize (*)(isize),usize> generic_function_int = [...]
// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn") // cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn")
// cdb-check:Return Type: void // cdb-check:Return Type: void
// cdb-check:Parameter Types: enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> > > // cdb-check:Parameter Types: enum2$<core::option::Option<isize> >,enum2$<core::option::Option<ref$<type_names::mod1::Struct2> > >
// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn_with_return_value") // cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn_with_return_value")
// cdb-check:Return Type: usize // cdb-check:Return Type: usize
// cdb-check:Parameter Types: f64 // cdb-check:Parameter Types: f64