Skip to content

Commit

Permalink
Add ugly suggestion test
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Oct 2, 2019
1 parent e903b8f commit a1c24bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tests/ui/zero_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ fn main() {
let _ = 0 as *mut f64;
let _: *const u8 = 0 as *const _;

// FIXME: ugly suggestion
#[rustfmt::skip]
let _ = 0 as * const usize;

foo(0 as _, 0 as _);
foo(0 as *const _, 0 as *mut _);

Expand Down
12 changes: 9 additions & 3 deletions tests/ui/zero_ptr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ LL | let _: *const u8 = 0 as *const _;
| ^^^^^^^^^^^^^ help: try: `std::ptr::null()`

error: `0 as *const _` detected
--> $DIR/zero_ptr.rs:9:9
--> $DIR/zero_ptr.rs:10:13
|
LL | let _ = 0 as * const usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::null::<* const usize>()`

error: `0 as *const _` detected
--> $DIR/zero_ptr.rs:13:9
|
LL | foo(0 as *const _, 0 as *mut _);
| ^^^^^^^^^^^^^ help: try: `std::ptr::null()`

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

error: aborting due to 5 previous errors
error: aborting due to 6 previous errors

0 comments on commit a1c24bf

Please sign in to comment.