Skip to content

Fix a handful of ICEs around casting #17646

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

Merged
merged 4 commits into from
Oct 3, 2014
Merged

Conversation

bkoropoff
Copy link
Contributor

This fixes missing cases in trans for various casts that are permitted by typeck. I wasn't sure whether some of these were actually intended to be allowed (e.g. enum -> pointer), so each commit is a self-contained change that can easily be dropped if necessary.

Closes issue #17458
Closes issue #17444

@alexcrichton
Copy link
Member

err, removing r+ actually, it's a good point of whether we want the enum -> pointer coercions.

@alexcrichton
Copy link
Member

cc @pcwalton, when enum discriminants change to all int recently, did we intend to disallow a cast such as this?

@bkoropoff
Copy link
Contributor Author

I'm happy to fix typeck if it's determined that enum to pointer casts should not be allowed.

@bkoropoff
Copy link
Contributor Author

typeck disallows casting directly from enum to float and tells the user to cast through an integer type, so it seems like doing the same for pointers is the most reasonable approach. I'll rework the patch stack a bit to do this.

@alexcrichton
Copy link
Member

Oh oops, I failed to notice that the patch now disallows that sort of cast! This looks good to me, thanks @bkoropoff!

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 2, 2014
@bors bors merged commit 93408be into rust-lang:master Oct 3, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Jul 28, 2024
Add missing dyn parse special cases in 2015 edition

There were a few more special cases to consider here -> rust-lang/reference#1538
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Aug 1, 2024
Add missing dyn parse special cases in 2015 edition

There were a few more special cases to consider here -> rust-lang/reference#1538
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.

3 participants