1 // Copyright 2016 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 // Currently, all generic functions are instantiated in each codegen unit that
12 // uses them, even those not marked with #[inline], so this test does not make
13 // much sense at the moment.
16 // ignore-tidy-linelength
17 // We specify -Z incremental here because we want to test the partitioning for
18 // incremental compilation
19 // compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/methods-are-with-self-type
25 struct SomeGenericType
<T1
, T2
>(T1
, T2
);
28 use super::{SomeType, SomeGenericType}
;
30 // Even though the impl is in `mod1`, the methods should end up in the
31 // parent module, since that is where their self-type is.
33 //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External]
36 //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::associated_fn[0] @@ methods_are_with_self_type[External]
40 impl<T1
, T2
> SomeGenericType
<T1
, T2
> {
41 pub fn method(&self) {}
42 pub fn associated_fn(_
: T1
, _
: T2
) {}
51 // We provide an implementation of `Trait` for all types. The corresponding
52 // monomorphizations should end up in whichever module the concrete `T` is.
66 //~ TRANS_ITEM fn methods_are_with_self_type::main[0]
69 //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0]<u32, u64> @@ methods_are_with_self_type.volatile[WeakODR]
70 SomeGenericType(0u32, 0u64).method();
71 //~ TRANS_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0]<char, &str> @@ methods_are_with_self_type.volatile[WeakODR]
72 SomeGenericType
::associated_fn('c'
, "&str");
74 //~ TRANS_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]
76 //~ TRANS_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]
79 //~ TRANS_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]
80 type1
::Struct
.default();
81 //~ TRANS_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]
82 type2
::Struct
.default();
85 //~ TRANS_ITEM drop-glue i8