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

ICE: Implement discriminant const qualify #40012

Closed
clarfonthey opened this issue Feb 21, 2017 · 1 comment · Fixed by #41055
Closed

ICE: Implement discriminant const qualify #40012

clarfonthey opened this issue Feb 21, 2017 · 1 comment · Fixed by #41055
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@clarfonthey
Copy link
Contributor

Currently, the compiler will ICE if you have a match on an enum within a const function. If this isn't implemented, it should at least warn the user instead of showing an ICE.

Example here: https://is.gd/r4d3MB

@nagisa
Copy link
Member

nagisa commented Feb 22, 2017

Thats likely me

@frewsxcv frewsxcv added A-const-fn I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Mar 24, 2017
ryan-scott-dev pushed a commit to ryan-scott-dev/rust that referenced this issue Apr 4, 2017
bors added a commit that referenced this issue Apr 8, 2017
…, r=arielb1

Fixed ICEs with pattern matching in const expression

Fixed 2 ICEs with when pattern matching inside a constant expression.

Both of these ICEs now resolve to an appropriate compiler error.

1. ICE was caused by a compiler bug to implement discriminant const qualify.

    I removed this intentionally thrown bug and changed it to a FIXME as the unimplemented expression type is handled as a compiler error elsewhere.

2. ICE was caused during a drop check when checking if a variable lifetime outlives the current scope if there was no parent scope .

    I've changed it to stop checking if there is no parent scope for the current scope. It is valid syntax for a const variable to be assigned a match expression with no enclosing scope.

    The ICE seemed to mainly be used as a defensive check for bugs elsewhere.

Fixes #38199.
Fixes #31577.
Fixes #29093.
Fixes #40012.
@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants