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

Wrong lowering of AST::IdentifierPattern #3117

Open
1 task
tamaroning opened this issue Aug 4, 2024 · 1 comment
Open
1 task

Wrong lowering of AST::IdentifierPattern #3117

tamaroning opened this issue Aug 4, 2024 · 1 comment
Labels

Comments

@tamaroning
Copy link
Contributor

tamaroning commented Aug 4, 2024

Summary

AST::IdentifierPattern should lower to HIR::PathPattern only when identifiers resolve to enum variants or structs.
However, they always lower to HIR::IdentifierPattern which introduces a new binding.

See https://doc.rust-lang.org/reference/patterns.html

Reproducer

I tried this code:

enum E {
    A,
    B,
}

use E::*;

fn main() -> i32 {
    match E::B {
        A => 1,
        B => 2,
    } 
}

Does the code make use of any (1.49) nightly feature ?

  • Nightly

Godbolt link

No response

Actual behavior

The current behavior is...

$ echo $?
1

Expected behavior

I expected to see...

$ echo $?
2

GCC Version

master

@tamaroning
Copy link
Contributor Author

tamaroning commented Sep 16, 2024

Glob imports do not seem to work correctly for enum variants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants