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

Compiler crash when matching on extern static constant #16149

Closed
senbrow opened this issue Jul 31, 2014 · 1 comment · Fixed by #16567
Closed

Compiler crash when matching on extern static constant #16149

senbrow opened this issue Jul 31, 2014 · 1 comment · Fixed by #16567
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@senbrow
Copy link

senbrow commented Jul 31, 2014

The following code results in a compiler crash on rustc 0.12.0-pre-nightly (5ebf4813a 2014-07-29 21:16:50 +0000)

extern {
    static externalValue: int;
}

fn main() {
    let boolValue = match 42 {
        externalValue => true,
        _ => false
    };
}

Here is a stack trace:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'called `Option::unwrap()` on a `None` value', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/option.rs:270

stack backtrace:
   1:        0x105f65755 - rt::backtrace::imp::write::hbb253ba4ead9d701Ojq
   2:        0x105f69005 - failure::on_fail::hae29c97c183bf809jAq
   3:        0x10621c125 - unwind::begin_unwind_inner::heb1c638fe2cfececKUd
   4:        0x10621bcfb - unwind::begin_unwind_fmt::he787b6ed8668ca88cSd
   5:        0x10621bb52 - rust_begin_unwind
   6:        0x10626b6ac - failure::begin_unwind::hd9f539f711819e41HZj
   7:        0x102f394c9 - middle::check_match::StaticInliner<'a>.Folder::fold_pat::h474c6bec3dfe65a7Efm
   8:        0x102f34b4b - middle::check_match::check_expr::h6c2a28fd45487372Y0l
   9:        0x102f361fc - middle::check_match::check_local::h7a2b12847be50b08w6m
  10:        0x102f38b1c - visit::walk_block::h11178504046137318959
  11:        0x102f3685c - middle::check_match::check_fn::hfc000f70b7e57dbb08m
  12:        0x102f37863 - visit::walk_item::h18258468695370448187
  13:        0x102f36d5c - middle::check_match::check_crate::ha408d2752ab3565bu0l
  14:        0x102cfeaaa - util::common::time::h11760416629416974346
  15:        0x103562777 - driver::driver::phase_3_run_analysis_passes::h04c7a7a5096a3f33sUv
  16:        0x10355cdb0 - driver::driver::compile_input::h025bdd4f61abfaebHGv
  17:        0x103604f27 - driver::run_compiler::h67f285fbf1017e5aiLy
  18:        0x1036036d6 - driver::main_args::closure.$x22closure$x22$LP$134662$RP$
  19:        0x10361535b - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$135806$RP$
  20:        0x103615250 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$135783$RP$
  21:        0x105e9974c - task::spawn_opts::closure.$x22closure$x22$LP$8296$RP$
  22:        0x10628162c - rust_try
  23:        0x1062193fb - unwind::try::h96e922d0c8f226806Id
  24:        0x1062191a3 - task::Task::run::he3c21bcb4266b9cbyRc
  25:        0x105e995e1 - task::spawn_opts::closure.$x22closure$x22$LP$8241$RP$
  26:        0x10621b076 - thread::thread_start::h585497a1f88d9975ofd
  27:     0x7fff84e38899 - _pthread_body
  28:     0x7fff84e3872a - _pthread_struct_init

This is on OSX 10.9.4. Here is the output of uname -a

$ uname -a
Darwin slimjim 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,3 Darwin
@ghost
Copy link

ghost commented Aug 9, 2014

These should probably not be allowed at all as in other contexts extern statics are not considered constant (say, SIZE in [T, ..SIZE]).

bors added a commit to rust-lang-ci/rust that referenced this issue Jan 3, 2024
internal: Don't fail changelog generation on missing PRs

One year later 😅.
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