Closed
Description
Okay, so I really don't know how to title this error properly but cross-crate generics can result in this strange error. The error:
RUST_LOG=1 rustc main.rs -L .
rust: task failed at 'assertion failed: `(left == right) && (right == left)` (left: `2`, right: `0`)', /home/steven/others/src/rust/src/librustc/middle/trans/callee.rs:398
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', /home/steven/others/src/rust/src/librustc/rustc.rs:362
rust: domain main @0xa75010 root task failed
main.rs
extern mod myextra;
use myextra::WriteLocked;
fn main() {
let _foo: WriteLocked<()> = WriteLocked::new();
}
myextra.rs
#[crate_type = "lib"];
impl <T> WriteLocked<T> {
pub fn new() -> WriteLocked<T> {
WriteLocked(())
}
}
pub struct WriteLocked<T> (());
Even weirder is the error that results when WriteLocked(())
is used directly in main.rs:
main.rs:6:32: 6:48 error: mismatched types: expected `myextra::WriteLocked<()>` but found `myextra::WriteLocked<BUG[0]>` (expected () but found type parameter)
main.rs:6 let _foo: WriteLocked<()> = WriteLocked(());
^~~~~~~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
No labels