]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/closure-use-spans.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / closure-use-spans.rs
1 // check that liveness due to a closure capture gives a special note
2
3 fn use_as_borrow_capture(mut x: i32) {
4     let y = &x;
5     x = 0; //~ ERROR
6     || *y;
7 }
8
9 fn use_as_borrow_mut_capture(mut x: i32) {
10     let y = &mut x;
11     x = 0; //~ ERROR
12     || *y = 1;
13 }
14
15 fn use_as_move_capture(mut x: i32) {
16     let y = &x;
17     x = 0; //~ ERROR
18     move || *y;
19 }
20
21 fn main() {}