Skip to content

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

Conversation

nikomatsakis
Copy link
Contributor

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

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.
@sfackler
Copy link
Member

sfackler commented Jan 7, 2015

Does this close #20368 as well?

@nikomatsakis
Copy link
Contributor Author

@sfackler yes, I just tried it. Test seems too similar to merit being added as a regression test though.

@nikomatsakis nikomatsakis force-pushed the assoc-types-projections-in-structs-issue-20470 branch from d6204e1 to e16449e Compare January 7, 2015 23:46
@nikomatsakis
Copy link
Contributor Author

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 {
Copy link
Member

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.

@nrc
Copy link
Member

nrc commented Jan 8, 2015

r = me with the tcx -> ccx changes reverted

@nikomatsakis nikomatsakis force-pushed the assoc-types-projections-in-structs-issue-20470 branch from e16449e to cb98c3d Compare January 8, 2015 01:33
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 8, 2015
…-in-structs-issue-20470

Conflicts:
	src/librustc_trans/trans/expr.rs
@bors bors merged commit cb98c3d into rust-lang:master Jan 8, 2015
@nikomatsakis nikomatsakis deleted the assoc-types-projections-in-structs-issue-20470 branch March 30, 2016 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants