Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_impl, r=compiler-errors
Do not ICE on unmet trait alias impl bounds Fixes #108132 I've also added some documentation to the `impl_def_id` field of `DerivedObligationCause` to try and minimise the risk of such errors in future. r? `@compiler-errors`
This commit is contained in:
commit
ecdb7bcee8
10 changed files with 59 additions and 13 deletions
|
|
@ -0,0 +1,15 @@
|
|||
// Regression test for #108132: do not ICE upon unmet trait alias constraint in generic impl
|
||||
|
||||
#![feature(trait_alias)]
|
||||
|
||||
trait IteratorAlias = Iterator;
|
||||
|
||||
struct Foo<I>(I);
|
||||
|
||||
impl<I: IteratorAlias> Foo<I> {
|
||||
fn f() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Foo::<()>::f() //~ trait bounds were not satisfied
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
error[E0599]: the function or associated item `f` exists for struct `Foo<()>`, but its trait bounds were not satisfied
|
||||
--> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:14:16
|
||||
|
|
||||
LL | struct Foo<I>(I);
|
||||
| ------------- function or associated item `f` not found for this struct
|
||||
...
|
||||
LL | Foo::<()>::f()
|
||||
| ^ function or associated item cannot be called on `Foo<()>` due to unsatisfied trait bounds
|
||||
|
|
||||
note: trait bound `(): Iterator` was not satisfied
|
||||
--> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:5:23
|
||||
|
|
||||
LL | trait IteratorAlias = Iterator;
|
||||
| ------------- ^^^^^^^^ unsatisfied trait bound introduced here
|
||||
note: trait bound `(): IteratorAlias` was not satisfied
|
||||
--> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:9:9
|
||||
|
|
||||
LL | impl<I: IteratorAlias> Foo<I> {
|
||||
| ^^^^^^^^^^^^^ ------
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue