Skip to content

Cannot construct a static with a cross-crate tuple struct #17169

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

Closed
huonw opened this issue Sep 11, 2014 · 1 comment · Fixed by #17722
Closed

Cannot construct a static with a cross-crate tuple struct #17169

huonw opened this issue Sep 11, 2014 · 1 comment · Fixed by #17722

Comments

@huonw
Copy link
Member

huonw commented Sep 11, 2014

// othercrate.rs
pub struct Foo(u8);

static OK: Foo = Foo(1);
// crosscratetuple.rs
extern crate othercrate;

static ERR: othercrate::Foo = othercrate::Foo(1);

fn main() {}

rustc othercrate.rs --crate-type lib compiles fine (other than the dead code warning for OK), but rustc -L . crosscratetuple.rs is not:

crosscratetuple.rs:3:31: 3:49 error: function calls in constants are limited to struct and enum constructors [E0015]
crosscratetuple.rs:3 static ERR: othercrate::Foo = othercrate::Foo(1);
                                                   ^~~~~~~~~~~~~~~~~~
@huonw huonw changed the title Cannot construct a static simd struct Cannot construct a static with a cross-crate tuple struct Sep 11, 2014
@carllerche
Copy link
Member

I hit this as well, I would love a fix 👍

andrew-d added a commit to andrew-d/mio that referenced this issue Oct 10, 2014
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

Successfully merging a pull request may close this issue.

2 participants