diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-06 13:26:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-06 13:26:26 +0200 |
| commit | 1e0028197fa3fdd5e760d75b3a7eed299d2f405b (patch) | |
| tree | acea2ddddec869bba2602d7430f5cbd2b24fe588 | |
| parent | 04056524a03291a7e90a33508027e749535df7dc (diff) | |
| parent | fca286a39edc17480bce0ce9215a1eab349e9497 (diff) | |
Rollup merge of #127391 - estebank:null_mut, r=cjgillot
Use verbose suggestion for `ptr::null_mut()`
| -rw-r--r-- | compiler/rustc_hir_typeck/src/errors.rs | 1 | ||||
| -rw-r--r-- | tests/ui/typeck/ptr-null-mutability-suggestions.stderr | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index e49b921e63c..f1ed2ade3d4 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -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 { diff --git a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr index b615d9fb45c..2912977a461 100644 --- a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr +++ b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr @@ -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 |
