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

mut is accepted before constants in patterns #34047

Closed
petrochenkov opened this issue Jun 2, 2016 · 2 comments · Fixed by #34095
Closed

mut is accepted before constants in patterns #34047

petrochenkov opened this issue Jun 2, 2016 · 2 comments · Fixed by #34095

Comments

@petrochenkov
Copy link
Contributor

This compiles on stable/beta/nightly and C is resolved as a constant and not a new binding.

const C: u8 = 0;

fn main() {
    match 1u8 {
        mut C => {}
        _ => {}
    }
}
@durka
Copy link
Contributor

durka commented Jun 2, 2016

It doesn't match though: https://is.gd/ylHuUv

@hanna-kruppe
Copy link
Contributor

hanna-kruppe commented Jun 2, 2016

@durka The example matches on 1, while C is 0, so of course it doesn't match. Conversely, match 0u8 correctly takes the C arm, and the generated code looks good too. It seems the mut is simply ignored.

bors added a commit that referenced this issue Jun 9, 2016
Improvements to pattern resolution + some refactoring

Continuation of #33929
First commit is a careful rewrite of `resolve_pattern`, pattern path resolution and new binding creation logic is factored out in separate functions, some minor bugs are fixed. Also, `resolve_possibly_assoc_item` doesn't swallow modules now.
Later commits are refactorings, see the comment descriptions.

I intend to continue this work later with better support for `Def::Err` in patterns in post-resolve stages and cleanup of pattern resolution code in type checker.

Fixes #32086
Fixes #34047 ([breaking-change])
Fixes #34074

cc @jseyfried
r? @eddyb
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.

4 participants