File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
src/test/run-make-fulldeps/sanitizer-leak Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11-include ../tools.mk
22
33# needs-sanitizer-support
4- # only-linux
5- # only-x86_64
6- # ignore-test
7- # FIXME(#46126) ThinLTO for libstd broke this test
84
95all :
10- $(RUSTC ) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | $(CGREP ) rustc_rt.lsan
6+ $(RUSTC ) -O -Z sanitizer=leak -Z print-link-args leak.rs | $(CGREP ) rustc_rt.lsan
117 $(TMPDIR ) /leak 2>&1 | $(CGREP ) ' detected memory leaks'
Original file line number Diff line number Diff line change 1+ #![ feature( test) ]
2+
3+ use std:: hint:: black_box;
14use std:: mem;
25
36fn main ( ) {
4- let xs = vec ! [ 1 , 2 , 3 , 4 ] ;
5- mem:: forget ( xs) ;
7+ for _ in 0 ..10 {
8+ let xs = vec ! [ 1 , 2 , 3 ] ;
9+ // Prevent compiler from removing the memory allocation.
10+ let xs = black_box ( xs) ;
11+ mem:: forget ( xs) ;
12+ }
613}
You can’t perform that action at this time.
0 commit comments