-
Notifications
You must be signed in to change notification settings - Fork 14.1k
fix: Do not ICE on normalization failure of an extern static item #149210
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
Conversation
|
rustbot has assigned @jdonszelmann. Use |
|
|
||
| let is_foreign_item = tcx.is_foreign_item(item_id); | ||
|
|
||
| let forbid_unsized = !is_foreign_item || { |
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.
Even though it was already done this way, I quite dislike the block on the right hand side of the or. Could you rewrite this condition to be a bit clearer?
| item_ty, | ||
| &ObligationCause::dummy(), | ||
| |ty| match tcx | ||
| .try_normalize_erasing_regions(wfcx.infcx.typing_env(wfcx.param_env), ty) |
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.
This is an area of the compiler I'm still learning about, so I asked @BoxyUwU for her opinion to also learn from that (<3). To summarize our discussion:
Though this works the erasing_regions part is a bit awkward and probably unnecessary. It also skips some error reporting, hence we get a Result back. Though we think this probably almost never goes into the Err() case, it might be better to use wfcx.normalize instead. If there are diagnostics, it would then also emit those.
Having said that, maybe it leads to duplicate diagnostics so let me know if that works out or not.
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.
almost there I think! let me know how it goes and I'll give it another pass soon :)
ec630b3 to
cf46682
Compare
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.
|
@bors r+ rollup |
Rollup of 8 pull requests Successful merges: - #147736 (Stabilize `asm_cfg`) - #148652 (Cleanup and refactor FnCtxt::report_no_match_method_error) - #149167 (skip checking supertraits in object candidate for `NormalizesTo` goal) - #149210 (fix: Do not ICE on normalization failure of an extern static item) - #149268 (add implementation-internal namespace for globalasm) - #149274 (Fix invalid link generation for type alias methods) - #149302 (Fix comment wording in simplify_comparison_integral.rs) - #149305 (Simplify OnceCell Clone impl) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang/rust#147736 (Stabilize `asm_cfg`) - rust-lang/rust#148652 (Cleanup and refactor FnCtxt::report_no_match_method_error) - rust-lang/rust#149167 (skip checking supertraits in object candidate for `NormalizesTo` goal) - rust-lang/rust#149210 (fix: Do not ICE on normalization failure of an extern static item) - rust-lang/rust#149268 (add implementation-internal namespace for globalasm) - rust-lang/rust#149274 (Fix invalid link generation for type alias methods) - rust-lang/rust#149302 (Fix comment wording in simplify_comparison_integral.rs) - rust-lang/rust#149305 (Simplify OnceCell Clone impl) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #148161