mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
23 lines
400 B
Rust
23 lines
400 B
Rust
#![feature(raw_ref_op)]
|
|
|
|
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() {}
|