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

Generic Tuple-like Structs do not work cross-crate #7899

Closed
auroranockert opened this issue Jul 19, 2013 · 9 comments · Fixed by #12738
Closed

Generic Tuple-like Structs do not work cross-crate #7899

auroranockert opened this issue Jul 19, 2013 · 9 comments · Fixed by #12738
Labels
A-metadata Area: Crate metadata A-resolve Area: Name resolution E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@auroranockert
Copy link
Contributor

First the crate testcrate.rs,

pub struct V2<T>(T, T);

then the actual test,

extern mod testcrate;

fn main() {
    let f = testcrate::V2(1.0f32, 2.0f32);
}

This gives the unexpected error,

test-run.rs:4:26: 4:32 error: mismatched types: expected `BUG[0]` but found `f32` (expected type parameter but found f32)
test-run.rs:4     let f = testcrate::V2(1.0f32, 2.0f32);
                                        ^~~~~~
test-run.rs:4:34: 4:40 error: mismatched types: expected `BUG[0]` but found `f32` (expected type parameter but found f32)
test-run.rs:4     let f = testcrate::V2(1.0f32, 2.0f32);
                                                ^~~~~~
error: aborting due to 2 previous errors
rust: task failed at 'explicit failure', /Users/Jens/Code/Git/rust/src/libsyntax/diagnostic.rs:96
rust: task failed at 'explicit failure', /Users/Jens/Code/Git/rust/src/librustc/rustc.rs:360
rust: domain main @0x7fd292008410 root task failed
@auroranockert
Copy link
Contributor Author

@graydon: Just so you know what's going on with SIMD shuffles, I tried, but implementing it with #[lang=…] and generics is blocked bug.

@huonw
Copy link
Member

huonw commented Jul 19, 2013

Part of #7435, presumably.

Nominating for feature complete.

@SimonSapin
Copy link
Contributor

I got bitten by this.

If fixing it is not easy, it would be good to at least have a less cryptic error message. Switching to structs with fields is easy enough… once you know that tuple-like structs are the problem. It took me a while to figure out.

@catamorphism
Copy link
Contributor

Accepted for production-ready

@pnkfelix
Copy link
Member

(should we try to improve the error message sooner than "production-ready" ... probably worth considering ....)

@alexcrichton
Copy link
Member

@blake2-ppc has noticed that this has been fixed, flagging as needstest.

@alexcrichton
Copy link
Member

false alarm

@pzol
Copy link
Contributor

pzol commented Feb 26, 2014

Visiting for triage.

Works. Would suggest to close it.
test performed:

testcrate.rs:

pub struct V2<T>(T, T);

rustc --crate-type lib testcrate.rs

main.rs:

extern crate testcrate;

fn main() {
    let f = testcrate::V2(1.0f32, 2.0f32);
}

rustc -L . main.rs

@sfackler
Copy link
Member

Flagging as needstest

bors added a commit that referenced this issue Mar 6, 2014
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 4, 2021
Refactoring `FullInt`

Refactoring `FullInt`

changelog: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata A-resolve Area: Name resolution E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants