about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-09-05 16:28:16 +0200
committerGitHub <noreply@github.com>2020-09-05 16:28:16 +0200
commitcb33a15c3ef2567168cbe33232fd3702d3705e21 (patch)
treebc1659e32759b3aae89806ad256b381bec39c894
parent81a769f261047afd8e31cc488b173b0ab5ac4205 (diff)
parent18ad5a594ec4ee039897eb03d90dfeb117b4c6d6 (diff)
downloadrust-cb33a15c3ef2567168cbe33232fd3702d3705e21.tar.gz
rust-cb33a15c3ef2567168cbe33232fd3702d3705e21.zip
Rollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPC
Add a regression test for issue-72793

Adds a regression test for #72793, which is fixed by #75443. Note that this won't close the issue as the snippet still shows ICE with `-Zmir-opt-level=2`. But it makes sense to add a test anyway.
-rw-r--r--src/test/ui/type-alias-impl-trait/issue-72793.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/issue-72793.rs b/src/test/ui/type-alias-impl-trait/issue-72793.rs
new file mode 100644
index 00000000000..e643a8cab5b
--- /dev/null
+++ b/src/test/ui/type-alias-impl-trait/issue-72793.rs
@@ -0,0 +1,27 @@
+// build-pass
+
+// Regression test for #72793.
+// FIXME: This still shows ICE with `-Zmir-opt-level=2`.
+
+#![feature(type_alias_impl_trait)]
+
+trait T { type Item; }
+
+type Alias<'a> = impl T<Item = &'a ()>;
+
+struct S;
+impl<'a> T for &'a S {
+    type Item = &'a ();
+}
+
+fn filter_positive<'a>() -> Alias<'a> {
+    &S
+}
+
+fn with_positive(fun: impl Fn(Alias<'_>)) {
+    fun(filter_positive());
+}
+
+fn main() {
+    with_positive(|_| ());
+}