Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag static/const allocations #748

Merged
merged 4 commits into from Jun 2, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

test that we cannot access unescaped static memory with a raw ptr

  • Loading branch information...
RalfJung committed May 28, 2019
commit 9f48b3029ca51997945ae4170f1e2b0ebb23a7a2
@@ -0,0 +1,7 @@
static ARRAY: [u8; 2] = [0, 1];

fn main() {
let ptr_to_first = &ARRAY[0] as *const u8;
// Illegally use this to access the 2nd element.
let _val = unsafe { *ptr_to_first.add(1) }; //~ ERROR borrow stack
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.