rust/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
375 B
Rust
Raw Normal View History

2019-09-18 20:31:25 +00:00
fn address_of_shared() {
let mut x = 0;
let y = &x;
let q = &raw mut x; //~ ERROR cannot borrow
drop(y);
}
fn address_of_mutably_borrowed() {
let mut x = 0;
let y = &mut x;
let p = &raw const x; //~ ERROR cannot borrow
let q = &raw mut x; //~ ERROR cannot borrow
drop(y);
}
fn main() {}