We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e03255d commit 9f48b30Copy full SHA for 9f48b30
tests/compile-fail/stacked_borrows/unescaped_static.rs
@@ -0,0 +1,7 @@
1
+static ARRAY: [u8; 2] = [0, 1];
2
+
3
+fn main() {
4
+ let ptr_to_first = &ARRAY[0] as *const u8;
5
+ // Illegally use this to access the 2nd element.
6
+ let _val = unsafe { *ptr_to_first.add(1) }; //~ ERROR borrow stack
7
+}
0 commit comments