-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit some tests for the new solver + lazy norm
- Loading branch information
1 parent
8a73f50
commit 1c4603e
Showing
9 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 94358 | ||
|
||
fn foo<C>(_: C) | ||
where | ||
for <'a> &'a C: IntoIterator, | ||
for <'a> <&'a C as IntoIterator>::IntoIter: ExactSizeIterator, | ||
{} | ||
|
||
fn main() { | ||
foo::<_>(vec![true, false]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 95863 | ||
|
||
pub trait With { | ||
type F; | ||
} | ||
|
||
impl With for i32 { | ||
type F = fn(&str); | ||
} | ||
|
||
fn f(_: &str) {} | ||
|
||
fn main() { | ||
let _: V<i32> = V(f); | ||
pub struct V<T: With>(<T as With>::F); | ||
|
||
pub enum E3<T: With> { | ||
Var(<T as With>::F), | ||
} | ||
let _: E3<i32> = E3::Var(f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 96750 | ||
|
||
use std::marker::PhantomData; | ||
|
||
trait AsyncFn<Arg> { | ||
type Output; | ||
} | ||
trait RequestFamily { | ||
type Type<'a>; | ||
} | ||
trait Service {} | ||
|
||
struct MyFn; | ||
impl AsyncFn<String> for MyFn { | ||
type Output = (); | ||
} | ||
|
||
impl RequestFamily for String { | ||
type Type<'a> = String; | ||
} | ||
|
||
struct ServiceFromAsyncFn<F, Req>(F, PhantomData<Req>); | ||
|
||
impl<F, Req, O> Service for ServiceFromAsyncFn<F, Req> | ||
where | ||
Req: RequestFamily, | ||
F: AsyncFn<Req>, | ||
F: for<'a> AsyncFn<Req::Type<'a>, Output = O>, | ||
{ | ||
} | ||
|
||
fn assert_service() -> impl Service { | ||
ServiceFromAsyncFn(MyFn, PhantomData) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 108933 | ||
|
||
trait Add<Rhs> { | ||
type Sum; | ||
} | ||
|
||
impl Add<()> for () { | ||
type Sum = (); | ||
} | ||
|
||
type Unit = <() as Add<()>>::Sum; | ||
|
||
trait Trait<C> { | ||
type Output; | ||
} | ||
|
||
fn f<T>() | ||
where | ||
T: Trait<()>, | ||
<T as Trait<()>>::Output: Sized, | ||
{ | ||
} | ||
|
||
fn g<T>() | ||
where | ||
T: Trait<Unit>, | ||
<T as Trait<()>>::Output: Sized, | ||
{ | ||
} | ||
|
||
fn h<T>() | ||
where | ||
T: Trait<()>, | ||
<T as Trait<Unit>>::Output: Sized, | ||
{ | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 92505 | ||
|
||
trait A<T> { | ||
type I; | ||
|
||
fn f() | ||
where | ||
Self::I: A<T>, | ||
{ | ||
} | ||
} | ||
|
||
impl<T> A<T> for () { | ||
type I = (); | ||
|
||
fn f() | ||
where | ||
Self::I: A<T>, | ||
{ | ||
<() as A<T>>::f(); | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// check-pass | ||
// compile-flags: -Ztrait-solver=next | ||
// Issue 100177 | ||
|
||
trait GenericTrait<T> {} | ||
|
||
trait Channel<I>: GenericTrait<Self::T> { | ||
type T; | ||
} | ||
|
||
trait Sender { | ||
type Msg; | ||
|
||
fn send<C>() | ||
where | ||
C: Channel<Self::Msg>; | ||
} | ||
|
||
impl<T> Sender for T { | ||
type Msg = (); | ||
|
||
fn send<C>() | ||
where | ||
C: Channel<Self::Msg>, | ||
{ | ||
} | ||
} | ||
|
||
// This works | ||
fn foo<I, C>(ch: C) where C: Channel<I> {} | ||
|
||
fn main() {} |