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

Static mutable enum variables break the compiler. #11516

Closed
dradtke opened this issue Jan 13, 2014 · 1 comment
Closed

Static mutable enum variables break the compiler. #11516

dradtke opened this issue Jan 13, 2014 · 1 comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dradtke
Copy link

dradtke commented Jan 13, 2014

I was playing around with Rust recently trying to develop a module that needed to maintain some internal state, and came across what appears to be a lack of support for static variables for anything besides primitive types.

Here's my example program (list definition taken from the tutorial):

enum List<T> {
    Cons(T, ~List<T>),
    Nil,
}

static mut numbers: List<int> = Nil;

fn main() {}

And here's the error that trying to compile this code generates with RUST_LOG=rustc=1, minus some dead code warnings:

task 'rustc' failed at 'assertion failed: !is_undef(wrapped)', /opt/rust/src/librustc/middle/trans/adt.rs:773
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task '<main>' failed at 'explicit failure', /opt/rust/src/librustc/lib.rs:453

This is with Rust 0.9 on openSUSE 13.1.

@alexcrichton
Copy link
Member

Closed by #11979, types with destructors aren't allowed in mutable statics.

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 25, 2023
fix cast_lossless with macro call

changelog: fix [`cast_lossless`] in the case when the cast operand is a macro call

fix rust-lang#11458
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

No branches or pull requests

2 participants