]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / issue-55552-ascribe-wildcard-to-structured-pattern.rs
1 // check-pass
2
3 // rust-lang/rust#55552: The strategy pnkfelix landed in PR #55274
4 // (for ensuring that NLL respects user-provided lifetime annotations)
5 // did not handle the case where the ascribed type has some expliit
6 // wildcards (`_`) mixed in, and it caused an internal compiler error
7 // (ICE).
8 //
9 // This test is just checking that we do not ICE when such things
10 // occur.
11
12 struct X;
13 struct Y;
14 struct Z;
15
16 struct Pair { x: X, y: Y }
17
18 pub fn join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
19 where A: FnOnce() -> RA + Send,
20       B: FnOnce() -> RB + Send,
21       RA: Send,
22       RB: Send
23 {
24     (oper_a(), oper_b())
25 }
26
27 fn main() {
28     let ((_x, _y), _z): (_, Z) = join(|| (X, Y), || Z);
29
30     let (Pair { x: _x, y: _y }, Z): (_, Z) = join(|| Pair { x: X, y: Y }, || Z);
31 }