Skip to content

Struct names can't be pattern matched with module prefixes #3952

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
brson opened this issue Nov 12, 2012 · 2 comments
Closed

Struct names can't be pattern matched with module prefixes #3952

brson opened this issue Nov 12, 2012 · 2 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-grammar Area: The grammar of Rust

Comments

@brson
Copy link
Contributor

brson commented Nov 12, 2012

mod codemap {
    struct Loc {
        name: ~str
    }
}

fn main() {
    let sp: codemap::Loc = codemap::Loc {
        name: ~"foo"
    };

    match sp {
        codemap::Loc { name } => {
            assert name == ~"foo"
        }
    }
}
/home/brian/dev/rust2/src/test/run-pass/expn_info.rs:13:21: 13:22 error: expected `=>` but found `{`
/home/brian/dev/rust2/src/test/run-pass/expn_info.rs:13         codemap::Loc { name } => {

@erickt
Copy link
Contributor

erickt commented Nov 13, 2012

Not sure it match destructuring is using the same codepath as let destructuring, so this may or may not be a dup of #3766.

@brson
Copy link
Contributor Author

brson commented Nov 13, 2012

Probably the same

@brson brson closed this as completed Nov 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) A-grammar Area: The grammar of Rust
Projects
None yet
Development

No branches or pull requests

2 participants