Skip to content

ICE: cannot export private function via public static variable #6464

@gifnksm

Description

@gifnksm
Contributor

Following code causing ICE.
foo.rs

pub static fun: extern fn() = foo;

fn foo() {
  println("Foo");
}

main.rs

extern mod foo;

fn main() {
  (foo::fun)();
}
$  rustc --lib foo.rs
warning: missing crate link meta `name`, using `foo` as default
warning: missing crate link meta `vers`, using `0.0` as default
$ rustc main.rs -L .
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues

If foo::foo is declared as pub, the code compiles successfully.

Activity

gifnksm

gifnksm commented on May 14, 2013

@gifnksm
ContributorAuthor

This may be related to #4202.

thomaslee

thomaslee commented on May 20, 2013

@thomaslee
Contributor

It feels relatively unlikely to me that this relates directly to #4202, but I'll try to take a look at this later in the week -- unless of course you're keen to fix it yourself @gifnksm :)

bblum

bblum commented on Jul 26, 2013

@bblum
Contributor

The error message of the ICE is "'lookup_item: id not found: 11', /home/rustbuild/src/rust-buildbot/slave/snap3-linux/build/src/librustc/metadata/decoder.rs:86".

But, this appears to work fine with my stage1 compiler, despite reproducing on stage0. Reopen if this comes back, I guess?

added a commit that references this issue on Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @thomaslee@gifnksm@bblum

        Issue actions

          ICE: cannot export private function via public static variable · Issue #6464 · rust-lang/rust