diff options
Diffstat (limited to 'tests/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs')
-rw-r--r-- | tests/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs b/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs new file mode 100644 index 000000000..08911c5bd --- /dev/null +++ b/tests/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs @@ -0,0 +1,12 @@ +fn test() { + let v: isize; + //~^ HELP consider making this binding mutable + //~| SUGGESTION mut v + loop { + v = 1; //~ ERROR cannot assign twice to immutable variable `v` + //~| NOTE cannot assign twice to immutable variable + } +} + +fn main() { +} |