]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen-units/item-collection/trait-method-default-impl.rs
bfcdb6fa142bcde2869a386012f129bce586e9dd
1 // compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on
8 fn bar
<T
>(&self, x
: T
) -> T { x }
11 impl SomeTrait
for i8 {
12 // take the default implementations
14 // For the non-generic foo(), we should generate a codegen-item even if it
15 // is not called anywhere
16 //~ MONO_ITEM fn <i8 as SomeTrait>::foo
19 trait SomeGenericTrait
<T1
> {
21 fn bar
<T2
>(&self, x
: T1
, y
: T2
) {}
24 // Non-generic impl of generic trait
25 impl SomeGenericTrait
<u64> for i32 {
26 // take the default implementations
28 // For the non-generic foo(), we should generate a codegen-item even if it
29 // is not called anywhere
30 //~ MONO_ITEM fn <i32 as SomeGenericTrait<T1>>::foo
33 // Non-generic impl of generic trait
34 impl<T1
> SomeGenericTrait
<T1
> for u32 {
35 // take the default implementations
36 // since nothing is monomorphic here, nothing should be generated unless used somewhere.
39 //~ MONO_ITEM fn start
41 fn start(_
: isize, _
: *const *const u8) -> isize {
42 //~ MONO_ITEM fn <i8 as SomeTrait>::bar::<char>
45 //~ MONO_ITEM fn <i8 as SomeTrait>::bar::<&str>
46 let _
= 2i8.bar("&str");
48 //~ MONO_ITEM fn <i32 as SomeGenericTrait<u64>>::bar::<char>
51 //~ MONO_ITEM fn <i32 as SomeGenericTrait<u64>>::bar::<&str>
52 0i32.bar(0u64, "&str");
54 //~ MONO_ITEM fn <u32 as SomeGenericTrait<i8>>::bar::<&[char; 1]>
55 0u32.bar(0i8, &['c'
]);
57 //~ MONO_ITEM fn <u32 as SomeGenericTrait<i16>>::bar::<()>