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

Resolve error in pattern match of struct in a different module #3845

Closed
burg opened this issue Oct 23, 2012 · 2 comments
Closed

Resolve error in pattern match of struct in a different module #3845

burg opened this issue Oct 23, 2012 · 2 comments

Comments

@burg
Copy link

burg commented Oct 23, 2012

If a struct is defined elsewhere, it won't get resolved in a pattern match. @pcwalton

Testcase

fn main() {
    let sears = buildings::Tower { height: 1451 };

    let h: uint = match sears {
        ::buildings::Tower { height: h } => { h }
    };

    io::println(h.to_str());
}

mod buildings {
    struct Tower { height: uint }
}

Error

test.rs:2:16: 2:32 error: `buildings::Tower` does not name a structure
test.rs:2     let sears = buildings::Tower { height: 1451 };
                          ^~~~~~~~~~~~~~~~
test.rs:5:8: 5:26 error: `buildings::Tower` does not name a structure
test.rs:5         ::buildings::Tower { height: h } => { h }
                  ^~~~~~~~~~~~~~~~~~
test.rs:5:37: 5:38 error: unresolved name: h
test.rs:5         ::buildings::Tower { height: h } => { h }
                                               ^
test.rs:5:46: 5:47 error: unresolved name: h
test.rs:5         ::buildings::Tower { height: h } => { h }
@catamorphism
Copy link
Contributor

Is this different from #3767?

@burg
Copy link
Author

burg commented Oct 24, 2012

Probably not, except it's masked by the parse error in another bug. I filed a second bug once I realized there's a simpler repro for resolve problems.

@burg burg closed this as completed Oct 24, 2012
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