Skip to content

Commit

Permalink
Add regresstion test for rust-lang#90024.
Browse files Browse the repository at this point in the history
Uses 2 MCVEs from the issue tracker that test opposite sides of the problem.
  • Loading branch information
JakobDegen committed Oct 24, 2021
1 parent 9158fc2 commit eae42fd
Showing 1 changed file with 37 additions and 0 deletions.
@@ -0,0 +1,37 @@
// Test that rustc doesn't ICE as in #90024.
// check-pass
// edition=2018

#![warn(rust_2021_incompatible_closure_captures)]

// Checks there's no double-subst into the generic args, otherwise we get OOB
// MCVE by @lqd
pub struct Graph<N, E, Ix> {
_edges: E,
_nodes: N,
_ix: Vec<Ix>,
}
fn graph<N, E>() -> Graph<N, E, i32> {
todo!()
}
fn first_ice() {
let g = graph::<i32, i32>();
let _ = || g;
}

// Checks that there is a subst into the fields, otherwise we get normalization error
// MCVE by @cuviper
use std::iter::Empty;
struct Foo<I: Iterator> {
data: Vec<I::Item>,
}
pub fn second_ice() {
let v = Foo::<Empty<()>> { data: vec![] };

(|| v.data[0])();
}

pub fn main() {
first_ice();
second_ice();
}

0 comments on commit eae42fd

Please sign in to comment.