Skip to content

cannot deriving(Eq) for fixed-lengthed 2d vectors #6262

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
gifnksm opened this issue May 6, 2013 · 3 comments
Closed

cannot deriving(Eq) for fixed-lengthed 2d vectors #6262

gifnksm opened this issue May 6, 2013 · 3 comments

Comments

@gifnksm
Copy link
Contributor

gifnksm commented May 6, 2013

Following code cannot compile.

#[deriving(Eq)]
struct SuDoku {
    map: [[uint, .. 9], .. 9]
}
$ rustc --lib sudoku.rs
sudoku.rs:1:11: 1:14 error: mismatched types: expected `&&[[uint, .. 9]]` but found `&[[uint, .. 9], .. 9]` ([] storage differs: expected & but found 9)
sudoku.rs:1 #[deriving(Eq)]
                       ^~~
sudoku.rs:1:11: 1:14 error: failed to find an implementation of trait core::cmp::Eq for [uint, .. 9]
sudoku.rs:1 #[deriving(Eq)]
                       ^~~
@huonw
Copy link
Member

huonw commented May 6, 2013

This seems (partly) like a failing with fixed length vectors, e.g. the following works fine with the first definition of x, but not with the second.

fn main(){
    // let x = 1i;
    let x: [int, .. 2] = [1, .. 2];
    x.eq(& x);
}
fixed-vec.rs:7:9: 7:12 error: mismatched types: expected `&&[int]` but found `&[int, .. 2]` ([] storage differs: expected & but found 2)
fixed-vec.rs:7     x.eq(& x);
                        ^~~
error: aborting due to previous error

@huonw
Copy link
Member

huonw commented Jul 30, 2013

Linking to #7622 (this is almost certainly caused by that, but there is the possibility of some subtlety specific to #[deriving].)

@huonw
Copy link
Member

huonw commented Jul 30, 2013

After searching a little harder, closing as a dup of #6883.

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

No branches or pull requests

2 participants