summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs
blob: f25fd7f66b3ccdaabfd6a91889578dd7a9d21948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![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() {}