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