1 // Currently, all generic functions are instantiated in each codegen unit that
2 // uses them, even those not marked with #[inline], so this test does not make
3 // much sense at the moment.
7 // We specify -C incremental here because we want to test the partitioning for
8 // incremental compilation
9 // compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/methods-are-with-self-type
16 struct SomeGenericType<T1, T2>(T1, T2);
19 use super::{SomeType, SomeGenericType};
21 // Even though the impl is in `mod1`, the methods should end up in the
22 // parent module, since that is where their self-type is.
24 //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External]
27 //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::associated_fn[0] @@ methods_are_with_self_type[External]
31 impl<T1, T2> SomeGenericType<T1, T2> {
32 pub fn method(&self) {}
33 pub fn associated_fn(_: T1, _: T2) {}
42 // We provide an implementation of `Trait` for all types. The corresponding
43 // monomorphizations should end up in whichever module the concrete `T` is.
57 //~ MONO_ITEM fn methods_are_with_self_type::start[0]
59 fn start(_: isize, _: *const *const u8) -> isize {
60 //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0]<u32, u64> @@ methods_are_with_self_type.volatile[WeakODR]
61 SomeGenericType(0u32, 0u64).method();
62 //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0]<char, &str> @@ methods_are_with_self_type.volatile[WeakODR]
63 SomeGenericType::associated_fn('c', "&str");
65 //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0]<methods_are_with_self_type::type1[0]::Struct[0]> @@ methods_are_with_self_type-type1.volatile[WeakODR]
67 //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0]<methods_are_with_self_type::type2[0]::Struct[0]> @@ methods_are_with_self_type-type2.volatile[WeakODR]
70 //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0]<methods_are_with_self_type::type1[0]::Struct[0]> @@ methods_are_with_self_type-type1.volatile[WeakODR]
71 type1::Struct.default();
72 //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0]<methods_are_with_self_type::type2[0]::Struct[0]> @@ methods_are_with_self_type-type2.volatile[WeakODR]
73 type2::Struct.default();
78 //~ MONO_ITEM drop-glue i8