Check for overflow in assemble_candidates_after_normalizing_self_ty
This commit is contained in:
parent
bf57e8ada6
commit
ef5f773bff
6 changed files with 105 additions and 18 deletions
19
tests/ui/traits/new-solver/recursive-self-normalization-2.rs
Normal file
19
tests/ui/traits/new-solver/recursive-self-normalization-2.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// compile-flags: -Ztrait-solver=next
|
||||
|
||||
trait Foo1 {
|
||||
type Assoc1;
|
||||
}
|
||||
|
||||
trait Foo2 {
|
||||
type Assoc2;
|
||||
}
|
||||
|
||||
trait Bar {}
|
||||
fn needs_bar<S: Bar>() {}
|
||||
|
||||
fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() {
|
||||
needs_bar::<T::Assoc1>();
|
||||
//~^ ERROR type annotations needed
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0282]: type annotations needed
|
||||
--> $DIR/recursive-self-normalization-2.rs:15:5
|
||||
|
|
||||
LL | needs_bar::<T::Assoc1>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `S` declared on the function `needs_bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
15
tests/ui/traits/new-solver/recursive-self-normalization.rs
Normal file
15
tests/ui/traits/new-solver/recursive-self-normalization.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// compile-flags: -Ztrait-solver=next
|
||||
|
||||
trait Foo {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
trait Bar {}
|
||||
fn needs_bar<S: Bar>() {}
|
||||
|
||||
fn test<T: Foo<Assoc = <T as Foo>::Assoc>>() {
|
||||
needs_bar::<T::Assoc>();
|
||||
//~^ ERROR type annotations needed
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0282]: type annotations needed
|
||||
--> $DIR/recursive-self-normalization.rs:11:5
|
||||
|
|
||||
LL | needs_bar::<T::Assoc>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `S` declared on the function `needs_bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue