Skip to content

Commit 4b0882c

Browse files
committed
Auto merge of rust-lang#74889 - JohnTitor:hrtb-tests, r=nikomatsakis
Add HRTB-related regression test Closes rust-lang#59311 and cc rust-lang#71546 This closes the former but the test is taken from rust-lang#71546 (comment) since it seems they have the same cause and it's simplified.
2 parents 3cfc7fe + cc36c3d commit 4b0882c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Regression test for #59311. The test is taken from
2+
// rust-lang/rust/issues/71546#issuecomment-620638437
3+
// as they seem to have the same cause.
4+
5+
// FIXME: It's not clear that this code ought to report
6+
// an error, but the regression test is here to ensure
7+
// that it does not ICE. See discussion on #74889 for details.
8+
9+
pub trait T {
10+
fn t<F: Fn()>(&self, _: F) {}
11+
}
12+
13+
pub fn crash<V>(v: &V)
14+
where
15+
for<'a> &'a V: T + 'static,
16+
{
17+
v.t(|| {}); //~ ERROR: higher-ranked subtype error
18+
}
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: higher-ranked subtype error
2+
--> $DIR/issue-59311.rs:17:9
3+
|
4+
LL | v.t(|| {});
5+
| ^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)