Skip to content

ICE when setting a enum discriminator to an unsigned constant #2467

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
msullivan opened this issue May 30, 2012 · 3 comments
Closed

ICE when setting a enum discriminator to an unsigned constant #2467

msullivan opened this issue May 30, 2012 · 3 comments
Labels
A-type-system Area: Type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@msullivan
Copy link
Contributor

Trying to compile:

enum test { thing = 3u }
fn main() {
    log(error, thing as int);
    assert(thing as int == 3);
}

results in

nubs/unsigned-enum-ice.rs:1:20: 1:22 error: mismatched types: expected `int` but found `uint` (int vs uint)
nubs/unsigned-enum-ice.rs:1 enum test { thing = 3u }
                                                ^~
nubs/unsigned-enum-ice.rs:1:20: 1:22 error: expected signed integer constant
nubs/unsigned-enum-ice.rs:1 enum test { thing = 3u }
                                                ^~
error: internal compiler error: tag_variants: bad disr expr

It should just have the type errors without the ICE.

@ghost ghost assigned msullivan May 30, 2012
@lkuper
Copy link
Contributor

lkuper commented Jun 1, 2012

It might make sense to fix this at the same time as #1417.

@catamorphism
Copy link
Contributor

This appears to have been magically fixed. I added the test case.

@pnkfelix
Copy link
Member

(not magic, by the way; see ba9c3eb )

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 22, 2022
add support for env::home_dir

and a bit of cleanup
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-type-system Area: Type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

4 participants