diff options
| author | bors <bors@rust-lang.org> | 2021-08-27 01:07:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-27 01:07:17 +0000 |
| commit | d5cd3205fd6c0817fd46c036d0f3194b7deaca93 (patch) | |
| tree | 5c6c2d66f28c957521ed013ebfac4f79b7ac6c30 /src/test/debuginfo | |
| parent | 517c28e421b0d601c6f8eb07ea6aafb8e16975ad (diff) | |
| parent | af549368f3c4062bb509e475652b287be17b6f2c (diff) | |
| download | rust-d5cd3205fd6c0817fd46c036d0f3194b7deaca93.tar.gz rust-d5cd3205fd6c0817fd46c036d0f3194b7deaca93.zip | |
Auto merge of #88371 - Manishearth:rollup-pkkjsme, r=Manishearth
Rollup of 11 pull requests Successful merges: - #87832 (Fix debugger stepping behavior with `match` expressions) - #88123 (Make spans for tuple patterns in E0023 more precise) - #88215 (Reland #83738: "rustdoc: Don't load all extern crates unconditionally") - #88216 (Don't stabilize creation of TryReserveError instances) - #88270 (Handle type ascription type ops in NLL HRTB diagnostics) - #88289 (Fixes for LLVM change 0f45c16f2caa7c035e5c3edd40af9e0d51ad6ba7) - #88320 (type_implements_trait consider obligation failure on overflow) - #88332 (Add argument types tait tests) - #88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.) - #88346 (Revert "Add type of a let tait test impl trait straight in let") - #88348 (Add field types tait tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/debuginfo')
| -rw-r--r-- | src/test/debuginfo/step-into-match.rs | 383 |
1 files changed, 383 insertions, 0 deletions
diff --git a/src/test/debuginfo/step-into-match.rs b/src/test/debuginfo/step-into-match.rs new file mode 100644 index 00000000000..4a5f7857097 --- /dev/null +++ b/src/test/debuginfo/step-into-match.rs @@ -0,0 +1,383 @@ +// compile-flags: -g +// ignore-android: FIXME(#10381) + +// === GDB TESTS ============================================================== + +// gdb-command: r + +// gdb-command: s +// gdb-check:[...]match x { + +// gdb-command: s +// gdb-check:[...] Some(42) => 1, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_enum(Some(12)); + +// gdb-command: s +// gdb-check:[...]match x { + +// gdb-command: s +// gdb-check:[...]Some(_) => 2, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_enum(None); + +// gdb-command: s +// gdb-check:[...]match x { + +// gdb-command: s +// gdb-check:[...]None => 3, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_int(1); + +// gdb-command: s +// gdb-check:[...]match y { + +// gdb-command: s +// gdb-check:[...]1 => 3, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_int(2); + +// gdb-command: s +// gdb-check:[...]match y { + +// gdb-command: s +// gdb-check:[...]_ => 4, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_int(0); + +// gdb-command: s +// gdb-check:[...]match y { + +// gdb-command: s +// gdb-check:[...]0 => 2, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_int(-1); + +// gdb-command: s +// gdb-check:[...]match y { + +// gdb-command: s +// gdb-check:[...]-1 => 1, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_tuple(5, 12); + +// gdb-command: s +// gdb-check:[...]match (a, b) { + +// gdb-command: s +// gdb-check:[...](5, 12) => 3, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_tuple(29, 1); + +// gdb-command: s +// gdb-check:[...]match (a, b) { + +// gdb-command: s +// gdb-check:[...](29, _) => 2, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_tuple(12, 12); + +// gdb-command: s +// gdb-check:[...]match (a, b) { + +// gdb-command: s +// gdb-check:[...](_, _) => 5 + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_tuple(42, 12); + +// gdb-command: s +// gdb-check:[...]match (a, b) { + +// gdb-command: s +// gdb-check:[...](42, 12) => 1, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]match_tuple(1, 9); + +// gdb-command: s +// gdb-check:[...]match (a, b) { + +// gdb-command: s +// gdb-check:[...](_, 9) => 4, + +// gdb-command: s +// gdb-check:[...]} + +// gdb-command: s +// gdb-check:[...]} + +// === CDB TESTS ============================================================== + +// Enable line-based debugging and print lines after stepping. +// cdb-command: .lines -e +// cdb-command: l+s +// cdb-command: l+t + +// cdb-command: g + +// cdb-command: t +// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 { + +// cdb-command: t +// cdb-check: [...]: match x { + +// cdb-command: t +// cdb-check: [...]: Some(42) => 1, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_enum(Some(12)); + +// cdb-command: t +// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 { + +// cdb-command: t +// cdb-check: [...]: match x { + +// cdb-command: t +// cdb-check: [...]: Some(_) => 2, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_enum(None); + +// cdb-command: t +// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 { + +// cdb-command: t +// cdb-check: [...]: match x { + +// cdb-command: t +// cdb-check: [...]: None => 3, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_int(1); + +// cdb-command: t +// cdb-check: [...]: fn match_int(y: i32) -> u16 { + +// cdb-command: t +// cdb-check: [...]: match y { + +// cdb-command: t +// cdb-check: [...]: 1 => 3, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_int(2); + +// cdb-command: t +// cdb-check: [...]: fn match_int(y: i32) -> u16 { + +// cdb-command: t +// cdb-check: [...]: match y { + +// cdb-command: t +// cdb-check: [...]: _ => 4, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_int(0); + +// cdb-command: t +// cdb-check: [...]: fn match_int(y: i32) -> u16 { + +// cdb-command: t +// cdb-check: [...]: match y { + +// cdb-command: t +// cdb-check: [...]: 0 => 2, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_int(-1); + +// cdb-command: t +// cdb-check: [...]: fn match_int(y: i32) -> u16 { + +// cdb-command: t +// cdb-check: [...]: match y { + +// cdb-command: t +// cdb-check: [...]: -1 => 1, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_tuple(5, 12); + +// cdb-command: t +// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 { + +// cdb-command: t +// cdb-check: [...]: match (a, b) { + +// cdb-command: t +// cdb-check: [...]: (5, 12) => 3, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_tuple(29, 1); + +// cdb-command: t +// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 { + +// cdb-command: t +// cdb-check: [...]: match (a, b) { + +// cdb-command: t +// cdb-check: [...]: (29, _) => 2, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_tuple(12, 12); + +// cdb-command: t +// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 { + +// cdb-command: t +// cdb-check: [...]: match (a, b) { + +// cdb-command: t +// cdb-check: [...]: (_, _) => 5 + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_tuple(42, 12); + +// cdb-command: t +// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 { + +// cdb-command: t +// cdb-check: [...]: match (a, b) { + +// cdb-command: t +// cdb-check: [...]: (42, 12) => 1, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: match_tuple(1, 9); + +// cdb-command: t +// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 { + +// cdb-command: t +// cdb-check: [...]: match (a, b) { + +// cdb-command: t +// cdb-check: [...]: (_, 9) => 4, + +// cdb-command: t +// cdb-check: [...]: } + +// cdb-command: t +// cdb-check: [...]: } + +fn main() { + match_enum(Some(42)); // #break + match_enum(Some(12)); + match_enum(None); + + match_int(1); + match_int(2); + match_int(0); + match_int(-1); + + match_tuple(5, 12); + match_tuple(29, 1); + match_tuple(12, 12); + match_tuple(42, 12); + match_tuple(1, 9); +} + +fn match_enum(x: Option<u32>) -> u8 { + match x { + Some(42) => 1, + Some(_) => 2, + None => 3, + } +} + +fn match_int(y: i32) -> u16 { + match y { + -1 => 1, + 0 => 2, + 1 => 3, + _ => 4, + } +} + +fn match_tuple(a: u8, b: i8) -> u32 { + match (a, b) { + (42, 12) => 1, + (29, _) => 2, + (5, 12) => 3, + (_, 9) => 4, + (_, _) => 5 + } +} |
