-
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 lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=08b90ff4a7eec137c7da11cbb5f8d81f
use core::ptr;
fn test(_: *mut u8){}
fn main() {
test(ptr::null());
}
The current output is:
error[E0308]: mismatched types
--> src/main.rs:6:10
|
6 | test(ptr::null());
| ^^^^^^^^^^^ types differ in mutability
|
= note: expected raw pointer `*mut u8`
found raw pointer `*const _`
Ideally it would suggest me to use ptr::null_mut()
instead.
@estebank (opened this issue because you always ask people on twitter to open issues about diagnostic improvements :) )
estebank and Aaron1011
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.