-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code:
fn t(n: &mut i32) {
n = "42".parse().unwrap();
}I expected to see this happen: Suggestion of *n = ..., the correct code would be
fn t(n: &mut i32) {
*n = "42".parse().unwrap();
}Instead, this happened: It did not look at mutable deref value and directly show the suggestion
error[E0277]: the trait bound `&mut i32: std::str::FromStr` is not satisfied
--> src/lib.rs:2:14
|
2 | n = "42".parse().unwrap();
| ^^^^^ the trait `std::str::FromStr` is not implemented for `&mut i32`
|
= help: the following implementations were found:
<i32 as std::str::FromStr>
Not sure why but I miss * quite often.
Meta
rustc --version --verbose:
1.42.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.