]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen-units/item-collection/unsizing.rs
1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-tidy-linelength
12 // compile-flags:-Zprint-mono-items=eager
13 // compile-flags:-Zinline-in-all-cgus
16 #![feature(coerce_unsized)]
20 use std
::marker
::Unsize
;
21 use std
::ops
::CoerceUnsized
;
37 struct Struct
<T
: ?Sized
> {
47 // Custom Coercion Case
52 #[derive(Clone, Copy)]
53 struct Wrapper
<T
: ?Sized
>(*const T
);
55 impl<T
: ?Sized
+ Unsize
<U
>, U
: ?Sized
> CoerceUnsized
<Wrapper
<U
>> for Wrapper
<T
> {}
57 //~ MONO_ITEM fn unsizing::start[0]
59 fn start(_
: isize, _
: *const *const u8) -> isize {
61 let bool_sized
= &true;
62 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing0[Internal]
63 //~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
64 let _bool_unsized
= bool_sized
as &Trait
;
66 let char_sized
= &'a'
;
68 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing0[Internal]
69 //~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
70 let _char_unsized
= char_sized
as &Trait
;
73 let struct_sized
= &Struct
{
78 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing0[Internal]
79 //~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
80 let _struct_unsized
= struct_sized
as &Struct
<Trait
>;
83 let wrapper_sized
= Wrapper(&0u32);
84 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing0[Internal]
85 //~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
86 let _wrapper_sized
= wrapper_sized
as Wrapper
<Trait
>;