-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Non-constant repeat count expr causes ICE #4063
Comments
The error happens because you're using Of course, the error message needs to be improved. Changing the title to reflect that. |
Hi, as I don't see any documentation on this. Is there a way to use an enum (or a similar thing to C enums) as a repeat count (to force it to be a constant)? |
I tried doing:
(note the addition of
Noting this so it can be fixed too. |
I think a better way to do what you're trying to do would be to use the |
However, as a third thing to fix as part of this bug, I'll note that vector repeat expressions should be documented. |
For the question of using enums as constants, see #3934 |
Thanks. :-) Another thing I want to point out (possibly already pointed out by others) is that there seems to be no way to directly compare two enums. I find this not very intuitive, but I may be missing something here. Again, comparison between enum's don't seem to be documented. |
At least right now, you have to write an Once deriving is fully implemented, this will be easier. |
Awesome! |
Another internal error related to using enum in an expression expecting constant. The following code also causes the compiler to emit an internal error
This is the error message
|
Original issue is duplication of #3645 The minimal case of commented new one is:
|
Not critical for 0.6; de-milestoning |
Despite the claim in an earlier comment that this is a duplicate of #3645 (which was closed), it appears to me like the described minimal case readily duplicates in 0.6 (18fca3e 2013-05-22). The easy workaround for that minimal case is to use |
One compelling case is that |
Visiting for bug triage, email 2013-07-29 The But this is nonetheless still a bug. |
The test case of
now passes, but I was unable to get the test case of
so this may still be an open issue. The error I'm getting is:
|
If one explicitly initializes the enum values for enum State { ST_NULL = 0, ST_WHITESPACE=1 }
fn SomeFunction () {
~[ST_NULL, ..(ST_WHITESPACE as uint)];
}
fn main() {} I claim that this strikes the right balance, and thus this issue can probably be closed. |
This appears to be fixed -- adding |
I tried to add test cases for this issue and found that enum State { ST_NULL, ST_WHITESPACE=1 }
// ... seems enough. Is it correct? |
Signed-off-by: OGINO Masanori <[email protected]>
Current (minimized) example of breakage:
(courtesy of youknowone; see comments below)
Original Report:
The following code causes the crash
The error messages are as follows:
It seems that the compiler does not understand
entry: ~[mut ~[mut ST_NULL, ..ST_WHITESPACE], ..128]
.The text was updated successfully, but these errors were encountered: