-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge impl_wf_inference into coherence checking
- Loading branch information
1 parent
cee6db1
commit a947654
Showing
5 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
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
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 @@ | ||
// edition: 2021 | ||
|
||
trait Foo { | ||
type T; | ||
|
||
async fn foo(&self) -> Self::T; | ||
} | ||
|
||
struct Bar; | ||
|
||
impl Foo for Bar { | ||
type T = (); | ||
|
||
async fn foo(&self) {} | ||
//~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` | ||
} | ||
|
||
impl Foo for Bar { | ||
//~^ ERROR conflicting implementations of trait `Foo` for type `Bar` | ||
type T = (); | ||
|
||
async fn foo(&self) {} | ||
//~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` | ||
} | ||
|
||
fn main() {} |
25 changes: 25 additions & 0 deletions
25
tests/ui/async-await/in-trait/coherence-constrained.stderr
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,25 @@ | ||
error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` | ||
--> $DIR/coherence-constrained.rs:14:5 | ||
| | ||
LL | async fn foo(&self) {} | ||
| ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()` | ||
|
||
error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()` | ||
--> $DIR/coherence-constrained.rs:22:5 | ||
| | ||
LL | async fn foo(&self) {} | ||
| ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()` | ||
|
||
error[E0119]: conflicting implementations of trait `Foo` for type `Bar` | ||
--> $DIR/coherence-constrained.rs:18:1 | ||
| | ||
LL | impl Foo for Bar { | ||
| ---------------- first implementation here | ||
... | ||
LL | impl Foo for Bar { | ||
| ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0119, E0284. | ||
For more information about an error, try `rustc --explain E0119`. |
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
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 |
---|---|---|
@@ -1,33 +1,56 @@ | ||
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/impl-unused-tps.rs:13:8 | ||
--> $DIR/impl-unused-tps.rs:15:8 | ||
| | ||
LL | impl<T,U> Foo<T> for [isize;1] { | ||
| ^ unconstrained type parameter | ||
|
||
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/impl-unused-tps.rs:30:8 | ||
--> $DIR/impl-unused-tps.rs:31:8 | ||
| | ||
LL | impl<T,U> Bar for T { | ||
| ^ unconstrained type parameter | ||
|
||
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/impl-unused-tps.rs:38:8 | ||
--> $DIR/impl-unused-tps.rs:39:8 | ||
| | ||
LL | impl<T,U> Bar for T | ||
| ^ unconstrained type parameter | ||
|
||
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/impl-unused-tps.rs:46:8 | ||
--> $DIR/impl-unused-tps.rs:47:8 | ||
| | ||
LL | impl<T,U,V> Foo<T> for T | ||
| ^ unconstrained type parameter | ||
|
||
error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/impl-unused-tps.rs:46:10 | ||
--> $DIR/impl-unused-tps.rs:47:10 | ||
| | ||
LL | impl<T,U,V> Foo<T> for T | ||
| ^ unconstrained type parameter | ||
|
||
error: aborting due to 5 previous errors | ||
error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` | ||
--> $DIR/impl-unused-tps.rs:27:1 | ||
| | ||
LL | impl<T> Foo<T> for [isize;0] { | ||
| ---------------------------- first implementation here | ||
... | ||
LL | impl<T,U> Foo<T> for U { | ||
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` | ||
|
||
error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` | ||
| | ||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) | ||
note: required for `([isize; 0], _)` to implement `Bar` | ||
--> $DIR/impl-unused-tps.rs:31:11 | ||
| | ||
LL | impl<T,U> Bar for T { | ||
| - ^^^ ^ | ||
| | | ||
| unsatisfied trait bound introduced here | ||
= note: 126 redundant requirements hidden | ||
= note: required for `([isize; 0], _)` to implement `Bar` | ||
|
||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0207`. | ||
Some errors have detailed explanations: E0119, E0207, E0275. | ||
For more information about an error, try `rustc --explain E0119`. |