summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-48803.rs
blob: f7fd04179f26e35e70216fb2fb87b3770c1d87d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T {
    x
}

fn main() {
    let mut x = "original";
    let y = &x;
    let z = &y;
    let w = flatten(z);
    x = "modified";
    //~^ ERROR cannot assign to `x` because it is borrowed [E0506]
    println!("{}", w); // prints "modified"
}