Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/single_use_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub(super) struct SingleUseConsts;

impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
sess.mir_opt_level() > 0
sess.mir_opt_level() > 1
}

fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
Expand Down
16 changes: 6 additions & 10 deletions tests/debuginfo/basic-stepping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@
// Debugger tests need debuginfo
//@ compile-flags: -g

// FIXME(#128945): SingleUseConsts shouldn't need to be disabled.
//@ revisions: default-mir-passes no-SingleUseConsts-mir-pass
//@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts

//@ gdb-command: run
// FIXME(#97083): Should we be able to break on initialization of zero-sized types?
// FIXME(#97083): Right now the first breakable line is:
//@ gdb-check: let mut c = 27;
//@ gdb-command: next
//@ gdb-check: let d = c = 99;
//@ gdb-command: next
//@ [no-SingleUseConsts-mir-pass] gdb-check: let e = "hi bob";
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
//@ [no-SingleUseConsts-mir-pass] gdb-check: let f = b"hi bob";
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
//@ [no-SingleUseConsts-mir-pass] gdb-check: let g = b'9';
//@ [no-SingleUseConsts-mir-pass] gdb-command: next
//@ gdb-check: let e = "hi bob";
//@ gdb-command: next
//@ gdb-check: let f = b"hi bob";
//@ gdb-command: next
//@ gdb-check: let g = b'9';
//@ gdb-command: next
//@ gdb-check: let h = ["whatever"; 8];
//@ gdb-command: next
//@ gdb-check: let i = [1,2,3,4];
Expand Down
5 changes: 1 addition & 4 deletions tests/debuginfo/macro-stepping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
extern crate macro_stepping; // exports new_scope!()

//@ compile-flags: -g
// FIXME(#128945): SingleUseConsts shouldn't need to be disabled.
//@ revisions: default-mir-passes no-SingleUseConsts-mir-pass
//@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts

// === GDB TESTS ===================================================================================

Expand Down Expand Up @@ -51,7 +48,7 @@ extern crate macro_stepping; // exports new_scope!()
//@ gdb-check:[...]#inc-loc2[...]
//@ gdb-command:next
//@ gdb-command:frame
//@ [no-SingleUseConsts-mir-pass] gdb-check:[...]#inc-loc3[...]
//@ gdb-check:[...]#inc-loc3[...]

// === LLDB TESTS ==================================================================================

Expand Down
Loading