File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ //! The mir-opt added in <https://github.com/rust-lang/rust/pull/128299> unfortunately seems to lead
2+ //! to a miscompile (reported in <https://github.com/rust-lang/rust/issues/132353>, minimization
3+ //! reproduced in this test file).
4+ //@ revisions: release debug
5+ // Note: it's not strictly cargo's release profile, but any non-zero opt-level was sufficient to
6+ // reproduce the miscompile.
7+ //@[release] compile-flags: -C opt-level=1
8+ //@[debug] compile-flags: -C opt-level=0
9+ //@ run-pass
10+
11+ fn pop_min ( mut score2head : Vec < Option < usize > > ) -> Option < usize > {
12+ loop {
13+ if let Some ( col) = score2head[ 0 ] {
14+ score2head[ 0 ] = None ;
15+ return Some ( col) ;
16+ }
17+ }
18+ }
19+
20+ fn main ( ) {
21+ let min = pop_min ( vec ! [ Some ( 1 ) ] ) ;
22+ println ! ( "min: {:?}" , min) ;
23+ // panic happened on 1.83.0 beta in release mode but not debug mode.
24+ let _ = min. unwrap ( ) ;
25+ }
You can’t perform that action at this time.
0 commit comments