Skip to content

Commit eae42fd

Browse files
committed
Add regresstion test for rust-lang#90024.
Uses 2 MCVEs from the issue tracker that test opposite sides of the problem.
1 parent 9158fc2 commit eae42fd

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Test that rustc doesn't ICE as in #90024.
2+
// check-pass
3+
// edition=2018
4+
5+
#![warn(rust_2021_incompatible_closure_captures)]
6+
7+
// Checks there's no double-subst into the generic args, otherwise we get OOB
8+
// MCVE by @lqd
9+
pub struct Graph<N, E, Ix> {
10+
_edges: E,
11+
_nodes: N,
12+
_ix: Vec<Ix>,
13+
}
14+
fn graph<N, E>() -> Graph<N, E, i32> {
15+
todo!()
16+
}
17+
fn first_ice() {
18+
let g = graph::<i32, i32>();
19+
let _ = || g;
20+
}
21+
22+
// Checks that there is a subst into the fields, otherwise we get normalization error
23+
// MCVE by @cuviper
24+
use std::iter::Empty;
25+
struct Foo<I: Iterator> {
26+
data: Vec<I::Item>,
27+
}
28+
pub fn second_ice() {
29+
let v = Foo::<Empty<()>> { data: vec![] };
30+
31+
(|| v.data[0])();
32+
}
33+
34+
pub fn main() {
35+
first_ice();
36+
second_ice();
37+
}

0 commit comments

Comments
 (0)