Add tests for issues #82833 and #82859

This commit is contained in:
Nikita Popov 2021-03-11 22:55:11 +01:00
parent d9be71a5b8
commit ef269ac4fc
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// run-pass
// compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
// ignore-tidy-linelength
// Make sure LLVM does not miscompile this.
fn make_string(ch: char) -> String {
let mut bytes = [0u8; 4];
ch.encode_utf8(&mut bytes).into()
}
fn main() {
let ch = '😃';
dbg!(ch);
let string = make_string(ch);
dbg!(string);
}

View File

@ -0,0 +1,19 @@
// run-pass
// compile-flags: -Copt-level=0 -Cdebuginfo=2
// Make sure LLVM does not miscompile this.
fn indirect_get_slice() -> &'static [usize] {
&[]
}
#[inline(always)]
fn get_slice() -> &'static [usize] {
let ret = indirect_get_slice();
ret
}
fn main() {
let output = get_slice().len();
assert_eq!(output, 0);
}