rust/tests/ui/codegen/issue-82833-slice-miscompile.rs
Martin Nordholts f5f067bf9d Deprecate no-op codegen option -Cinline-threshold=...
This deprecates `-Cinline-threshold` since using it has no effect. This
has been the case since the new LLVM pass manager started being used,
more than 2 years ago.
2024-06-14 20:25:17 +02:00

17 lines
383 B
Rust

//@ run-pass
//@ compile-flags: -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
// 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);
}