summaryrefslogtreecommitdiffstats
path: root/src/test/debuginfo
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/collapse-debuginfo-no-attr-flag.rs61
-rw-r--r--src/test/debuginfo/collapse-debuginfo-no-attr.rs60
-rw-r--r--src/test/debuginfo/collapse-debuginfo-with-attr-flag.rs63
-rw-r--r--src/test/debuginfo/collapse-debuginfo-with-attr.rs59
-rw-r--r--src/test/debuginfo/generator-objects.rs13
-rw-r--r--src/test/debuginfo/msvc-pretty-enums.rs212
-rw-r--r--src/test/debuginfo/msvc-scalarpair-params.rs8
-rw-r--r--src/test/debuginfo/mutex.rs15
-rw-r--r--src/test/debuginfo/numeric-types.rs87
-rw-r--r--src/test/debuginfo/pretty-std.rs22
-rw-r--r--src/test/debuginfo/result-types.rs11
-rw-r--r--src/test/debuginfo/type-names.rs34
12 files changed, 555 insertions, 90 deletions
diff --git a/src/test/debuginfo/collapse-debuginfo-no-attr-flag.rs b/src/test/debuginfo/collapse-debuginfo-no-attr-flag.rs
new file mode 100644
index 000000000..413f61201
--- /dev/null
+++ b/src/test/debuginfo/collapse-debuginfo-no-attr-flag.rs
@@ -0,0 +1,61 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that line numbers are not replaced with those of the outermost expansion site when the
+// `collapse_debuginfo` is active, `-Zdebug-macros` is provided and `#[collapse_debuginfo]` not
+// being used.
+
+// compile-flags:-g -Zdebug-macros
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc4[...]
+// gdb-command:continue
+
+fn one() {
+ println!("one");
+}
+fn two() {
+ println!("two");
+}
+fn three() {
+ println!("three");
+}
+fn four() {
+ println!("four");
+}
+
+macro_rules! outer {
+ ($b:block) => {
+ one(); // #loc1
+ inner!();
+ $b
+ };
+}
+
+macro_rules! inner {
+ () => {
+ two(); // #loc2
+ };
+}
+
+fn main() {
+ let ret = 0; // #break
+ outer!({
+ three(); // #loc3
+ four(); // #loc4
+ });
+ std::process::exit(ret);
+}
diff --git a/src/test/debuginfo/collapse-debuginfo-no-attr.rs b/src/test/debuginfo/collapse-debuginfo-no-attr.rs
new file mode 100644
index 000000000..230c8795b
--- /dev/null
+++ b/src/test/debuginfo/collapse-debuginfo-no-attr.rs
@@ -0,0 +1,60 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that line numbers are not replaced with those of the outermost expansion site when the
+// `collapse_debuginfo` feature is active and the attribute is not provided.
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc4[...]
+// gdb-command:continue
+
+fn one() {
+ println!("one");
+}
+fn two() {
+ println!("two");
+}
+fn three() {
+ println!("three");
+}
+fn four() {
+ println!("four");
+}
+
+macro_rules! outer {
+ ($b:block) => {
+ one(); // #loc1
+ inner!();
+ $b
+ };
+}
+
+macro_rules! inner {
+ () => {
+ two(); // #loc2
+ };
+}
+
+fn main() {
+ let ret = 0; // #break
+ outer!({
+ three(); // #loc3
+ four(); // #loc4
+ });
+ std::process::exit(ret);
+}
diff --git a/src/test/debuginfo/collapse-debuginfo-with-attr-flag.rs b/src/test/debuginfo/collapse-debuginfo-with-attr-flag.rs
new file mode 100644
index 000000000..183cf537e
--- /dev/null
+++ b/src/test/debuginfo/collapse-debuginfo-with-attr-flag.rs
@@ -0,0 +1,63 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that line numbers are not replaced with those of the outermost expansion site when the
+// `collapse_debuginfo` is active and `-Zdebug-macros` is provided, despite `#[collapse_debuginfo]`
+// being used.
+
+// compile-flags:-g -Zdebug-macros
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc4[...]
+// gdb-command:continue
+
+fn one() {
+ println!("one");
+}
+fn two() {
+ println!("two");
+}
+fn three() {
+ println!("three");
+}
+fn four() {
+ println!("four");
+}
+
+#[collapse_debuginfo]
+macro_rules! outer {
+ ($b:block) => {
+ one(); // #loc1
+ inner!();
+ $b
+ };
+}
+
+#[collapse_debuginfo]
+macro_rules! inner {
+ () => {
+ two(); // #loc2
+ };
+}
+
+fn main() {
+ let ret = 0; // #break
+ outer!({
+ three(); // #loc3
+ four(); // #loc4
+ });
+ std::process::exit(ret);
+}
diff --git a/src/test/debuginfo/collapse-debuginfo-with-attr.rs b/src/test/debuginfo/collapse-debuginfo-with-attr.rs
new file mode 100644
index 000000000..34d03c18b
--- /dev/null
+++ b/src/test/debuginfo/collapse-debuginfo-with-attr.rs
@@ -0,0 +1,59 @@
+// ignore-lldb
+#![feature(collapse_debuginfo)]
+
+// Test that line numbers are replaced with those of the outermost expansion site when the
+// `collapse_debuginfo` feature is active and the attribute is provided.
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:continue
+
+fn one() {
+ println!("one");
+}
+fn two() {
+ println!("two");
+}
+fn three() {
+ println!("three");
+}
+fn four() {
+ println!("four");
+}
+
+#[collapse_debuginfo]
+macro_rules! outer {
+ ($b:block) => {
+ one();
+ inner!();
+ $b
+ };
+}
+
+#[collapse_debuginfo]
+macro_rules! inner {
+ () => {
+ two();
+ };
+}
+
+fn main() {
+ let ret = 0; // #break
+ outer!({ // #loc1
+ three(); // #loc2
+ four(); // #loc3
+ });
+ std::process::exit(ret);
+}
diff --git a/src/test/debuginfo/generator-objects.rs b/src/test/debuginfo/generator-objects.rs
index d6d7e5b44..11c4ae2f6 100644
--- a/src/test/debuginfo/generator-objects.rs
+++ b/src/test/debuginfo/generator-objects.rs
@@ -41,31 +41,26 @@
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Unresumed [Type: enum$<generator_objects::main::generator_env$0>]
-// cdb-check: [variant] : Unresumed
+// cdb-check: b : Unresumed [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Suspend0 [Type: enum$<generator_objects::main::generator_env$0>]
-// cdb-check: [variant] : Suspend0
+// cdb-check: b : Suspend0 [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] c : 6 [Type: int]
// cdb-check: [+0x[...]] d : 7 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Suspend1 [Type: enum$<generator_objects::main::generator_env$0>]
-// cdb-check: [variant] : Suspend1
+// cdb-check: b : Suspend1 [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] c : 7 [Type: int]
// cdb-check: [+0x[...]] d : 8 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Returned [Type: enum$<generator_objects::main::generator_env$0>]
-// cdb-check: [<Raw View>] [Type: enum$<generator_objects::main::generator_env$0>]
-// cdb-check: [variant] : Returned
+// cdb-check: b : Returned [Type: enum2$<generator_objects::main::generator_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
diff --git a/src/test/debuginfo/msvc-pretty-enums.rs b/src/test/debuginfo/msvc-pretty-enums.rs
index a153a9a42..7f1be6f27 100644
--- a/src/test/debuginfo/msvc-pretty-enums.rs
+++ b/src/test/debuginfo/msvc-pretty-enums.rs
@@ -4,69 +4,141 @@
// cdb-command: g
// cdb-command: dx a
-// cdb-check:a : Some({...}) [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
-// cdb-check: [variant] : Some
+// 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-command: dx b
-// cdb-check:b : None [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
-// cdb-check: [variant] : None
+// cdb-check:b : None [Type: enum2$<core::option::Option<msvc_pretty_enums::CStyleEnum> >]
// cdb-command: dx c
-// cdb-check:c : Tag1 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [variant] : Tag1
+// cdb-check:c : Tag1 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-command: dx d
-// cdb-check:d : Data({...}) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [variant] : Data
+// cdb-check:d : Data [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx e
-// cdb-check:e : Tag2 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
-// cdb-check: [variant] : Tag2
+// cdb-check:e : Tag2 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
// cdb-command: dx f
-// cdb-check:f : Some({...}) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
-// cdb-check: [variant] : Some
+// cdb-check:f : Some [Type: enum2$<core::option::Option<ref$<u32> > >]
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
// cdb-command: dx g
-// cdb-check:g : None [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
-// cdb-check: [variant] : None
+// cdb-check:g : None [Type: enum2$<core::option::Option<ref$<u32> > >]
// cdb-command: dx h
-// cdb-check:h : Some [Type: enum$<core::option::Option<u32> >]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
-// cdb-check: [variant] : Some
+// cdb-check:h : Some [Type: enum2$<core::option::Option<u32> >]
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
// cdb-command: dx i
-// cdb-check:i : None [Type: enum$<core::option::Option<u32> >]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
-// cdb-check: [variant] : None
+// cdb-check:i : None [Type: enum2$<core::option::Option<u32> >]
// cdb-command: dx j
// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-command: dx k
-// cdb-check:k : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
-// cdb-check: [variant] : Some
+// cdb-check:k : Some [Type: enum2$<core::option::Option<alloc::string::String> >]
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
// cdb-command: dx l
-// cdb-check:l : Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
-// cdb-check: [<Raw View>] [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
-// cdb-check: [variant] : Ok
+// cdb-check:l : Ok [Type: enum2$<core::result::Result<u32,enum2$<msvc_pretty_enums::Empty> > >]
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
+// cdb-command: dx niche128_some
+// 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.
+// cdb-check: [+0x000] __0 [...] [Type: core::num::nonzero::NonZeroI128]
+
+// cdb-command: dx niche128_none
+// cdb-check: niche128_none : None [Type: enum2$<core::option::Option<core::num::nonzero::NonZeroI128> >]
+
+// cdb-command: dx wrapping_niche128_untagged
+// cdb-check: wrapping_niche128_untagged : X [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
+// cdb-check: [+0x[...]] __0 [Type: msvc_pretty_enums::Wrapping128]
+
+// cdb-command: dx wrapping_niche128_none1
+// cdb-check: wrapping_niche128_none1 : Y [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
+// cdb-check: [+0x[...]] __0 [Type: msvc_pretty_enums::Wrapping128]
+
+// cdb-command: dx wrapping_niche128_none2
+// cdb-check: wrapping_niche128_none2 : Z [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
+// cdb-check: [+0x[...]] __0 [Type: msvc_pretty_enums::Wrapping128]
+
+// cdb-command: dx direct_tag_128_a,d
+// cdb-check: direct_tag_128_a,d : A [Type: enum2$<msvc_pretty_enums::DirectTag128>]
+// cdb-check: [+0x[...]] __0 : 42 [Type: unsigned int]
+
+// cdb-command: dx direct_tag_128_b,d
+// cdb-check: direct_tag_128_b,d : B [Type: enum2$<msvc_pretty_enums::DirectTag128>]
+// cdb-check: [+0x[...]] __0 : 137 [Type: unsigned int]
+
+// cdb-command: dx niche_w_fields_1_some,d
+// 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[...]] __1 : 7 [Type: unsigned int]
+
+// cdb-command: dx niche_w_fields_1_none,d
+// cdb-check: niche_w_fields_1_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields1>]
+// cdb-check: [+0x[...]] __0 : 99 [Type: unsigned int]
+
+// cdb-command: dx niche_w_fields_2_some,d
+// cdb-check: niche_w_fields_2_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
+// cdb-check: [+0x[...]] __0 : 800 [Type: core::num::nonzero::NonZeroU32]
+// cdb-check: [+0x[...]] __1 : 900 [Type: unsigned __int64]
+
+// cdb-command: dx niche_w_fields_2_none,d
+// cdb-check: niche_w_fields_2_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
+// cdb-check: [+0x[...]] __0 : 1000 [Type: unsigned __int64]
+
+// cdb-command: dx niche_w_fields_3_some,d
+// 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[...]] __1 : true [Type: bool]
+
+// cdb-command: dx niche_w_fields_3_niche1,d
+// cdb-check: niche_w_fields_3_niche1,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
+// cdb-check: [+0x[...]] __0 : 12 [Type: unsigned char]
+
+// cdb-command: dx niche_w_fields_3_niche2,d
+// cdb-check: niche_w_fields_3_niche2,d : C [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
+// cdb-check: [+0x[...]] __0 : false [Type: bool]
+
+// cdb-command: dx niche_w_fields_3_niche3,d
+// cdb-check: niche_w_fields_3_niche3,d : D [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
+// cdb-check: [+0x[...]] __0 : 34 [Type: unsigned char]
+
+// cdb-command: dx niche_w_fields_3_niche4,d
+// cdb-check: niche_w_fields_3_niche4,d : E [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
+// cdb-check: [+0x[...]] __0 : 56 [Type: unsigned char]
+
+// cdb-command: dx niche_w_fields_3_niche5,d
+// 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-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[...]] data_ptr : [...]
+// cdb-check: [+0x[...]] length : 3 [...]
+
+// cdb-command: dx -r3 niche_w_fields_std_result_err,d
+// 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-command: dx -r2 arbitrary_discr1,d
+// cdb-check: arbitrary_discr1,d : Abc [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
+// cdb-check: [+0x[...]] __0 : 1234 [Type: unsigned int]
+
+// cdb-command: dx -r2 arbitrary_discr2,d
+// cdb-check: arbitrary_discr2,d : Def [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
+// cdb-check: [+0x[...]] __0 : 5678 [Type: unsigned int]
+
+#![feature(rustc_attrs)]
+#![feature(repr128)]
+#![feature(arbitrary_enum_discriminant)]
+
+use std::num::{NonZeroI128, NonZeroU32};
+
pub enum CStyleEnum {
Low = 2,
High = 16,
@@ -80,6 +152,51 @@ pub enum NicheLayoutEnum {
pub enum Empty {}
+// The following three types will use a niche layout once
+// https://github.com/rust-lang/rust/pull/94075 is merged:
+enum NicheLayoutWithFields1<'a> {
+ A(&'a u8, u32),
+ B(u32),
+}
+
+enum NicheLayoutWithFields2 {
+ A(NonZeroU32, u64),
+ B(u64),
+}
+
+enum NicheLayoutWithFields3 {
+ A(u8, bool),
+ B(u8),
+ C(bool),
+ D(u8),
+ E(u8),
+ F,
+}
+
+#[rustc_layout_scalar_valid_range_start(340282366920938463463374607431768211454)]
+#[rustc_layout_scalar_valid_range_end(1)]
+#[repr(transparent)]
+struct Wrapping128(u128);
+
+// #[rustc_layout(debug)]
+enum Wrapping128Niche {
+ X(Wrapping128),
+ Y,
+ Z,
+}
+
+#[repr(i128)]
+enum DirectTag128 {
+ A(u32),
+ B(u32),
+}
+
+#[repr(u32)]
+enum ArbitraryDiscr {
+ Abc(u32) = 1000,
+ Def(u32) = 5000_000,
+}
+
fn main() {
let a = Some(CStyleEnum::Low);
let b = Option::<CStyleEnum>::None;
@@ -93,6 +210,35 @@ fn main() {
let j = CStyleEnum::High;
let k = Some("IAMA optional string!".to_string());
let l = Result::<u32, Empty>::Ok(42);
+ let niche128_some = Some(NonZeroI128::new(123456).unwrap());
+ let niche128_none: Option<NonZeroI128> = None;
+
+ let wrapping_niche128_untagged =
+ unsafe { Wrapping128Niche::X(Wrapping128(340282366920938463463374607431768211454)) };
+ let wrapping_niche128_none1 = Wrapping128Niche::Y;
+ let wrapping_niche128_none2 = Wrapping128Niche::Z;
+
+ let direct_tag_128_a = DirectTag128::A(42);
+ let direct_tag_128_b = DirectTag128::B(137);
+
+ let niche_w_fields_1_some = NicheLayoutWithFields1::A(&77, 7);
+ let niche_w_fields_1_none = NicheLayoutWithFields1::B(99);
+
+ let niche_w_fields_2_some = NicheLayoutWithFields2::A(NonZeroU32::new(800).unwrap(), 900);
+ let niche_w_fields_2_none = NicheLayoutWithFields2::B(1000);
+
+ let niche_w_fields_3_some = NicheLayoutWithFields3::A(137, true);
+ let niche_w_fields_3_niche1 = NicheLayoutWithFields3::B(12);
+ let niche_w_fields_3_niche2 = NicheLayoutWithFields3::C(false);
+ let niche_w_fields_3_niche3 = NicheLayoutWithFields3::D(34);
+ let niche_w_fields_3_niche4 = NicheLayoutWithFields3::E(56);
+ let niche_w_fields_3_niche5 = NicheLayoutWithFields3::F;
+
+ let niche_w_fields_std_result_ok: Result<Box<[u8]>, u64> = Ok(vec![1, 2, 3].into());
+ let niche_w_fields_std_result_err: Result<Box<[u8]>, u64> = Err(789);
+
+ let arbitrary_discr1 = ArbitraryDiscr::Abc(1234);
+ let arbitrary_discr2 = ArbitraryDiscr::Def(5678);
zzz(); // #break
}
diff --git a/src/test/debuginfo/msvc-scalarpair-params.rs b/src/test/debuginfo/msvc-scalarpair-params.rs
index 3846fb42f..9630952cb 100644
--- a/src/test/debuginfo/msvc-scalarpair-params.rs
+++ b/src/test/debuginfo/msvc-scalarpair-params.rs
@@ -18,12 +18,10 @@
// cdb-command: g
// cdb-command: dx o1
-// cdb-check:o1 : Some [Type: enum$<core::option::Option<u32> >]
-// cdb-check: [variant] : Some
+// cdb-check:o1 : Some [Type: enum2$<core::option::Option<u32> >]
// cdb-check: [+0x004] __0 : 0x4d2 [Type: [...]]
// cdb-command: dx o2
-// cdb-check:o2 : Some [Type: enum$<core::option::Option<u64> >]
-// cdb-check: [variant] : Some
+// cdb-check:o2 : Some [Type: enum2$<core::option::Option<u64> >]
// cdb-check: [+0x008] __0 : 0x162e [Type: unsigned __int64]
// cdb-command: g
@@ -89,7 +87,7 @@ fn slice(s: &[u8]) {
zzz(); // #break
}
-fn zzz() { }
+fn zzz() {}
fn main() {
range(10..12, 20..30);
diff --git a/src/test/debuginfo/mutex.rs b/src/test/debuginfo/mutex.rs
index 00dccf5f9..314ba40b0 100644
--- a/src/test/debuginfo/mutex.rs
+++ b/src/test/debuginfo/mutex.rs
@@ -20,19 +20,20 @@
// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
//
-// 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: [variant] : Ok
+// cdb-command:dx _lock,d
+// 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> > > > >]
// cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>]
use std::sync::Mutex;
-#[allow(unused_variables)]
-fn main()
-{
+fn main() {
let m = Mutex::new(0);
- let lock = m.try_lock();
+ let _lock = m.try_lock();
+
+ println!("this line avoids an `Ambiguous symbol error` while setting the breakpoint");
+
zzz(); // #break
}
+#[inline(never)]
fn zzz() {}
diff --git a/src/test/debuginfo/numeric-types.rs b/src/test/debuginfo/numeric-types.rs
index 2eae9239b..c41c9ee21 100644
--- a/src/test/debuginfo/numeric-types.rs
+++ b/src/test/debuginfo/numeric-types.rs
@@ -1,6 +1,7 @@
-// only-cdb
// compile-flags:-g
+// min-gdb-version: 8.1
+
// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}`, `Wrapping<T>` and
// `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`.
@@ -153,6 +154,90 @@
// cdb-check:a_usize : 0x400 [Type: core::sync::atomic::AtomicUsize]
// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicUsize]
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print/d nz_i8
+// gdb-check:[...]$1 = 11
+
+// gdb-command:print nz_i16
+// gdb-check:[...]$2 = 22
+
+// gdb-command:print nz_i32
+// gdb-check:[...]$3 = 33
+
+// gdb-command:print nz_i64
+// gdb-check:[...]$4 = 44
+
+// gdb-command:print nz_i128
+// gdb-check:[...]$5 = 55
+
+// gdb-command:print nz_isize
+// gdb-check:[...]$6 = 66
+
+// gdb-command:print/d nz_u8
+// gdb-check:[...]$7 = 77
+
+// gdb-command:print nz_u16
+// gdb-check:[...]$8 = 88
+
+// gdb-command:print nz_u32
+// gdb-check:[...]$9 = 99
+
+// gdb-command:print nz_u64
+// gdb-check:[...]$10 = 100
+
+// gdb-command:print nz_u128
+// gdb-check:[...]$11 = 111
+
+// gdb-command:print nz_usize
+// gdb-check:[...]$12 = 122
+
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print/d nz_i8
+// lldb-check:[...]$0 = 11 { __0 = 11 }
+
+// lldb-command:print nz_i16
+// lldb-check:[...]$1 = 22 { __0 = 22 }
+
+// lldb-command:print nz_i32
+// lldb-check:[...]$2 = 33 { __0 = 33 }
+
+// lldb-command:print nz_i64
+// lldb-check:[...]$3 = 44 { __0 = 44 }
+
+// lldb-command:print nz_i128
+// lldb-check:[...]$4 = 55 { __0 = 55 }
+
+// lldb-command:print nz_isize
+// lldb-check:[...]$5 = 66 { __0 = 66 }
+
+// lldb-command:print/d nz_u8
+// lldb-check:[...]$6 = 77 { __0 = 77 }
+
+// lldb-command:print nz_u16
+// lldb-check:[...]$7 = 88 { __0 = 88 }
+
+// lldb-command:print nz_u32
+// lldb-check:[...]$8 = 99 { __0 = 99 }
+
+// lldb-command:print nz_u64
+// lldb-check:[...]$9 = 100 { __0 = 100 }
+
+// lldb-command:print nz_u128
+// lldb-check:[...]$10 = 111 { __0 = 111 }
+
+// lldb-command:print nz_usize
+// lldb-check:[...]$11 = 122 { __0 = 122 }
+
+
use std::num::*;
use std::sync::atomic::*;
diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs
index 55a4ecc1c..a51b37205 100644
--- a/src/test/debuginfo/pretty-std.rs
+++ b/src/test/debuginfo/pretty-std.rs
@@ -39,7 +39,6 @@
// gdb-command: print some_string
// gdb-check:$8 = Some = {"IAMA "...}
-
// === LLDB TESTS ==================================================================================
// lldb-command: run
@@ -65,7 +64,6 @@
// lldb-command: print os_string
// lldb-check:[...]$6 = "IAMA OS string 😃"[...]
-
// === CDB TESTS ==================================================================================
// cdb-command: g
@@ -118,20 +116,17 @@
// cdb-check: [chars] : "IAMA OS string [...]"
// cdb-command: dx some
-// cdb-check:some : Some [Type: enum$<core::option::Option<i16> >]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i16> >]
-// cdb-check: [variant] : Some
+// cdb-check:some : Some [Type: enum2$<core::option::Option<i16> >]
+// cdb-check: [<Raw View>] [Type: enum2$<core::option::Option<i16> >]
// cdb-check: [+0x002] __0 : 8 [Type: short]
// cdb-command: dx none
-// cdb-check:none : None [Type: enum$<core::option::Option<i64> >]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i64> >]
-// cdb-check: [variant] : None
+// cdb-check:none : None [Type: enum2$<core::option::Option<i64> >]
+// cdb-check: [<Raw View>] [Type: enum2$<core::option::Option<i64> >]
// cdb-command: dx some_string
-// cdb-check:some_string : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
-// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
-// cdb-check: [variant] : Some
+// cdb-check:some_string : Some [Type: enum2$<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-command: dx linkedlist
@@ -153,7 +148,6 @@ use std::collections::{LinkedList, VecDeque};
use std::ffi::OsString;
fn main() {
-
// &[]
let slice: &[i32] = &[0, 1, 2, 3];
@@ -188,4 +182,6 @@ fn main() {
zzz(); // #break
}
-fn zzz() { () }
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/result-types.rs b/src/test/debuginfo/result-types.rs
index c0d905a6a..cdac47a78 100644
--- a/src/test/debuginfo/result-types.rs
+++ b/src/test/debuginfo/result-types.rs
@@ -7,15 +7,14 @@
// cdb-command: g
// 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-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]
-fn main()
-{
+fn main() {
let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_ok(), true);
@@ -25,4 +24,6 @@ fn main()
zzz(); // #break.
}
-fn zzz() { () }
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs
index b040a6e74..9cc99d776 100644
--- a/src/test/debuginfo/type-names.rs
+++ b/src/test/debuginfo/type-names.rs
@@ -175,51 +175,51 @@
// 0-sized structs appear to be optimized away in some cases, so only check the structs that do
// actually appear.
// 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
// cdb-command:dv /t *_enum_*
-// cdb-check:union enum$<type_names::Enum1> simple_enum_1 = [...]
-// cdb-check:union enum$<type_names::Enum1> simple_enum_2 = [...]
-// cdb-check:union enum$<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 enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > generic_enum_2 = [...]
+// cdb-check:union enum2$<type_names::Enum1> simple_enum_1 = [...]
+// cdb-check:union enum2$<type_names::Enum1> simple_enum_2 = [...]
+// cdb-check:union enum2$<type_names::mod1::Enum2> simple_enum_3 = [...]
+// cdb-check:union enum2$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > generic_enum_1 = [...]
+// cdb-check:union enum2$<type_names::mod1::mod2::Enum3<type_names::Struct1> > generic_enum_2 = [...]
// TUPLES
// 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$<tuple$<type_names::Struct1,type_names::mod1::mod2::Struct3>,enum$<type_names::mod1::Enum2>,char> tuple2 = [...]
+// 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>,enum2$<type_names::mod1::Enum2>,char> tuple2 = [...]
// 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<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
// cdb-command:dv /t *ref*
// 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_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
// cdb-command:dv /t *_ptr*
// 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$<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$<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
// cdb-command:dv /t *vec*
// 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 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-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
// 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::Struct1 (*)(),usize> extern_c_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 (*)(enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> >, 1, [...], Some>),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-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$<isize (*)(isize),usize> generic_function_int = [...]
// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn")
// cdb-check:Return Type: void
-// cdb-check:Parameter Types: enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> >, 1, [...], Some>
+// 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-check:Return Type: usize
// cdb-check:Parameter Types: f64