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

Unexpected failure, when interfacing with C code #18360

Closed
nickik opened this issue Oct 27, 2014 · 3 comments
Closed

Unexpected failure, when interfacing with C code #18360

nickik opened this issue Oct 27, 2014 · 3 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nickik
Copy link

nickik commented Oct 27, 2014

I am trying to write a interace to some C Code, the interface code was generated by bindgen-rust.

pub static MPS_KEY_ARGS_END: mps_key_t = &_mps_key_ARGS_END; //code I added

pub enum Struct_mps_key_s { }
pub type mps_key_t = *const Struct_mps_key_s;

extern "C" {
        pub static _mps_key_ARGS_END: Struct_mps_key_s;
}   

System: Arch Linux x86

Rust version:
aur/rust-nightly-bin 0.13.0_2014.10.27-1 (16)
A safe, concurrent, practical language from Mozilla.

Compiling rust-mps-bindings v0.0.1 (file:///home/nick/alltech/clojit/rust-mps-bindings)
     Running `rustc /home/nick/alltech/clojit/rust-mps-bindings/src/main.rs --crate-name rust-mps-bindings --crate-type bin -g --out-dir /home/nick/alltech/clojit/rust-mps-bindings/target --dep-info /home/nick/alltech/clojit/rust-mps-bindings/target/.fingerprint/rust-mps-bindings-03f1405e8d318ae0/dep-bin-rust-mps-bindings -L /home/nick/alltech/clojit/rust-mps-bindings/target -L /home/nick/alltech/clojit/rust-mps-bindings/target/deps --extern rust-mps-bindings=/home/nick/alltech/clojit/rust-mps-bindings/target/librust-mps-bindings-03f1405e8d318ae0.rlib`
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 _mps_key_ARGS_END::_mps_key_ARGS_END (id=1107)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_map/mod.rs:327

Could not compile `rust-mps-bindings`.

Caused by:
  Process didn't exit successfully: `rustc /home/nick/alltech/clojit/rust-mps-bindings/src/main.rs --crate-name rust-mps-bindings --crate-type bin -g --out-dir /home/nick/alltech/clojit/rust-mps-bindings/target --dep-info /home/nick/alltech/clojit/rust-mps-bindings/target/.fingerprint/rust-mps-bindings-03f1405e8d318ae0/dep-bin-rust-mps-bindings -L /home/nick/alltech/clojit/rust-mps-bindings/target -L /home/nick/alltech/clojit/rust-mps-bindings/target/deps --extern rust-mps-bindings=/home/nick/alltech/clojit/rust-mps-bindings/target/librust-mps-bindings-03f1405e8d318ae0.rlib` (status=101)
@nickik
Copy link
Author

nickik commented Oct 27, 2014

This line seams to make the diffrence:
pub static MPS_KEY_ARGS_END: mps_key_t = &_mps_key_ARGS_END; //code I added

if I comment it out, the compiler runs without error.

@chris-morgan
Copy link
Member

Minimal test case:

extern "C" {
    static A: int;
}

static B: int = A;

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 27, 2015
@tamird
Copy link
Contributor

tamird commented Apr 22, 2015

Unable to repro:

extern "C" {
    static A: i8;
}

static B: i8 = A;

fn main() {
    // Add code here
}
$ rustc main.rs
main.rs:5:16: 5:17 error: cannot refer to other statics by value, use the address-of operator or a constant instead
main.rs:5 static B: i8 = A;
                         ^
error: aborting due to previous error

lnicola pushed a commit to lnicola/rust that referenced this issue Oct 22, 2024
feat: better completions for extern blcoks

This PR refactors `add_keywords` (making it much clearer!) and enhances completion for `extern` blocks.

It is recommended to reviewing the changes in order of the commits:

- The first commit (f3c4dde0a4917a2bac98605cc045eecfb4d69872) doesn’t change any logic but refactors parts of the `add_keywords` function and adds detailed comments.
- The second commit (5dcc1ab649bf8a49cadf006d620871b12f093a2f) improves completion for `extern` kw and extern blocks.
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

4 participants