|
1 |
| -// We specify incremental here because we want to test the partitioning for incremental compilation |
2 | 1 | //@ incremental
|
3 |
| -//@ compile-flags:-Zprint-mono-items=eager -Zshare-generics=y |
| 2 | +//@ compile-flags: -Zprint-mono-items=lazy -Copt-level=0 |
4 | 3 |
|
5 |
| -#![allow(dead_code)] |
6 | 4 | #![crate_type = "lib"]
|
7 | 5 |
|
8 | 6 | //@ aux-build:cgu_generic_function.rs
|
9 | 7 | extern crate cgu_generic_function;
|
10 | 8 |
|
11 |
| -//~ MONO_ITEM fn user @@ extern_generic[Internal] |
12 |
| -fn user() { |
| 9 | +// This test checks that, in an unoptimized build, a generic function and its callees are only |
| 10 | +// instantiated once in this crate. |
| 11 | + |
| 12 | +//~ MONO_ITEM fn user @@ extern_generic[External] |
| 13 | +pub fn user() { |
13 | 14 | let _ = cgu_generic_function::foo("abc");
|
14 | 15 | }
|
15 | 16 |
|
16 |
| -mod mod1 { |
| 17 | +pub mod mod1 { |
17 | 18 | use cgu_generic_function;
|
18 | 19 |
|
19 |
| - //~ MONO_ITEM fn mod1::user @@ extern_generic-mod1[Internal] |
20 |
| - fn user() { |
| 20 | + //~ MONO_ITEM fn mod1::user @@ extern_generic-mod1[External] |
| 21 | + pub fn user() { |
21 | 22 | let _ = cgu_generic_function::foo("abc");
|
22 | 23 | }
|
23 | 24 |
|
24 |
| - mod mod1 { |
| 25 | + pub mod mod1 { |
25 | 26 | use cgu_generic_function;
|
26 | 27 |
|
27 |
| - //~ MONO_ITEM fn mod1::mod1::user @@ extern_generic-mod1-mod1[Internal] |
28 |
| - fn user() { |
| 28 | + //~ MONO_ITEM fn mod1::mod1::user @@ extern_generic-mod1-mod1[External] |
| 29 | + pub fn user() { |
29 | 30 | let _ = cgu_generic_function::foo("abc");
|
30 | 31 | }
|
31 | 32 | }
|
32 | 33 | }
|
33 | 34 |
|
34 |
| -mod mod2 { |
35 |
| - use cgu_generic_function; |
36 |
| - |
37 |
| - //~ MONO_ITEM fn mod2::user @@ extern_generic-mod2[Internal] |
38 |
| - fn user() { |
39 |
| - let _ = cgu_generic_function::foo("abc"); |
40 |
| - } |
41 |
| -} |
42 |
| - |
43 |
| -mod mod3 { |
44 |
| - //~ MONO_ITEM fn mod3::non_user @@ extern_generic-mod3[Internal] |
45 |
| - fn non_user() {} |
46 |
| -} |
47 |
| - |
48 |
| -// Make sure the two generic functions from the extern crate get instantiated |
49 |
| -// once for the current crate |
50 | 35 | //~ MONO_ITEM fn cgu_generic_function::foo::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
|
51 | 36 | //~ MONO_ITEM fn cgu_generic_function::bar::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
|
0 commit comments