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