summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/borrowed-referent-issue-38899.rs
blob: 1fe1332832a14d17fccf9e3e40dbcbfaba83c5b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Regression test for issue #38899

pub struct Block<'a> {
    current: &'a u8,
    unrelated: &'a u8,
}

fn bump<'a>(mut block: &mut Block<'a>) {
    let x = &mut block;
    println!("{}", x.current);
    let p: &'a u8 = &*block.current;
    //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable
    drop(x);
    drop(p);
}

fn main() {}