mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +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.
56 lines
1.3 KiB
Rust
56 lines
1.3 KiB
Rust
//@ compile-flags:-Clink-dead-code -Zinline-mir=no
|
|
|
|
#![deny(dead_code)]
|
|
#![crate_type = "lib"]
|
|
|
|
fn foo1<T1>(a: T1) -> (T1, u32) {
|
|
(a, 1)
|
|
}
|
|
|
|
fn foo2<T1, T2>(a: T1, b: T2) -> (T1, T2) {
|
|
(a, b)
|
|
}
|
|
|
|
fn foo3<T1, T2, T3>(a: T1, b: T2, c: T3) -> (T1, T2, T3) {
|
|
(a, b, c)
|
|
}
|
|
|
|
// This function should be instantiated even if no used
|
|
//~ MONO_ITEM fn lifetime_only
|
|
pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 {
|
|
a
|
|
}
|
|
|
|
//~ MONO_ITEM fn start
|
|
#[no_mangle]
|
|
pub fn start(_: isize, _: *const *const u8) -> isize {
|
|
//~ MONO_ITEM fn foo1::<i32>
|
|
let _ = foo1(2i32);
|
|
//~ MONO_ITEM fn foo1::<i64>
|
|
let _ = foo1(2i64);
|
|
//~ MONO_ITEM fn foo1::<&str>
|
|
let _ = foo1("abc");
|
|
//~ MONO_ITEM fn foo1::<char>
|
|
let _ = foo1('v');
|
|
|
|
//~ MONO_ITEM fn foo2::<i32, i32>
|
|
let _ = foo2(2i32, 2i32);
|
|
//~ MONO_ITEM fn foo2::<i64, &str>
|
|
let _ = foo2(2i64, "abc");
|
|
//~ MONO_ITEM fn foo2::<&str, usize>
|
|
let _ = foo2("a", 2usize);
|
|
//~ MONO_ITEM fn foo2::<char, ()>
|
|
let _ = foo2('v', ());
|
|
|
|
//~ MONO_ITEM fn foo3::<i32, i32, i32>
|
|
let _ = foo3(2i32, 2i32, 2i32);
|
|
//~ MONO_ITEM fn foo3::<i64, &str, char>
|
|
let _ = foo3(2i64, "abc", 'c');
|
|
//~ MONO_ITEM fn foo3::<i16, &str, usize>
|
|
let _ = foo3(0i16, "a", 2usize);
|
|
//~ MONO_ITEM fn foo3::<char, (), ()>
|
|
let _ = foo3('v', (), ());
|
|
|
|
0
|
|
}
|