Skip to content

Commit fca286a

Browse files
committed
Use verbose suggestion for ptr::null_mut()
1 parent c422581 commit fca286a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/rustc_hir_typeck/src/errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ pub enum SuggestBoxing {
501501
#[suggestion(
502502
hir_typeck_suggest_ptr_null_mut,
503503
applicability = "maybe-incorrect",
504+
style = "verbose",
504505
code = "core::ptr::null_mut()"
505506
)]
506507
pub struct SuggestPtrNullMut {

tests/ui/typeck/ptr-null-mutability-suggestions.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ error[E0308]: mismatched types
22
--> $DIR/ptr-null-mutability-suggestions.rs:9:24
33
|
44
LL | expecting_null_mut(ptr::null());
5-
| ------------------ ^^^^^^^^^^^
6-
| | |
7-
| | types differ in mutability
8-
| | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()`
5+
| ------------------ ^^^^^^^^^^^ types differ in mutability
6+
| |
97
| arguments to this function are incorrect
108
|
119
= note: expected raw pointer `*mut u8`
@@ -15,6 +13,10 @@ note: function defined here
1513
|
1614
LL | fn expecting_null_mut(_: *mut u8) {}
1715
| ^^^^^^^^^^^^^^^^^^ ----------
16+
help: consider using `core::ptr::null_mut` instead
17+
|
18+
LL | expecting_null_mut(core::ptr::null_mut());
19+
| ~~~~~~~~~~~~~~~~~~~~~
1820

1921
error: aborting due to 1 previous error
2022

0 commit comments

Comments
 (0)