File tree 2 files changed +51
-0
lines changed
src/test/codegen-units/partitioning
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ // compile-flags:-Zshare-generics=yes
12
+
13
+ #![ crate_type="rlib" ]
14
+
15
+ pub fn generic_fn < T > ( x : T , y : T ) -> ( T , T ) {
16
+ ( x, y)
17
+ }
18
+
19
+ pub fn use_generic_fn_f32 ( ) -> ( f32 , f32 ) {
20
+ generic_fn ( 0.0f32 , 1.0f32 )
21
+ }
Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ // ignore-tidy-linelength
12
+ // compile-flags:-Zprint-trans-items=eager -Zshare-generics=yes -Zincremental=tmp/partitioning-tests/shared-generics-exe
13
+
14
+ #![ crate_type="rlib" ]
15
+
16
+ // aux-build:shared_generics_aux.rs
17
+ extern crate shared_generics_aux;
18
+
19
+ //~ TRANS_ITEM fn shared_generics::foo[0]
20
+ pub fn foo ( ) {
21
+
22
+ //~ TRANS_ITEM fn shared_generics_aux::generic_fn[0]<u16> @@ shared_generics_aux.volatile[External]
23
+ let _ = shared_generics_aux:: generic_fn ( 0u16 , 1u16 ) ;
24
+
25
+ // This should not generate a monomorphization because it's already
26
+ // available in `shared_generics_aux`.
27
+ let _ = shared_generics_aux:: generic_fn ( 0.0f32 , 3.0f32 ) ;
28
+ }
29
+
30
+ // TRANS_ITEM drop-glue i8
You can’t perform that action at this time.
0 commit comments