Skip to content
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 ICE generating drop glue for Box<str> #17762

Merged
merged 2 commits into from
Oct 5, 2014
Merged

Conversation

bkoropoff
Copy link
Contributor

Closes issue #17734

r? @nick29581


fn f(s: Box<str>) -> Box<str> {
s
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check that a dtor on str is called in this test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str is a built-in type (and doesn't itself have a destructor), do you have a cross-platform way to do the check you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, there doesn't seem to be any way to construct a Box<str> safely at the moment. I could produce one by creating a Box<[u8]> and transmuting, but I'm not sure how to test that the destructor fires correctly.

@bkoropoff
Copy link
Contributor Author

I updated the test to be a bit more interesting at runtime. I'm not sure how to programmatically check that the box is dropped correctly, but I verified that the generated IR and asm looks right.

bors added a commit that referenced this pull request Oct 5, 2014
@bors bors closed this Oct 5, 2014
@bors bors merged commit 714c8d8 into rust-lang:master Oct 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants