]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-borrow-of-mut-base-ptr-safe.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(unused_mut)]
4 #![allow(unused_variables)]
5 // Test that freezing an `&mut` pointer while referent is
6 // frozen is legal.
7 //
8 // Example from compiler/rustc_borrowck/borrowck/README.md
9
10 // pretty-expanded FIXME #23616
11
12 fn foo<'a>(mut t0: &'a mut isize,
13            mut t1: &'a mut isize) {
14     let p: &isize = &*t0; // Freezes `*t0`
15     let mut t2 = &t0;
16     let q: &isize = &**t2; // Freezes `*t0`, but that's ok...
17     let r: &isize = &*t0; // ...after all, could do same thing directly.
18 }
19
20 pub fn main() {
21 }