Skip to content

Commit

Permalink
Regression test for issue 55552.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix authored and pietroalbini committed Nov 10, 2018
1 parent bed6132 commit 755d030
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// compile-pass

// rust-lang/rust#55552: The strategy pnkfelix landed in PR #55274
// (for ensuring that NLL respects user-provided lifetime annotations)
// did not handle the case where the ascribed type has some expliit
// wildcards (`_`) mixed in, and it caused an internal compiler error
// (ICE).
//
// This test is just checking that we do not ICE when such things
// occur.

struct X;
struct Y;
struct Z;

struct Pair { x: X, y: Y }

pub fn join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
where A: FnOnce() -> RA + Send,
B: FnOnce() -> RB + Send,
RA: Send,
RB: Send
{
(oper_a(), oper_b())
}

fn main() {
let ((_x, _y), _z): (_, Z) = join(|| (X, Y), || Z);

let (Pair { x: _x, y: _y }, Z): (_, Z) = join(|| Pair { x: X, y: Y }, || Z);
}

0 comments on commit 755d030

Please sign in to comment.