2020-09-18 19:14:27 -05:00
|
|
|
// compile-flags: -Z span_free_formats -Zunsound-mir-opts
|
2017-11-18 17:02:41 -06:00
|
|
|
|
|
|
|
// Tests that MIR inliner can handle closure arguments,
|
|
|
|
// even when (#45894)
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{}", foo(0, &14));
|
|
|
|
}
|
|
|
|
|
2020-07-27 14:22:43 -05:00
|
|
|
// EMIT_MIR inline_closure_borrows_arg.foo.Inline.after.mir
|
2017-11-18 17:02:41 -06:00
|
|
|
fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
|
|
|
|
let x = |r: &i32, _s: &i32| {
|
|
|
|
let variable = &*r;
|
|
|
|
*variable
|
|
|
|
};
|
2023-10-20 13:28:38 -05:00
|
|
|
|
|
|
|
// CHECK-LABEL: fn foo(
|
|
|
|
// CHECK: (inlined foo::<T>::{closure#0})
|
2017-11-18 17:02:41 -06:00
|
|
|
x(q, q)
|
|
|
|
}
|