diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/nll/closure-use-spans.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/nll/closure-use-spans.rs b/src/test/ui/nll/closure-use-spans.rs new file mode 100644 index 000000000..6768250dc --- /dev/null +++ b/src/test/ui/nll/closure-use-spans.rs @@ -0,0 +1,21 @@ +// check that liveness due to a closure capture gives a special note + +fn use_as_borrow_capture(mut x: i32) { + let y = &x; + x = 0; //~ ERROR + || *y; +} + +fn use_as_borrow_mut_capture(mut x: i32) { + let y = &mut x; + x = 0; //~ ERROR + || *y = 1; +} + +fn use_as_move_capture(mut x: i32) { + let y = &x; + x = 0; //~ ERROR + move || *y; +} + +fn main() {} |