2021-09-19 09:57:19 -07:00
|
|
|
//@ incremental
|
2024-12-05 12:51:19 -05:00
|
|
|
//@ compile-flags: -Zprint-mono-items=lazy -Copt-level=0
|
2016-03-24 11:40:49 -04:00
|
|
|
|
2024-05-29 14:25:55 +10:00
|
|
|
#![crate_type = "lib"]
|
2016-03-24 11:40:49 -04:00
|
|
|
|
|
|
|
//@ aux-build:cgu_generic_function.rs
|
|
|
|
extern crate cgu_generic_function;
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
// This test checks that, in an unoptimized build, a generic function and its callees are only
|
|
|
|
// instantiated once in this crate.
|
|
|
|
|
|
|
|
//~ MONO_ITEM fn user @@ extern_generic[External]
|
|
|
|
pub fn user() {
|
2016-03-24 11:40:49 -04:00
|
|
|
let _ = cgu_generic_function::foo("abc");
|
|
|
|
}
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
pub mod mod1 {
|
2016-03-24 11:40:49 -04:00
|
|
|
use cgu_generic_function;
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
//~ MONO_ITEM fn mod1::user @@ extern_generic-mod1[External]
|
|
|
|
pub fn user() {
|
2016-03-24 11:40:49 -04:00
|
|
|
let _ = cgu_generic_function::foo("abc");
|
|
|
|
}
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
pub mod mod1 {
|
2016-03-24 11:40:49 -04:00
|
|
|
use cgu_generic_function;
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
//~ MONO_ITEM fn mod1::mod1::user @@ extern_generic-mod1-mod1[External]
|
|
|
|
pub fn user() {
|
2016-03-24 11:40:49 -04:00
|
|
|
let _ = cgu_generic_function::foo("abc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-28 14:31:03 +01:00
|
|
|
//~ MONO_ITEM fn cgu_generic_function::foo::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
|
|
|
|
//~ MONO_ITEM fn cgu_generic_function::bar::<&str> @@ cgu_generic_function-in-extern_generic.volatile[External]
|