]> git.lizzy.rs Git - rust.git/commit
Fix handling of const patterns
authorFlorian Diebold <florian.diebold@freiheit.com>
Fri, 21 Feb 2020 15:56:34 +0000 (16:56 +0100)
committerFlorian Diebold <florian.diebold@freiheit.com>
Fri, 21 Feb 2020 16:01:19 +0000 (17:01 +0100)
commitf1f45f9191d60c52dbedec717aee0de4a0580bcc
treebaebf708dcdc154fbe4fe903906e11e344a09802
parente3037c2631ecb55996b676ce2c18b9df1858abaa
Fix handling of const patterns

E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.
crates/ra_hir_def/src/adt.rs
crates/ra_hir_def/src/body/lower.rs
crates/ra_hir_def/src/expr.rs
crates/ra_hir_ty/src/infer/pat.rs
crates/ra_hir_ty/src/tests/patterns.rs