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