about summary refs log tree commit diff
path: root/src/test/ui/box
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-03-27 13:35:29 -0700
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-03-27 13:35:29 -0700
commit09ccc63624f627e44f13c480c934b4d28a845258 (patch)
treef41d2dbd6f7d594ffdeb02cbbdeee0aba33c47cc /src/test/ui/box
parentece64ed3f56f811f2122dc3dcbff85bf47f8fee3 (diff)
downloadrust-09ccc63624f627e44f13c480c934b4d28a845258.tar.gz
rust-09ccc63624f627e44f13c480c934b4d28a845258.zip
fix other source of box deref
Diffstat (limited to 'src/test/ui/box')
-rw-r--r--src/test/ui/box/issue-95036.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/box/issue-95036.rs b/src/test/ui/box/issue-95036.rs
index e55a10af3d6..c2d4275aa49 100644
--- a/src/test/ui/box/issue-95036.rs
+++ b/src/test/ui/box/issue-95036.rs
@@ -3,8 +3,20 @@
 
 #![feature(allocator_api, bench_black_box)]
 
+#[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;
+
+    std::hint::black_box(node);
+
+    let mut node = Box::new_in([5u8], &std::alloc::Global);
+
+    by_ref(&mut node);
+
     std::hint::black_box(node);
 }