-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unexported ifaces should export metadata anyway for cross-crate monomorphisation #2733
Comments
Offhand it looks like a reachability bug, but I'll investigate. |
@bblum Do you have a test case for reproducing this? |
Closing due to lack of test case; reopen if you have one. |
foo.rs: export foo;
iface local_data { }
impl <T> of local_data for @T { }
fn foo<T>(t: @T) -> local_data {
t as local_data
} foo.rc: #[link(name = "foo", vers="0.0")];
#[crate_type = "lib"]; bar.rs: import foo;
fn main() { foo::foo(@5); } bar.rc: use foo; run The ICE goes away if:
|
Arguably the above should refuse to compile, because Here is a variation that still crashes: trait face { fn x() -> int; }
impl <T> of face for @T { fn x() -> int { 5 } }
fn foo<T>(t: @T) -> int {
(t as face).x()
} |
Doesn't seem to happen with enums. This works fine:
|
related #2313? |
Seems like the fix for #2945 should fix this too, but I'll still check. |
pretty sure 1528256 fixed this. the bug is gone, anyway. |
Spent too long figuring out an ICE: "'lookup_item: id not found: 51905', /home/bblum/rust/src/rustc/metadata/decoder.rs:96".
Turns out I had defined an iface in libcore/task.rs to use in a polymorphic function. I had exported the function, but not the iface. Then when attempting to compile a program that linked against libcore, this failure arose from type_of() in trans/type_of.rs when trying to #debug-print the type, called from monomorphic_fn() in trans/base.rs.
As a workaround, exporting the iface makes the metadata lookup go through.
Maybe all enums need this treatment too?
The text was updated successfully, but these errors were encountered: