File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change 1
- //@ run-pass
2
-
3
- #![ allow( unused_variables) ]
4
- // Test coercions between pointers which don't do anything fancy like unsizing.
1
+ //! Tests basic pointer coercions between:
2
+ //! - `&mut T` -> `&T`
3
+ //! - `&T` -> `*const T`
4
+ //! - `&mut T` -> `*const T`
5
+ //! - `*mut T` -> `*const T`
5
6
7
+ //@ run-pass
6
8
7
9
pub fn main ( ) {
8
10
// &mut -> &
9
11
let x: & mut isize = & mut 42 ;
10
- let x: & isize = x;
11
-
12
- let x: & isize = & mut 42 ;
12
+ let _: & isize = x;
13
+ let _: & isize = & mut 42 ;
13
14
14
15
// & -> *const
15
16
let x: & isize = & 42 ;
16
- let x: * const isize = x;
17
-
18
- let x: * const isize = & 42 ;
17
+ let _: * const isize = x;
18
+ let _: * const isize = & 42 ;
19
19
20
20
// &mut -> *const
21
21
let x: & mut isize = & mut 42 ;
22
- let x: * const isize = x;
23
-
24
- let x: * const isize = & mut 42 ;
22
+ let _: * const isize = x;
23
+ let _: * const isize = & mut 42 ;
25
24
26
25
// *mut -> *const
27
- let x : * mut isize = & mut 42 ;
28
- let x : * const isize = x;
26
+ let _ : * mut isize = & mut 42 ;
27
+ let _ : * const isize = x;
29
28
}
You can’t perform that action at this time.
0 commit comments