Closed
Description
fn main() {
let a = &true;
let b = &false;
assert!(a as *const _ == b as *const _);
}
test.rs:5:30: 5:43 warning: trivial cast: `&bool` as `*const bool`, #[warn(trivial_casts)] on by default
test.rs:5 assert!(a as *const _ == b as *const _);
^~~~~~~~~~~~~
<std macros>:1:1: 5:46 note: in expansion of assert!
test.rs:5:5: 5:45 note: expansion site
But removing the second cast doesn't compile:
fn main() {
let a = &true;
let b = &false;
assert!(a as *const _ == b);
}
test.rs:5:30: 5:31 error: mismatched types:
expected `*const _`,
found `&bool`
(expected *-ptr,
found &-ptr) [E0308]
test.rs:5 assert!(a as *const _ == b);
^
<std macros>:1:1: 5:46 note: in expansion of assert!
test.rs:5:5: 5:33 note: expansion site
error: aborting due to previous error
cc @nrc