Bad suggestion when *raw_ptr
is used where a reference is expected
#135580
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
The current suggestion is plain wrong, the result does not build.
Note that one definitely wants the
&
to go inside the unsafe block to avoid creating a temporary! For this example, the type is non-Copy
so a temporary wouldn't even be possible, but in other cases both ways could compiler but they do not behave the same.Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: