Add help when trying to use literal 0 as raw pointer #107517
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
(Note the added help line.)
C programers could reasonably expect
0
in a raw-pointer position to mean null. Seems like this could be a fairly simple check to save them a google.(For reference: I'm a fairly experienced Rust programmer, and a novice C programmer, but I haven't done much FFI. I couldn't remember what
std::ptr::null
was called, so I tried 0; I was pretty sure it wasn't going to work, but I hoped I might at least get a helpful error.)Other cases
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: