Rollup merge of #66388 - estebank:melt-ice, r=Centril
Do not ICE on recovery from unmet associated type bound obligation Fix #66353. r? @Centril
This commit is contained in:
commit
c8d8f52b76
3 changed files with 35 additions and 1 deletions
|
|
@ -3108,7 +3108,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
fallback_has_occurred: bool,
|
||||
mutate_fullfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
|
||||
) {
|
||||
if let Err(mut errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) {
|
||||
let result = self.fulfillment_cx.borrow_mut().select_where_possible(self);
|
||||
if let Err(mut errors) = result {
|
||||
mutate_fullfillment_errors(&mut errors);
|
||||
self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred);
|
||||
}
|
||||
|
|
|
|||
15
src/test/ui/issues/issue-66353.rs
Normal file
15
src/test/ui/issues/issue-66353.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// #66353: ICE when trying to recover from incorrect associated type
|
||||
|
||||
trait _Func<T> {
|
||||
fn func(_: Self);
|
||||
}
|
||||
|
||||
trait _A {
|
||||
type AssocT;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
_Func::< <() as _A>::AssocT >::func(());
|
||||
//~^ ERROR the trait bound `(): _A` is not satisfied
|
||||
//~| ERROR the trait bound `(): _Func<_>` is not satisfied
|
||||
}
|
||||
18
src/test/ui/issues/issue-66353.stderr
Normal file
18
src/test/ui/issues/issue-66353.stderr
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
error[E0277]: the trait bound `(): _A` is not satisfied
|
||||
--> $DIR/issue-66353.rs:12:14
|
||||
|
|
||||
LL | _Func::< <() as _A>::AssocT >::func(());
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
|
||||
|
||||
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
|
||||
--> $DIR/issue-66353.rs:12:41
|
||||
|
|
||||
LL | fn func(_: Self);
|
||||
| ----------------- required by `_Func::func`
|
||||
...
|
||||
LL | _Func::< <() as _A>::AssocT >::func(());
|
||||
| ^^ the trait `_Func<_>` is not implemented for `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue