]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrow-raw-address-of-borrowed.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrow-raw-address-of-borrowed.rs
1 #![feature(raw_ref_op)]
2
3 fn address_of_shared() {
4     let mut x = 0;
5     let y = &x;
6
7     let q = &raw mut x;                 //~ ERROR cannot borrow
8
9     drop(y);
10 }
11
12 fn address_of_mutably_borrowed() {
13     let mut x = 0;
14     let y = &mut x;
15
16     let p = &raw const x;               //~ ERROR cannot borrow
17     let q = &raw mut x;                 //~ ERROR cannot borrow
18
19     drop(y);
20 }
21
22 fn main() {}