2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-14 10:20:28 +00:00
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(unused_variables)]
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-03-26 00:06:52 +00:00
|
|
|
let i: isize = 'Q' as isize;
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(i, 0x51);
|
2011-07-27 12:19:39 +00:00
|
|
|
let u: u32 = i as u32;
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(u, 0x51 as u32);
|
|
|
|
assert_eq!(u, 'Q' as u32);
|
|
|
|
assert_eq!(i as u8, 'Q' as u8);
|
|
|
|
assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
|
2015-03-03 08:42:26 +00:00
|
|
|
assert_eq!(0x51 as char, 'Q');
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(0 as u32, false as u32);
|
2018-03-22 20:41:07 +00:00
|
|
|
|
|
|
|
// Test that `_` is correctly inferred.
|
|
|
|
let x = &"hello";
|
|
|
|
let mut y = x as *const _;
|
2019-06-17 10:52:37 +00:00
|
|
|
y = core::ptr::null_mut();
|
2011-08-19 22:16:48 +00:00
|
|
|
}
|