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.
This commit is contained in:
Dylan DPC 2020-09-05 16:28:16 +02:00 committed by GitHub
commit cb33a15c3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(|_| ());
}