Closed
Description
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
%
Activity
Blei commentedon Jun 4, 2013
I spent some time debugging this and apparently if you mark
no_op
aspub
, everything works! Investigating...Blei commentedon Jun 4, 2013
The problem seems to be that there is no code in place to check that private functions are not "leaked" with the use of
static
s. This leads to the further minimized test program (variant 4, if you will):iss.rc
main.rs
Blei commentedon Jun 4, 2013
Ok, I think I know more or less what to do to find such private-but-leaked functions and how to export them. But the problem is: that probably makes them visible from outside the crate, which is probably not desirable. What now?
Blei commentedon Jun 5, 2013
The following commit fixes the ICE, but also exports all private functions that are referenced using visible
static
s: Blei/rust@c96afd8d850320e0dc710d176d7a52430cc510c4.Blei commentedon Jun 5, 2013
Hmm this commit also exports lots of other stuff it shouldn't... Sorry for the spam
emberian commentedon Jul 24, 2013
There is no longer an ICE with the reduced or original testcase. Needs test in testsuite.
1 remaining item