2022-03-26 06:14:30 +00:00
|
|
|
// compile-flags: -O
|
2022-03-26 06:46:37 +00:00
|
|
|
// build-pass
|
2022-03-26 06:14:30 +00:00
|
|
|
|
2022-09-24 10:34:56 +00:00
|
|
|
#![feature(allocator_api)]
|
2022-03-26 06:14:30 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-03-26 06:14:30 +00:00
|
|
|
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);
|
|
|
|
|
2022-03-26 06:14:30 +00:00
|
|
|
std::hint::black_box(node);
|
|
|
|
}
|