about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2018-11-03 02:03:04 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2018-11-03 02:03:04 +0100
commit1bbaa553416b67fd2de472829f465ca0b24186a2 (patch)
tree8d1383f4cb9ce002972474ef027bff67d93e4386
parent09edfb885cd0288edadb6493e8ee933f912a55c6 (diff)
downloadrust-1bbaa553416b67fd2de472829f465ca0b24186a2.tar.gz
rust-1bbaa553416b67fd2de472829f465ca0b24186a2.zip
Regression test for issue 55552.
-rw-r--r--src/test/ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs b/src/test/ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs
new file mode 100644
index 00000000000..6d91fd3508a
--- /dev/null
+++ b/src/test/ui/borrowck/issue-55552-ascribe-wildcard-to-structured-pattern.rs
@@ -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);
+}