2021-05-13 05:04:41 -05:00
|
|
|
//@ compile-flags: -Z mir-opt-level=3 -Z inline-mir
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2021-05-13 05:04:41 -05:00
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// EMIT_MIR issue_78442.bar.RevealAll.diff
|
|
|
|
// EMIT_MIR issue_78442.bar.Inline.diff
|
|
|
|
pub fn bar<P>(
|
|
|
|
// Error won't happen if "bar" is not generic
|
|
|
|
_baz: P,
|
|
|
|
) {
|
2023-10-21 00:06:38 -05:00
|
|
|
// CHECK-LABEL: fn bar(
|
|
|
|
// CHECK: let mut {{.*}}: &fn() {foo};
|
|
|
|
// CHECK: let {{.*}}: fn() {foo};
|
|
|
|
// CHECK: (inlined hide_foo)
|
|
|
|
// CHECK-NOT: inlined
|
2021-05-13 05:04:41 -05:00
|
|
|
hide_foo()();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn hide_foo() -> impl Fn() {
|
|
|
|
// Error won't happen if "iterate" hasn't impl Trait or has generics
|
|
|
|
foo
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics
|
|
|
|
}
|