Skip to content
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

Cross-crate generics result in strange error. #7804

Closed
mstewartgallus opened this issue Jul 15, 2013 · 1 comment
Closed

Cross-crate generics result in strange error. #7804

mstewartgallus opened this issue Jul 15, 2013 · 1 comment

Comments

@mstewartgallus
Copy link
Contributor

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(());
                                          ^~~~~~~~~~~~~~~~
@huonw
Copy link
Member

huonw commented Jul 19, 2013

Looks like a dup of #4545 and #7899 respectively for the two different errors. Closing in favour of them.

@huonw huonw closed this as completed Jul 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants