mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00

Previously `-Zprint-mono-items` would override the mono item collection strategy. When debugging one doesn't want to change the behaviour, so this was counter productive. Additionally, the produced behaviour was artificial and might never arise without using the option in the first place (`-Zprint-mono-items=eager` without `-Clink-dead-code`). Finally, the option was incorrectly marked as `UNTRACKED`. Resolve those issues, by turning `-Zprint-mono-items` into a boolean flag that prints results of mono item collection without changing the behaviour of mono item collection. For codegen-units test incorporate `-Zprint-mono-items` flag directly into compiletest tool. Test changes are mechanical. `-Zprint-mono-items=lazy` was removed without additional changes, and `-Zprint-mono-items=eager` was turned into `-Clink-dead-code`. Linking dead code disables internalization, so tests have been updated accordingly.
40 lines
1.0 KiB
Rust
40 lines
1.0 KiB
Rust
//@ incremental
|
|
//@ compile-flags: -Copt-level=0
|
|
|
|
#![crate_type = "rlib"]
|
|
|
|
// This test ensures that statics are assigned to the correct module when they are defined inside
|
|
// of a function.
|
|
|
|
//~ MONO_ITEM static FOO @@ statics[Internal]
|
|
static FOO: u32 = 0;
|
|
|
|
//~ MONO_ITEM static BAR @@ statics[Internal]
|
|
static BAR: u32 = 0;
|
|
|
|
//~ MONO_ITEM fn function @@ statics[External]
|
|
pub fn function() {
|
|
//~ MONO_ITEM static function::FOO @@ statics[Internal]
|
|
static FOO: u32 = 0;
|
|
|
|
//~ MONO_ITEM static function::BAR @@ statics[Internal]
|
|
static BAR: u32 = 0;
|
|
}
|
|
|
|
pub mod mod1 {
|
|
//~ MONO_ITEM static mod1::FOO @@ statics-mod1[Internal]
|
|
static FOO: u32 = 0;
|
|
|
|
//~ MONO_ITEM static mod1::BAR @@ statics-mod1[Internal]
|
|
static BAR: u32 = 0;
|
|
|
|
//~ MONO_ITEM fn mod1::function @@ statics-mod1[External]
|
|
pub fn function() {
|
|
//~ MONO_ITEM static mod1::function::FOO @@ statics-mod1[Internal]
|
|
static FOO: u32 = 0;
|
|
|
|
//~ MONO_ITEM static mod1::function::BAR @@ statics-mod1[Internal]
|
|
static BAR: u32 = 0;
|
|
}
|
|
}
|