]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/borrowed-referent-issue-38899.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / borrowed-referent-issue-38899.rs
1 // Regression test for issue #38899
2
3 pub struct Block<'a> {
4     current: &'a u8,
5     unrelated: &'a u8,
6 }
7
8 fn bump<'a>(mut block: &mut Block<'a>) {
9     let x = &mut block;
10     println!("{}", x.current);
11     let p: &'a u8 = &*block.current;
12     //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
13     drop(x);
14     drop(p);
15 }
16
17 fn main() {}