-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix various ICEs relating to trans'ing fields with associated types #20706
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
Fix various ICEs relating to trans'ing fields with associated types #20706
Conversation
always were but it's dang annoying to weed out all the places that fail to meet the assertion, and it doesn't really hurt things if we don't always get it right.
Does this close #20368 as well? |
@sfackler yes, I just tried it. Test seems too similar to merit being added as a regression test though. |
d6204e1
to
e16449e
Compare
Just pushed one additional commit. This also fixes #20535 now. |
@@ -114,23 +114,24 @@ pub fn normalize_ty<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { | |||
} | |||
|
|||
// Is the type's representation size known at compile time? | |||
pub fn type_is_sized<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool { | |||
ty::type_contents(cx, ty).is_sized(cx) | |||
pub fn type_is_sized<'a,'tcx>(ccx: &CrateContext<'a,'tcx>, ty: Ty<'tcx>) -> bool { |
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.
Changing this fn and lltype_is_sized to take a CrateCtxt rather than a ty::ctxt seems unnecessary and makes things more complicated.
r = me with the tcx -> ccx changes reverted |
result of using `ty::type_is_sized`
e16449e
to
cb98c3d
Compare
…-in-structs-issue-20470 Conflicts: src/librustc_trans/trans/expr.rs
There were various parts of trans that were failing to normalize associated types of fields. In addition, the use of
TypeContents
to compute whether something is sized was not able to handle projection types.Fixes #20470.
Fixes #20368.
Fixes #20535.
r? @nick29581