-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
#![crate_type = "lib"]
use std::collections::HashSet;
pub struct T {}
fn f(map: HashSet<usize>, v: *const T) {
map.contains(v as usize);
}
The current error message is:
|
8 | map.contains(v as usize);
| ^^^^^^^^^^ expected &usize, found usize
|
= note: expected type `&usize`
found type `usize`
= help: try with `&v as usize`
It should suggest trying &(v as usize)
: at the moment, if the user tries the current suggestion, they'll be told to try &&v as usize
, and so on.
Playground link
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics