LL | opt = None;
| ^^^^ expected mutable reference, found enum `std::option::Option`
|
- = note: expected type `&mut std::option::Option<std::string::String>`
- found type `std::option::Option<_>`
+ = note: expected mutable reference `&mut std::option::Option<std::string::String>`
+ found enum `std::option::Option<_>`
help: consider dereferencing here to assign to the mutable borrowed piece of memory
|
LL | *opt = None;
LL | opt = None
| ^^^^ expected mutable reference, found enum `std::option::Option`
|
- = note: expected type `&mut std::result::Result<std::string::String, ()>`
- found type `std::option::Option<_>`
+ = note: expected mutable reference `&mut std::result::Result<std::string::String, ()>`
+ found enum `std::option::Option<_>`
error[E0308]: mismatched types
--> $DIR/mut-ref-reassignment.rs:10:11
LL | opt = Some(String::new())
| ^^^^^^^^^^^^^^^^^^^ expected mutable reference, found enum `std::option::Option`
|
- = note: expected type `&mut std::option::Option<std::string::String>`
- found type `std::option::Option<std::string::String>`
+ = note: expected mutable reference `&mut std::option::Option<std::string::String>`
+ found enum `std::option::Option<std::string::String>`
help: consider dereferencing here to assign to the mutable borrowed piece of memory
|
LL | *opt = Some(String::new())
LL | opt = Some(42)
| ^^^^^^^^ expected mutable reference, found enum `std::option::Option`
|
- = note: expected type `&mut std::option::Option<std::string::String>`
- found type `std::option::Option<{integer}>`
+ = note: expected mutable reference `&mut std::option::Option<std::string::String>`
+ found enum `std::option::Option<{integer}>`
error: aborting due to 4 previous errors