This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +8
-1
lines changed Expand file tree Collapse file tree 6 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 13
13
14
14
fn test ( ) {
15
15
let v: isize ;
16
+ //[mir]~^ NOTE consider changing this to `mut v`
16
17
v = 1 ; //[ast]~ NOTE first assignment
17
18
//[mir]~^ NOTE first assignment
18
19
println ! ( "v={}" , v) ;
Original file line number Diff line number Diff line change 13
13
14
14
fn test_drop_replace ( ) {
15
15
let b: Box < isize > ;
16
+ //[mir]~^ NOTE consider changing this to `mut b`
16
17
b = Box :: new ( 1 ) ; //[ast]~ NOTE first assignment
17
18
//[mir]~^ NOTE first assignment
18
19
b = Box :: new ( 2 ) ; //[ast]~ ERROR cannot assign twice to immutable variable
@@ -24,14 +25,15 @@ fn test_drop_replace() {
24
25
fn test_call ( ) {
25
26
let b = Box :: new ( 1 ) ; //[ast]~ NOTE first assignment
26
27
//[mir]~^ NOTE first assignment
28
+ //[mir]~| NOTE consider changing this to `mut b`
27
29
b = Box :: new ( 2 ) ; //[ast]~ ERROR cannot assign twice to immutable variable
28
30
//[mir]~^ ERROR cannot assign twice to immutable variable `b`
29
31
//[ast]~| NOTE cannot assign twice to immutable
30
32
//[mir]~| NOTE cannot assign twice to immutable
31
33
}
32
34
33
35
fn test_args ( b : Box < i32 > ) { //[ast]~ NOTE first assignment
34
- //[mir]~^ NOTE argument not declared as `mut`
36
+ //[mir]~^ NOTE consider changing this to `mut b `
35
37
b = Box :: new ( 2 ) ; //[ast]~ ERROR cannot assign twice to immutable variable
36
38
//[mir]~^ ERROR cannot assign to immutable argument `b`
37
39
//[ast]~| NOTE cannot assign twice to immutable
Original file line number Diff line number Diff line change 13
13
14
14
fn test ( ) {
15
15
let v: isize ;
16
+ //[mir]~^ NOTE consider changing this to `mut v`
16
17
loop {
17
18
v = 1 ; //[ast]~ ERROR cannot assign twice to immutable variable
18
19
//[mir]~^ ERROR cannot assign twice to immutable variable `v`
Original file line number Diff line number Diff line change 13
13
14
14
fn test ( ) {
15
15
let v: isize ;
16
+ //[mir]~^ NOTE consider changing this to `mut v`
16
17
v = 2 ; //[ast]~ NOTE first assignment
17
18
//[mir]~^ NOTE first assignment
18
19
v += 1 ; //[ast]~ ERROR cannot assign twice to immutable variable
Original file line number Diff line number Diff line change 14
14
fn test ( ) {
15
15
let b = Box :: new ( 1 ) ; //[ast]~ NOTE first assignment
16
16
//[mir]~^ NOTE first assignment
17
+ //[mir]~| NOTE consider changing this to `mut b`
17
18
drop ( b) ;
18
19
b = Box :: new ( 2 ) ; //[ast]~ ERROR cannot assign twice to immutable variable
19
20
//[mir]~^ ERROR cannot assign twice to immutable variable `b`
Original file line number Diff line number Diff line change 14
14
fn test ( ) {
15
15
let v: isize = 1 ; //[ast]~ NOTE first assignment
16
16
//[mir]~^ NOTE first assignment
17
+ //[mir]~| NOTE consider changing this to `mut v`
17
18
v. clone ( ) ;
18
19
v = 2 ; //[ast]~ ERROR cannot assign twice to immutable variable
19
20
//[mir]~^ ERROR cannot assign twice to immutable variable `v`
You can’t perform that action at this time.
0 commit comments