fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.0 KiB55 linesraw
1error[E0308]: mismatched types
2  --> $DIR/mut-ref-reassignment.rs:2:11
3   |
4LL | fn suggestion(opt: &mut Option<String>) {
5   |                    ------------------- expected due to this parameter type
6LL |     opt = None;
7   |           ^^^^ expected `&mut Option<String>`, found `Option<_>`
8   |
9   = note: expected mutable reference `&mut Option<String>`
10                           found enum `Option<_>`
11help: consider dereferencing here to assign to the mutably borrowed value
12   |
13LL |     *opt = None;
14   |     +
15
16error[E0308]: mismatched types
17  --> $DIR/mut-ref-reassignment.rs:6:11
18   |
19LL | fn no_suggestion(opt: &mut Result<String, ()>) {
20   |                       ----------------------- expected due to this parameter type
21LL |     opt = None
22   |           ^^^^ expected `&mut Result<String, ()>`, found `Option<_>`
23   |
24   = note: expected mutable reference `&mut Result<String, ()>`
25                           found enum `Option<_>`
26
27error[E0308]: mismatched types
28  --> $DIR/mut-ref-reassignment.rs:10:11
29   |
30LL | fn suggestion2(opt: &mut Option<String>) {
31   |                     ------------------- expected due to this parameter type
32LL |     opt = Some(String::new())
33   |           ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>`
34   |
35   = note: expected mutable reference `&mut Option<String>`
36                           found enum `Option<String>`
37help: consider dereferencing here to assign to the mutably borrowed value
38   |
39LL |     *opt = Some(String::new())
40   |     +
41
42error[E0308]: mismatched types
43  --> $DIR/mut-ref-reassignment.rs:14:11
44   |
45LL | fn no_suggestion2(opt: &mut Option<String>) {
46   |                        ------------------- expected due to this parameter type
47LL |     opt = Some(42)
48   |           ^^^^^^^^ expected `&mut Option<String>`, found `Option<{integer}>`
49   |
50   = note: expected mutable reference `&mut Option<String>`
51                           found enum `Option<{integer}>`
52
53error: aborting due to 4 previous errors
54
55For more information about this error, try `rustc --explain E0308`.