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

rust compiler bug report #16538

Closed
GuillaumeGomez opened this issue Aug 16, 2014 · 6 comments
Closed

rust compiler bug report #16538

GuillaumeGomez opened this issue Aug 16, 2014 · 6 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@GuillaumeGomez
Copy link
Member

Hey, here's the compiler error :

rustc --out-dir=lib src/rgsl.rs
src/types/rng.rs:76:39: 76:101 error: function calls in constants are limited to struct and enum constructors [E0015]
src/types/rng.rs:76 pub static DefaultRngType : RngType = ffi::FFI::wrap(ffi::gsl_rng_default as *mut ffi::gsl_rng_type);
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/types/rng.rs:76:39: 76:53 error: paths in constants may only refer to constants or functions [E0014]
src/types/rng.rs:76 pub static DefaultRngType : RngType = ffi::FFI::wrap(ffi::gsl_rng_default as *mut ffi::gsl_rng_type);
                                                          ^~~~~~~~~~~~~~
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 'expected item, found foreign item ffi::gsl_rng_default::gsl_rng_default (id=77)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_map/mod.rs:278

stack backtrace:
   1:     0x2b06fdd678d0 - rt::backtrace::imp::write::hd12ae02842755623o1q
   2:     0x2b06fdd6a970 - failure::on_fail::h6afb6f0ebb5c1bdeBmr
   3:     0x2b06fd5f4bb0 - unwind::begin_unwind_inner::h86392b0c3fc310f0M8d
   4:     0x2b06fd5f48a0 - unwind::begin_unwind_fmt::hd35db468d804f365h6d
   5:     0x2b06feb04f80 - ast_map::Map::expect_item::h4597d80f1ef5aa9cILy
   6:     0x2b06fc46c270 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_expr::h2e9f3d299534964bjPl
   7:     0x2b06fc46c270 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_expr::h2e9f3d299534964bjPl
   8:     0x2b06fc46c270 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_expr::h2e9f3d299534964bjPl
   9:     0x2b06fc46af70 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_item::h8a613a9edea4e565oOl
  10:     0x2b06fc466090 - middle::check_const::check_item::h267c6ba5219e9e33Yul
  11:     0x2b06fc466090 - middle::check_const::check_item::h267c6ba5219e9e33Yul
  12:     0x2b06fc466090 - middle::check_const::check_item::h267c6ba5219e9e33Yul
  13:     0x2b06fc469490 - middle::check_const::check_crate::h65bbcf0bb3bc1b23zul
  14:     0x2b06fc21e400 - util::common::time::h7327768964783328304
  15:     0x2b06fcadb690 - driver::driver::phase_3_run_analysis_passes::hb464148d666a3b1afJw
  16:     0x2b06fcad67d0 - driver::driver::compile_input::h638ffee922a36ddauvw
  17:     0x2b06fcb80820 - driver::run_compiler::h5ecca9beeafb5864JZz
  18:     0x2b06fcb80730 - driver::main_args::closure.136214
  19:     0x2b06fcb93080 - task::TaskBuilder<S>::try_future::closure.137375
  20:     0x2b06fcb92e80 - task::TaskBuilder<S>::spawn_internal::closure.137352
  21:     0x2b06fbf2da20 - task::spawn_opts::closure.8315
  22:     0x2b06fd64c750 - rust_try_inner
  23:     0x2b06fd64c740 - rust_try
  24:     0x2b06fd5f2210 - unwind::try::ha10f578e4c63e61ehXd
  25:     0x2b06fd5f1fb0 - task::Task::run::hddad80091d517d7cT4c
  26:     0x2b06fbf2d7e0 - task::spawn_opts::closure.8261
  27:     0x2b06fd5f3df0 - thread::thread_start::h182a6a945c32d2093sd
  28:     0x2b06fe3f10c0 - start_thread
  29:     0x2b06fda0c359 - __clone
  30:                0x0 - <unknown>

make: *** [rgsl] Error 101
@GuillaumeGomez
Copy link
Member Author

I almost forgot :

> rustc --version
rustc 0.12.0-pre-nightly (6b5ec40d4 2014-08-15 00:46:19 +0000)

@steveklabnik
Copy link
Member

Can you share the code with us, or something to reproduce it?

@GuillaumeGomez
Copy link
Member Author

For example you can add this line :

pub static DefaultRngType : RngType = ffi::FFI::wrap(ffi::gsl_rng_default as *mut ffi::gsl_rng_type);

In this file : https://github.com/GuillaumeGomez/rust-GSL/blob/master/src/types/rng.rs

The bug will occur again.

@ghost
Copy link

ghost commented Sep 6, 2014

Minimal test case:

mod Y {
    type X = uint;
    extern {
        static x: *const uint;
    }
    fn foo(value: *const X) -> *const X {
        value
    }
}

static foo: *const Y::X = Y::foo(Y::x as *const Y::X);

fn main() {}

@sanxiyn
Copy link
Member

sanxiyn commented Dec 8, 2014

This seems fixed by #18279.

@GuillaumeGomez
Copy link
Member Author

@sanxiyn: I confirm. Thanks for the info !

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 8, 2014
@bors bors closed this as completed in 01cdf00 Dec 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants