diff options
Diffstat (limited to 'tests/ui/nll/issue-48803.rs')
-rw-r--r-- | tests/ui/nll/issue-48803.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/nll/issue-48803.rs b/tests/ui/nll/issue-48803.rs new file mode 100644 index 000000000..f7fd04179 --- /dev/null +++ b/tests/ui/nll/issue-48803.rs @@ -0,0 +1,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" +} |