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 730a9ca commit 65f42fdCopy full SHA for 65f42fd
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