Rollup merge of #127391 - estebank:null_mut, r=cjgillot

Use verbose suggestion for `ptr::null_mut()`
This commit is contained in:
Matthias Krüger 2024-07-06 13:26:26 +02:00 committed by GitHub
commit 1e0028197f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -501,6 +501,7 @@ pub enum SuggestBoxing {
#[suggestion(
hir_typeck_suggest_ptr_null_mut,
applicability = "maybe-incorrect",
style = "verbose",
code = "core::ptr::null_mut()"
)]
pub struct SuggestPtrNullMut {

View File

@ -2,10 +2,8 @@ error[E0308]: mismatched types
--> $DIR/ptr-null-mutability-suggestions.rs:9:24
|
LL | expecting_null_mut(ptr::null());
| ------------------ ^^^^^^^^^^^
| | |
| | types differ in mutability
| | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()`
| ------------------ ^^^^^^^^^^^ types differ in mutability
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut u8`
@ -15,6 +13,10 @@ note: function defined here
|
LL | fn expecting_null_mut(_: *mut u8) {}
| ^^^^^^^^^^^^^^^^^^ ----------
help: consider using `core::ptr::null_mut` instead
|
LL | expecting_null_mut(core::ptr::null_mut());
| ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error