Add regression test for issue-59311

This commit is contained in:
Yuki Okushi 2020-07-29 05:32:28 +09:00
parent 98efae8760
commit 788261d2d3
No known key found for this signature in database
GPG key ID: B0986C85C0E2DAA1
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,16 @@
// Regression test for #59311. The test is taken from
// rust-lang/rust/issues/71546#issuecomment-620638437
// as they seem to have the same cause.
pub trait T {
fn t<F: Fn()>(&self, _: F) {}
}
pub fn crash<V>(v: &V)
where
for<'a> &'a V: T + 'static,
{
v.t(|| {}); //~ ERROR: higher-ranked subtype error
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: higher-ranked subtype error
--> $DIR/issue-59311.rs:13:9
|
LL | v.t(|| {});
| ^^^^^
error: aborting due to previous error