add regression tests

This commit is contained in:
lcnr 2023-12-08 01:34:40 +01:00
parent ffb4c08a81
commit 1490c58076
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,14 @@
// check-pass
// compile-flags: -Ztrait-solver=next
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1
// a minimization of a pattern in core.
fn next<T: Iterator<Item = U>, U>(t: &mut T) -> Option<U> {
t.next()
}
fn foo<T: Iterator>(t: &mut T) {
let _: Option<T::Item> = next(t);
}
fn main() {}

View file

@ -0,0 +1,29 @@
// check-pass
// compile-flags: -Ztrait-solver=next
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/1,
// a minimization of a pattern in core.
trait Iterator {
type Item;
}
struct Flatten<I>(I);
impl<I, U> Iterator for Flatten<I>
where
I: Iterator<Item = U>,
{
type Item = U;
}
fn needs_iterator<I: Iterator>() {}
fn environment<J>()
where
J: Iterator,
{
needs_iterator::<Flatten<J>>();
}
fn main() {}