]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-48803.rs
Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercote
[rust.git] / src / test / ui / nll / issue-48803.rs
1 fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T {
2     x
3 }
4
5 fn main() {
6     let mut x = "original";
7     let y = &x;
8     let z = &y;
9     let w = flatten(z);
10     x = "modified";
11     //~^ ERROR cannot assign to `x` because it is borrowed [E0506]
12     println!("{}", w); // prints "modified"
13 }