Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 27, 2022
1 parent 9f59ab5 commit fa2f31b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/closures/supertrait-hint-cycle-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// check-pass

trait Foo<'a> {
type Input;
}

impl<F: Fn(u32)> Foo<'_> for F {
type Input = u32;
}

trait SuperFn: for<'a> Foo<'a> + for<'a> Fn(<Self as Foo<'a>>::Input) {}
impl<T> SuperFn for T where T: for<'a> Fn(<Self as Foo<'a>>::Input) + for<'a> Foo<'a> {}

fn needs_super(_: impl SuperFn) {}

fn main() {
needs_super(|_: u32| {});
}
16 changes: 16 additions & 0 deletions src/test/ui/closures/supertrait-hint-cycle-3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// check-pass


trait Foo<'a> {
type Input;
}

impl<F: Fn(u32)> Foo<'_> for F {
type Input = u32;
}

fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}

fn main() {
needs_super(|_: u32| {});
}

0 comments on commit fa2f31b

Please sign in to comment.