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

Visibility of struct-like enums across crates seems to fail #5557

Closed
mantielero opened this issue Mar 26, 2013 · 4 comments
Closed

Visibility of struct-like enums across crates seems to fail #5557

mantielero opened this issue Mar 26, 2013 · 4 comments
Labels
A-resolve Area: Name resolution

Comments

@mantielero
Copy link

I have the following Enum defined within a crate:

pub enum Event {
    pub KeyEvent{md: u8, key: u16, ch: u32},  
    pub ResizeEvent{w: i32, h: i32},
    NoEvent,
    NotManagedEvent
}

When I try to use the crate I cannot match KeyEvent. rustc complains about KeyEvent not name a structure.

Relevant information:

@metajack
Copy link
Contributor

nominating production ready

@graydon
Copy link
Contributor

graydon commented May 23, 2013

accepted for production-ready milestone

@metajack
Copy link
Contributor

Visiting for triage (and first one I've gotten a second time!). Added some labels, but nothing else to add.

Here's a smaller and complete test case:

5557lib.rs:

#[link(name = "fivefivefiveseven",
       vers = "0.1")];
#[crate_type = "lib"];

pub enum Event {
    KeyEvent { foo: u8 }
}

5557bin.rs

extern mod fivefivefiveseven;

use fivefivefiveseven::{Event, KeyEvent};

fn main() {
    let _ = KeyEvent { foo: 1 };
}

and this produces:

5557bin.rs:6:12: 6:20 error: `KeyEvent` does not name a structure
5557bin.rs:6     let _ = KeyEvent { foo: 1 };
                         ^~~~~~~~

bors added a commit that referenced this issue Sep 11, 2013
Fixes issues #5557 and #8746.

This patch adds an additional family for struct-like variants, and encodes some struct-like aspects of such variants that can then be properly decoded by resolve.

Note that I am not 100% sure how this fix works, but it fixes the issue without breaking any of the tests on my machine.
@alexcrichton
Copy link
Member

Closed by #9064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution
Projects
None yet
Development

No branches or pull requests

4 participants