Skip to content

Commit

Permalink
add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 8, 2023
1 parent ffb4c08 commit 1490c58
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit 1490c58

Please # to comment.