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