File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ // edition:2018
2
+ #![ feature( async_await) ]
3
+
4
+ pub async fn f ( x : Option < usize > ) {
5
+ x. take ( ) ;
6
+ //~^ ERROR cannot borrow `x` as mutable, as it is not declared as mutable [E0596]
7
+ }
8
+
9
+ pub async fn g ( x : usize ) {
10
+ x += 1 ;
11
+ //~^ ERROR cannot assign twice to immutable variable `x` [E0384]
12
+ }
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2
+ --> $DIR/issue-61452.rs:5:5
3
+ |
4
+ LL | pub async fn f(x: Option<usize>) {
5
+ | - help: consider changing this to be mutable: `mut x`
6
+ LL | x.take();
7
+ | ^ cannot borrow as mutable
8
+
9
+ error[E0384]: cannot assign twice to immutable variable `x`
10
+ --> $DIR/issue-61452.rs:10:5
11
+ |
12
+ LL | pub async fn g(x: usize) {
13
+ | -
14
+ | |
15
+ | first assignment to `x`
16
+ | help: make this binding mutable: `mut x`
17
+ LL | x += 1;
18
+ | ^^^^^^ cannot assign twice to immutable variable
19
+
20
+ error: aborting due to 2 previous errors
21
+
22
+ Some errors have detailed explanations: E0384, E0596.
23
+ For more information about an error, try `rustc --explain E0384`.
You can’t perform that action at this time.
0 commit comments