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

dereferencing a single-variant enum allowed in typeck, hits LLVM assert in trans #9814

Closed
thestinger opened this issue Oct 11, 2013 · 1 comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@thestinger
Copy link
Contributor

fn main() {
    enum Foo { Bar(int) }
    let _x = *Bar(2);
}
rustc: /build/rust-git/src/rust/src/llvm/lib/IR/Instructions.cpp:1084: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
@sanxiyn
Copy link
Member

sanxiyn commented Oct 14, 2013

This seems related to #7552.

flaper87 added a commit to flaper87/rust that referenced this issue Feb 25, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 1, 2023
teach `eager_or_lazy` about panicky arithmetic operations

Fixes rust-lang#9422
Fixes rust-lang#9814
Fixes rust-lang#11793

It's a bit sad that we have to do this because arithmetic operations seemed to me like the prime example where a closure would not be necessary, but this has "side effects" (changes behavior when going from lazy to eager) as some of these panic on overflow/underflow if compiled with `-Coverflow-checks` (which is the default in debug mode).
Given the number of backlinks in the mentioned issues, this seems to be a FP that is worth fixing, probably.

changelog: [`unnecessary_lazy_evaluations`]: don't lint if closure has panicky arithmetic operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants