]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/partitioning/extern-generic.rs
Rollup merge of #105064 - notriddle:notriddle/main-min-width, r=GuillaumeGomez
[rust.git] / src / test / codegen-units / partitioning / extern-generic.rs
1 //
2 // We specify incremental here because we want to test the partitioning for
3 // incremental compilation
4 // incremental
5 // compile-flags:-Zprint-mono-items=eager -Zshare-generics=y
6
7 #![allow(dead_code)]
8 #![crate_type="lib"]
9
10 // aux-build:cgu_generic_function.rs
11 extern crate cgu_generic_function;
12
13 //~ MONO_ITEM fn user @@ extern_generic[Internal]
14 fn user() {
15     let _ = cgu_generic_function::foo("abc");
16 }
17
18 mod mod1 {
19     use cgu_generic_function;
20
21     //~ MONO_ITEM fn mod1::user @@ extern_generic-mod1[Internal]
22     fn user() {
23         let _ = cgu_generic_function::foo("abc");
24     }
25
26     mod mod1 {
27         use cgu_generic_function;
28
29         //~ MONO_ITEM fn mod1::mod1::user @@ extern_generic-mod1-mod1[Internal]
30         fn user() {
31             let _ = cgu_generic_function::foo("abc");
32         }
33     }
34 }
35
36 mod mod2 {
37     use cgu_generic_function;
38
39     //~ MONO_ITEM fn mod2::user @@ extern_generic-mod2[Internal]
40     fn user() {
41         let _ = cgu_generic_function::foo("abc");
42     }
43 }
44
45 mod mod3 {
46     //~ MONO_ITEM fn mod3::non_user @@ extern_generic-mod3[Internal]
47     fn non_user() {}
48 }
49
50 // Make sure the two generic functions from the extern crate get instantiated
51 // once for the current crate
52 //~ MONO_ITEM fn cgu_generic_function::foo::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
53 //~ MONO_ITEM fn cgu_generic_function::bar::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]