]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/stacked_borrows/unescaped_static.rs
Merge branch 'master' into debug
[rust.git] / tests / compile-fail / stacked_borrows / unescaped_static.rs
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 }