Skip to content

lookup_item ICE when &'self fn deref'ed from separate compile unit #6919

Closed
@pnkfelix

Description

@pnkfelix

Spawned off of #5446. (This is a significantly narrowed down version of the test case described there; the problem with conditions appears to arise from its use of 'self region parameters for borrowed function pointers.)

(This top version is newer and thus labelled as a variant. The "original narrowing" is at the bottom of the report.)

iss.rc (variant 3):

#[link(name="iss6919_3", vers="0.1")];

struct C<'self> {
    pub k: &'self fn(), // <-- necessary; bug seems to require &'self functions.
}

fn no_op() { }
pub static D : C<'static> = C {
    k: no_op
};

main.rs (variant 3):

extern mod iss ( name = "iss6919_3" );
fn main() {
    iss::D.k; // <-- this is just a deref.  (An invocation fails too, but its uglier to write and would distract.)
}

Transcript:

% rustc --lib iss.rc
warning: no debug symbols in executable (-arch x86_64)
% RUST_LOG=rustc=1,::rt::backtrace rustc -L . main.rs 
rust: task failed at 'lookup_item: id not found: 11', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/metadata/decoder.rs:92
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
rust: task failed at 'explicit failure', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/rustc.rc:400
rust: domain main @0x7fa35b808410 root task failed
% rustc --version
/Users/fklock/opt/rust-dbg-nopt/bin/rustc 0.6 (4f6285f 2013-06-02 22:31:36 -0700)
host: x86_64-apple-darwin
% 

Original narrowed version below (but one above is smaller).

iss.rc:

#[link(name="iss", vers="0.1")];

struct C<'self> {
    k: &'self fn(), // <-- necessary; bug seems to require &'self functions.
}

impl<'self> C<'self> {
    pub fn r(&self) { }
}

fn no_op() { }
pub static D : C<'static> = C {
    k: no_op
};

main.rs:

extern mod iss;
fn main() { iss::D.r(); }

Transcript:

% rustc --lib iss.rc
warning: no debug symbols in executable (-arch x86_64)
% RUST_LOG=rustc=1,::rt::backtrace rustc -L . main.rs 
rust: task failed at 'lookup_item: id not found: 20', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/metadata/decoder.rs:92
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
rust: task failed at 'explicit failure', /Users/fklock/Dev/Mozilla/rust.git/src/librustc/rustc.rc:400
rust: domain main @0x7fe851808410 root task failed
% rustc --version
/Users/fklock/opt/rust-dbg-nopt/bin/rustc 0.6 (4f6285f 2013-06-02 22:31:36 -0700)
host: x86_64-apple-darwin
% 

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions