File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ feature( nll) ]
12
+
13
+ fn main ( ) {
14
+ let ref foo = 16 ;
15
+ //~^ HELP
16
+ //~| SUGGESTION ref mut foo
17
+ * foo = 32 ;
18
+ //~^ ERROR
19
+ if let Some ( ref bar) = Some ( 16 ) {
20
+ //~^ HELP
21
+ //~| SUGGESTION ref mut bar
22
+ * bar = 32 ;
23
+ //~^ ERROR
24
+ }
25
+ match 16 {
26
+ ref quo => { * quo = 32 ; } ,
27
+ //~^ ERROR
28
+ //~| HELP
29
+ //~| SUGGESTION ref mut quo
30
+ }
31
+ }
Original file line number Diff line number Diff line change
1
+ error[E0594]: cannot assign to `*foo` which is behind a `&` reference
2
+ --> $DIR/suggest-ref-mut.rs:17:5
3
+ |
4
+ LL | *foo = 32;
5
+ | ^^^^^^^^^ cannot assign
6
+
7
+ error[E0594]: cannot assign to `*bar` which is behind a `&` reference
8
+ --> $DIR/suggest-ref-mut.rs:22:9
9
+ |
10
+ LL | *bar = 32;
11
+ | ^^^^^^^^^ cannot assign
12
+
13
+ error[E0594]: cannot assign to `*quo` which is behind a `&` reference
14
+ --> $DIR/suggest-ref-mut.rs:26:22
15
+ |
16
+ LL | ref quo => { *quo = 32; },
17
+ | ^^^^^^^^^ cannot assign
18
+
19
+ error: aborting due to 3 previous errors
20
+
21
+ For more information about this error, try `rustc --explain E0594`.
You can’t perform that action at this time.
0 commit comments