rust/tests/ui/box/issue-95036.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
413 B
Rust
Raw Normal View History

// compile-flags: -O
2022-03-26 06:46:37 +00:00
// build-pass
2022-09-24 10:34:56 +00:00
#![feature(allocator_api)]
2022-03-27 20:35:29 +00:00
#[inline(never)]
pub fn by_ref(node: &mut Box<[u8; 1], &std::alloc::Global>) {
node[0] = 9u8;
}
pub fn main() {
let mut node = Box::new_in([5u8], &std::alloc::Global);
node[0] = 7u8;
2022-03-27 20:35:29 +00:00
std::hint::black_box(node);
let mut node = Box::new_in([5u8], &std::alloc::Global);
by_ref(&mut node);
std::hint::black_box(node);
}