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 = "rlib"]
|
2016-03-24 11:40:49 -04:00
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
// This test checks that a monomorphic inline(always) function is instantiated in every CGU that
|
|
|
|
// references it, even if it is only referenced via another module.
|
|
|
|
// The modules `inline` and `direct_user` do not get CGUs because they only define inline(always)
|
|
|
|
// functions, which always get lazy codegen.
|
|
|
|
|
2016-03-24 11:40:49 -04:00
|
|
|
mod inline {
|
|
|
|
|
2020-08-28 14:31:03 +01:00
|
|
|
//~ MONO_ITEM fn inline::inlined_function @@ local_transitive_inlining-indirect_user[Internal]
|
2016-03-24 11:40:49 -04:00
|
|
|
#[inline(always)]
|
2024-05-29 14:25:55 +10:00
|
|
|
pub fn inlined_function() {}
|
2016-03-24 11:40:49 -04:00
|
|
|
}
|
|
|
|
|
2024-12-05 12:51:19 -05:00
|
|
|
pub mod direct_user {
|
2016-03-24 11:40:49 -04:00
|
|
|
use super::inline;
|
|
|
|
|
2020-08-28 14:31:03 +01:00
|
|
|
//~ MONO_ITEM fn direct_user::foo @@ local_transitive_inlining-indirect_user[Internal]
|
2016-03-24 11:40:49 -04:00
|
|
|
#[inline(always)]
|
|
|
|
pub fn foo() {
|
|
|
|
inline::inlined_function();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-27 14:31:18 +02:00
|
|
|
pub mod indirect_user {
|
2016-03-24 11:40:49 -04:00
|
|
|
use super::direct_user;
|
|
|
|
|
2020-08-28 14:31:03 +01:00
|
|
|
//~ MONO_ITEM fn indirect_user::bar @@ local_transitive_inlining-indirect_user[External]
|
2017-10-27 14:31:18 +02:00
|
|
|
pub fn bar() {
|
2016-03-24 11:40:49 -04:00
|
|
|
direct_user::foo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-27 14:31:18 +02:00
|
|
|
pub mod non_user {
|
2016-03-24 11:40:49 -04:00
|
|
|
|
2020-08-28 14:31:03 +01:00
|
|
|
//~ MONO_ITEM fn non_user::baz @@ local_transitive_inlining-non_user[External]
|
2024-05-29 14:25:55 +10:00
|
|
|
pub fn baz() {}
|
2016-03-24 11:40:49 -04:00
|
|
|
}
|