2024-08-10 11:19:38 -05:00
|
|
|
//@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no
|
2015-11-02 07:46:39 -06:00
|
|
|
|
|
|
|
#![deny(dead_code)]
|
2017-12-22 08:31:51 -06:00
|
|
|
#![feature(start)]
|
2015-11-02 07:46:39 -06:00
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn temporary @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
fn temporary() {
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn temporary::{closure#0} @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
(|a: u32| {
|
|
|
|
let _ = a;
|
|
|
|
})(4);
|
|
|
|
}
|
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn assigned_to_variable_but_not_executed @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
fn assigned_to_variable_but_not_executed() {
|
|
|
|
let _x = |a: i16| {
|
|
|
|
let _ = a + 1;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn assigned_to_variable_executed_indirectly @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
fn assigned_to_variable_executed_indirectly() {
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn assigned_to_variable_executed_indirectly::{closure#0} @@ non_generic_closures-cgu.0[Internal]
|
|
|
|
//~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim @@ non_generic_closures-cgu.0[Internal]
|
|
|
|
//~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim(vtable) @@ non_generic_closures-cgu.0[Internal]
|
|
|
|
//~ MONO_ITEM fn std::ptr::drop_in_place::<{closure@TEST_PATH:27:13: 27:21}> - shim(None) @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
let f = |a: i32| {
|
|
|
|
let _ = a + 2;
|
|
|
|
};
|
|
|
|
run_closure(&f);
|
|
|
|
}
|
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn assigned_to_variable_executed_directly @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
fn assigned_to_variable_executed_directly() {
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn assigned_to_variable_executed_directly::{closure#0} @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
let f = |a: i64| {
|
|
|
|
let _ = a + 3;
|
|
|
|
};
|
|
|
|
f(4);
|
|
|
|
}
|
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn start @@ non_generic_closures-cgu.0[Internal]
|
2017-12-22 08:31:51 -06:00
|
|
|
#[start]
|
|
|
|
fn start(_: isize, _: *const *const u8) -> isize {
|
2015-11-02 07:46:39 -06:00
|
|
|
temporary();
|
|
|
|
assigned_to_variable_but_not_executed();
|
|
|
|
assigned_to_variable_executed_directly();
|
|
|
|
assigned_to_variable_executed_indirectly();
|
2017-12-22 08:31:51 -06:00
|
|
|
|
|
|
|
0
|
2015-11-02 07:46:39 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 11:19:38 -05:00
|
|
|
//~ MONO_ITEM fn run_closure @@ non_generic_closures-cgu.0[Internal]
|
2015-11-02 07:46:39 -06:00
|
|
|
fn run_closure(f: &Fn(i32)) {
|
|
|
|
f(3);
|
|
|
|
}
|