-
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.
Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_i…
…mpl, 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`
- Loading branch information
Showing
10 changed files
with
59 additions
and
13 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
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
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
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
15 changes: 15 additions & 0 deletions
15
tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs
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,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 | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.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[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`. |