]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/closure-calling-parent-fn.rs
Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obk
[rust.git] / src / test / ui / impl-trait / closure-calling-parent-fn.rs
1 // Regression test for #54593: the MIR type checker was going wrong
2 // when a closure returns the `impl Copy` from its parent fn. It was
3 // (incorrectly) replacing the `impl Copy` in its return type with the
4 // hidden type (`()`) but that type resulted from a recursive call to
5 // `foo` and hence is treated opaquely within the closure body.  This
6 // resulted in a failed subtype relationship.
7 //
8 // check-pass
9
10 fn foo() -> impl Copy { || foo(); }
11 fn bar() -> impl Copy { || bar(); }
12 fn main() { }