2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2019-07-26 21:54:25 +00:00
|
|
|
|
2018-09-14 10:20:28 +00:00
|
|
|
#![allow(unused_variables)]
|
2014-12-12 03:54:57 +00:00
|
|
|
// Test coercions between pointers which don't do anything fancy like unsizing.
|
|
|
|
|
2024-02-16 20:02:50 +00:00
|
|
|
//@ pretty-expanded FIXME #23616
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2014-12-12 03:54:57 +00:00
|
|
|
pub fn main() {
|
|
|
|
// &mut -> &
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: &mut isize = &mut 42;
|
|
|
|
let x: &isize = x;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: &isize = &mut 42;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
|
|
|
// & -> *const
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: &isize = &42;
|
|
|
|
let x: *const isize = x;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: *const isize = &42;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
|
|
|
// &mut -> *const
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: &mut isize = &mut 42;
|
|
|
|
let x: *const isize = x;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: *const isize = &mut 42;
|
2014-12-12 03:54:57 +00:00
|
|
|
|
|
|
|
// *mut -> *const
|
2015-03-26 00:06:52 +00:00
|
|
|
let x: *mut isize = &mut 42;
|
|
|
|
let x: *const isize = x;
|
2014-12-12 03:54:57 +00:00
|
|
|
}
|