Skip to content

Commit 978fb76

Browse files
Rollup merge of #153941 - Enselic:fully-steppable, r=saethlin
tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable Some optimization passes [_improve_](rust-lang/compiler-team#319) compile times. So we want to run some passes even with `-Copt-level=0`. That means that some debuggable lines can be optimized away. Document that as expected behavior. Closes #33013. Replaces #151426. See that PR for some discussion.
2 parents 769d225 + 686ddd3 commit 978fb76

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

tests/debuginfo/basic-stepping.rs

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@
99
// Debugger tests need debuginfo
1010
//@ compile-flags: -g
1111

12-
// FIXME(#128945): SingleUseConsts shouldn't need to be disabled.
13-
//@ revisions: default-mir-passes no-SingleUseConsts-mir-pass
14-
//@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts
12+
// Some optimization passes _improve_ compile times [1]. So we want to run some
13+
// passes even with `-Copt-level=0`. That means that some of the lines below can
14+
// be optimized away. To make regression testing more robust, we also want to
15+
// run this test with such passes disabled. The solution is to use two
16+
// revisions. One with default `-Copt-level=0` passes, and one "even less
17+
// optimized", with enough optimization passes disabled to keep the maximum
18+
// number of lines steppable.
19+
//
20+
// If `-Zmir-enable-passes=-...` ends up being annoying to maintain, we can try
21+
// switching to `-Zmir-opt-level=0` instead.
22+
//
23+
// [1]: https://github.com/rust-lang/compiler-team/issues/319
24+
//@ revisions: opt-level-0 maximally-steppable
25+
//@ [maximally-steppable] compile-flags: -Zmir-enable-passes=-SingleUseConsts
1526

1627
// === GDB TESTS ===================================================================================
1728

@@ -20,12 +31,12 @@
2031
//@ gdb-command: next
2132
//@ gdb-check: let d = c = 99;
2233
//@ gdb-command: next
23-
//@ [no-SingleUseConsts-mir-pass] gdb-check: let e = "hi bob";
24-
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
25-
//@ [no-SingleUseConsts-mir-pass] gdb-check: let f = b"hi bob";
26-
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
27-
//@ [no-SingleUseConsts-mir-pass] gdb-check: let g = b'9';
28-
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
34+
//@ [maximally-steppable] gdb-check: let e = "hi bob";
35+
//@ [maximally-steppable] gdb-command: next
36+
//@ [maximally-steppable] gdb-check: let f = b"hi bob";
37+
//@ [maximally-steppable] gdb-command: next
38+
//@ [maximally-steppable] gdb-check: let g = b'9';
39+
//@ [maximally-steppable] gdb-command: next
2940
//@ gdb-check: let h = ["whatever"; 8];
3041
//@ gdb-command: next
3142
//@ gdb-check: let i = [1,2,3,4];
@@ -61,15 +72,15 @@
6172
//@ lldb-check: [...]let d = c = 99;[...]
6273
//@ lldb-command: next
6374
//@ lldb-command: frame select
64-
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let e = "hi bob";[...]
65-
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
66-
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
67-
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let f = b"hi bob";[...]
68-
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
69-
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
70-
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let g = b'9';[...]
71-
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
72-
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
75+
//@ [maximally-steppable] lldb-check: [...]let e = "hi bob";[...]
76+
//@ [maximally-steppable] lldb-command: next
77+
//@ [maximally-steppable] lldb-command: frame select
78+
//@ [maximally-steppable] lldb-check: [...]let f = b"hi bob";[...]
79+
//@ [maximally-steppable] lldb-command: next
80+
//@ [maximally-steppable] lldb-command: frame select
81+
//@ [maximally-steppable] lldb-check: [...]let g = b'9';[...]
82+
//@ [maximally-steppable] lldb-command: next
83+
//@ [maximally-steppable] lldb-command: frame select
7384
//@ lldb-check: [...]let h = ["whatever"; 8];[...]
7485
//@ lldb-command: next
7586
//@ lldb-command: frame select
@@ -107,12 +118,12 @@
107118
//@ cdb-check: [...]: let mut c = 27;
108119
//@ cdb-command: p
109120
//@ cdb-check: [...]: let d = c = 99;
110-
//@ [no-SingleUseConsts-mir-pass] cdb-command: p
111-
//@ [no-SingleUseConsts-mir-pass] cdb-check: [...]: let e = "hi bob";
112-
//@ [no-SingleUseConsts-mir-pass] cdb-command: p
113-
//@ [no-SingleUseConsts-mir-pass] cdb-check: [...]: let f = b"hi bob";
114-
//@ [no-SingleUseConsts-mir-pass] cdb-command: p
115-
//@ [no-SingleUseConsts-mir-pass] cdb-check: [...]: let g = b'9';
121+
//@ [maximally-steppable] cdb-command: p
122+
//@ [maximally-steppable] cdb-check: [...]: let e = "hi bob";
123+
//@ [maximally-steppable] cdb-command: p
124+
//@ [maximally-steppable] cdb-check: [...]: let f = b"hi bob";
125+
//@ [maximally-steppable] cdb-command: p
126+
//@ [maximally-steppable] cdb-check: [...]: let g = b'9';
116127
//@ cdb-command: p
117128
//@ cdb-check: [...]: let h = ["whatever"; 8];
118129
//@ cdb-command: p

tests/debuginfo/macro-stepping.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
extern crate macro_stepping; // exports new_scope!()
1717

1818
//@ compile-flags: -g
19-
// FIXME(#128945): SingleUseConsts shouldn't need to be disabled.
20-
//@ revisions: default-mir-passes no-SingleUseConsts-mir-pass
21-
//@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts
19+
// See explanation in `tests/debuginfo/basic-stepping.rs`.
20+
//@ revisions: opt-level-0 maximally-steppable
21+
//@ [maximally-steppable] compile-flags: -Zmir-enable-passes=-SingleUseConsts
2222

2323
// === GDB TESTS ===================================================================================
2424

@@ -51,7 +51,7 @@ extern crate macro_stepping; // exports new_scope!()
5151
//@ gdb-check:[...]#inc-loc2[...]
5252
//@ gdb-command:next
5353
//@ gdb-command:frame
54-
//@ [no-SingleUseConsts-mir-pass] gdb-check:[...]#inc-loc3[...]
54+
//@ [maximally-steppable] gdb-check:[...]#inc-loc3[...]
5555

5656
// === LLDB TESTS ==================================================================================
5757

0 commit comments

Comments
 (0)