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