Skip to content

Commit ef269ac

Browse files
committed
Add tests for issues #82833 and #82859
1 parent d9be71a commit ef269ac

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// run-pass
2+
// compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
3+
// ignore-tidy-linelength
4+
5+
// Make sure LLVM does not miscompile this.
6+
7+
fn make_string(ch: char) -> String {
8+
let mut bytes = [0u8; 4];
9+
ch.encode_utf8(&mut bytes).into()
10+
}
11+
12+
fn main() {
13+
let ch = '😃';
14+
dbg!(ch);
15+
let string = make_string(ch);
16+
dbg!(string);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

0 commit comments

Comments
 (0)