]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/partitioning/extern-generic.rs
58f904f48a17dad25d5d4625182610bec2fbffce
[rust.git] / src / test / codegen-units / partitioning / extern-generic.rs
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.
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 // We specify -Z incremental here because we want to test the partitioning for
13 // incremental compilation
14 // compile-flags:-Zprint-trans-items=eager -Zincremental=tmp/partitioning-tests/extern-generic
15
16 #![allow(dead_code)]
17 #![crate_type="lib"]
18
19 // aux-build:cgu_generic_function.rs
20 extern crate cgu_generic_function;
21
22 //~ TRANS_ITEM fn extern_generic::user[0] @@ extern_generic[External]
23 fn user() {
24     let _ = cgu_generic_function::foo("abc");
25 }
26
27 mod mod1 {
28     use cgu_generic_function;
29
30     //~ TRANS_ITEM fn extern_generic::mod1[0]::user[0] @@ extern_generic-mod1[External]
31     fn user() {
32         let _ = cgu_generic_function::foo("abc");
33     }
34
35     mod mod1 {
36         use cgu_generic_function;
37
38         //~ TRANS_ITEM fn extern_generic::mod1[0]::mod1[0]::user[0] @@ extern_generic-mod1-mod1[External]
39         fn user() {
40             let _ = cgu_generic_function::foo("abc");
41         }
42     }
43 }
44
45 mod mod2 {
46     use cgu_generic_function;
47
48     //~ TRANS_ITEM fn extern_generic::mod2[0]::user[0] @@ extern_generic-mod2[External]
49     fn user() {
50         let _ = cgu_generic_function::foo("abc");
51     }
52 }
53
54 mod mod3 {
55     //~ TRANS_ITEM fn extern_generic::mod3[0]::non_user[0] @@ extern_generic-mod3[External]
56     fn non_user() {}
57 }
58
59 // Make sure the two generic functions from the extern crate get instantiated
60 // privately in every module they are use in.
61 //~ TRANS_ITEM fn cgu_generic_function::foo[0]<&str> @@ extern_generic[Internal] extern_generic-mod1[Internal] extern_generic-mod2[Internal] extern_generic-mod1-mod1[Internal]
62 //~ TRANS_ITEM fn cgu_generic_function::bar[0]<&str> @@ extern_generic[Internal] extern_generic-mod1[Internal] extern_generic-mod2[Internal] extern_generic-mod1-mod1[Internal]
63
64 //~ TRANS_ITEM drop-glue i8