Skip to content

Commit a1c24bf

Browse files
committed
Add ugly suggestion test
1 parent e903b8f commit a1c24bf

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/ui/zero_ptr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ fn main() {
55
let _ = 0 as *mut f64;
66
let _: *const u8 = 0 as *const _;
77

8+
// FIXME: ugly suggestion
9+
#[rustfmt::skip]
10+
let _ = 0 as * const usize;
11+
812
foo(0 as _, 0 as _);
913
foo(0 as *const _, 0 as *mut _);
1014

tests/ui/zero_ptr.stderr

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@ LL | let _: *const u8 = 0 as *const _;
1919
| ^^^^^^^^^^^^^ help: try: `std::ptr::null()`
2020

2121
error: `0 as *const _` detected
22-
--> $DIR/zero_ptr.rs:9:9
22+
--> $DIR/zero_ptr.rs:10:13
23+
|
24+
LL | let _ = 0 as * const usize;
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::null::<* const usize>()`
26+
27+
error: `0 as *const _` detected
28+
--> $DIR/zero_ptr.rs:13:9
2329
|
2430
LL | foo(0 as *const _, 0 as *mut _);
2531
| ^^^^^^^^^^^^^ help: try: `std::ptr::null()`
2632

2733
error: `0 as *mut _` detected
28-
--> $DIR/zero_ptr.rs:9:24
34+
--> $DIR/zero_ptr.rs:13:24
2935
|
3036
LL | foo(0 as *const _, 0 as *mut _);
3137
| ^^^^^^^^^^^ help: try: `std::ptr::null_mut()`
3238

33-
error: aborting due to 5 previous errors
39+
error: aborting due to 6 previous errors
3440

0 commit comments

Comments
 (0)