]> git.lizzy.rs Git - rust.git/blob - tests/ui/codegen/issue-82859-slice-miscompile.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / codegen / issue-82859-slice-miscompile.rs
1 // run-pass
2 // compile-flags: -Copt-level=0 -Cdebuginfo=2
3
4 // Make sure LLVM does not miscompile this.
5
6 fn indirect_get_slice() -> &'static [usize] {
7     &[]
8 }
9
10 #[inline(always)]
11 fn get_slice() -> &'static [usize] {
12     let ret = indirect_get_slice();
13     ret
14 }
15
16 fn main() {
17     let output = get_slice().len();
18     assert_eq!(output, 0);
19 }