2019-05-22 15:10:38 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/mut-ref-reassignment.rs:2:11
|
|
|
|
|
|
2021-05-06 21:09:35 -05:00
|
|
|
LL | fn suggestion(opt: &mut Option<String>) {
|
|
|
|
| ------------------- expected due to this parameter type
|
2019-05-23 12:32:01 -05:00
|
|
|
LL | opt = None;
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^ expected `&mut Option<String>`, found `Option<_>`
|
2019-05-22 15:10:38 -05:00
|
|
|
|
|
2020-09-02 02:40:56 -05:00
|
|
|
= note: expected mutable reference `&mut Option<String>`
|
|
|
|
found enum `Option<_>`
|
2022-03-05 03:57:43 -06:00
|
|
|
help: consider dereferencing here to assign to the mutably borrowed value
|
2019-05-22 15:10:38 -05:00
|
|
|
|
|
2019-05-23 12:32:01 -05:00
|
|
|
LL | *opt = None;
|
2021-06-21 21:07:19 -05:00
|
|
|
| +
|
2019-05-22 15:10:38 -05:00
|
|
|
|
2019-05-23 12:32:01 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/mut-ref-reassignment.rs:6:11
|
|
|
|
|
|
2021-05-06 21:09:35 -05:00
|
|
|
LL | fn no_suggestion(opt: &mut Result<String, ()>) {
|
|
|
|
| ----------------------- expected due to this parameter type
|
2019-05-23 12:32:01 -05:00
|
|
|
LL | opt = None
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^ expected `&mut Result<String, ()>`, found `Option<_>`
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
2021-01-28 10:01:36 -06:00
|
|
|
= note: expected mutable reference `&mut Result<String, ()>`
|
2020-09-02 02:40:56 -05:00
|
|
|
found enum `Option<_>`
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/mut-ref-reassignment.rs:10:11
|
|
|
|
|
|
2021-05-06 21:09:35 -05:00
|
|
|
LL | fn suggestion2(opt: &mut Option<String>) {
|
|
|
|
| ------------------- expected due to this parameter type
|
2019-05-23 12:32:01 -05:00
|
|
|
LL | opt = Some(String::new())
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>`
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
2020-09-02 02:40:56 -05:00
|
|
|
= note: expected mutable reference `&mut Option<String>`
|
|
|
|
found enum `Option<String>`
|
2022-03-05 03:57:43 -06:00
|
|
|
help: consider dereferencing here to assign to the mutably borrowed value
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
|
|
|
LL | *opt = Some(String::new())
|
2021-06-21 21:07:19 -05:00
|
|
|
| +
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/mut-ref-reassignment.rs:14:11
|
|
|
|
|
|
2021-05-06 21:09:35 -05:00
|
|
|
LL | fn no_suggestion2(opt: &mut Option<String>) {
|
|
|
|
| ------------------- expected due to this parameter type
|
2019-05-23 12:32:01 -05:00
|
|
|
LL | opt = Some(42)
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^^^^^ expected `&mut Option<String>`, found `Option<{integer}>`
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
2020-09-02 02:40:56 -05:00
|
|
|
= note: expected mutable reference `&mut Option<String>`
|
|
|
|
found enum `Option<{integer}>`
|
2019-05-23 12:32:01 -05:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
2019-05-22 15:10:38 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|