-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Fix ICE in transmutability error reporting when type aliases are normalized #151703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
rustbot has assigned @jdonszelmann. Use |
| if obligation.predicate != root_obligation.predicate { | ||
| if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(root_pred)) = | ||
| root_obligation.predicate.kind().skip_binder() | ||
| && root_pred.def_id() == trait_pred.trait_ref.def_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if obligation.predicate != root_obligation.predicate { | |
| if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(root_pred)) = | |
| root_obligation.predicate.kind().skip_binder() | |
| && root_pred.def_id() == trait_pred.trait_ref.def_id | |
| if obligation.predicate != root_obligation.predicate | |
| && let ty::PredicateKind::Clause(ty::ClauseKind::Trait(root_pred)) = | |
| root_obligation.predicate.kind().skip_binder() | |
| && root_pred.def_id() == trait_pred.trait_ref.def_id |
|
Btw, I'm curious, there is a comment rust/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs Line 2916 in 4742769
If I understand this correctly, we should never reach this branch, but for some point we do, this brings me to believe that the problem occurs somewhere earlier |
|
Yes, I've thought about this too, and I tried to use root obligation check earlier to leave the to which looks incorrect to me. I've thought about this and recheck with root obligation to ensure we are dealing with same type in the |
|
Actually, It seems to be there is a better place for this check which will not cause diagnostics regression, I will deal with that tommorow |
Fixes #151462
Transmutability error reporting hit an ICE when type aliases were normalized for diagnostics. For example, when type
JustUnit = ()normalizes to(), the check passes unexpectedly even though the original check withJustUnitfailed.Fixed by adding a retry in the
Answer::Yesarm that checks with the root obligation's types before panicking. The retry only occurs when the root obligation differs and is a Transmute trait predicate.Also added a test that reproduces the original ICE.