diff options
Diffstat (limited to 'src/test/ui/nll/capture-mut-ref.fixed')
-rw-r--r-- | src/test/ui/nll/capture-mut-ref.fixed | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/nll/capture-mut-ref.fixed b/src/test/ui/nll/capture-mut-ref.fixed new file mode 100644 index 000000000..2dacb26b6 --- /dev/null +++ b/src/test/ui/nll/capture-mut-ref.fixed @@ -0,0 +1,16 @@ +// run-rustfix + +// Check that capturing a mutable reference by move and assigning to its +// referent doesn't make the unused mut lint think that it is mutable. + +#![deny(unused_mut)] + +pub fn mutable_upvar() { + let x = &mut 0; + //~^ ERROR + let _ = move || { + *x = 1; + }; +} + +fn main() {} |