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

Warn on pattern bindings that have the same name as a variant #19115

Closed
wants to merge 2 commits into from
Closed

Warn on pattern bindings that have the same name as a variant #19115

wants to merge 2 commits into from

Commits on Nov 26, 2014

  1. Warn on pattern bindings that have the same name as a variant

    ...of the type being matched.
    
    This change will result in a better diagnostic for code like the following:
    
    ```rust
    enum Enum {
        Foo,
        Bar
    }
    
    fn f(x: Enum) {
        match x {
            Foo => (),
            Bar => ()
        }
    }
    ```
    
    which would currently simply fail with an unreachable pattern error
    on the 2nd arm.
    
    The user is advised to either use a qualified path in the patterns
    or import the variants explicitly into the scope.
    Jakub Bukaj committed Nov 26, 2014
    Configuration menu
    Copy the full SHA
    5804a30 View commit details
    Browse the repository at this point in the history
  2. Do not print any warnings if '-A warnings' is specified on the comman…

    …d line
    Jakub Bukaj committed Nov 26, 2014
    5 Configuration menu
    Copy the full SHA
    9d01db1 View commit details
    Browse the repository at this point in the history