diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-01-04 22:03:41 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-01-04 22:03:41 +0800 |
commit | d681c0cfa1077e4646a292695b6a7426f2056414 (patch) | |
tree | d1b403908d327e324b67bd8255929f268969fc88 /src | |
parent | fe650f59cddee21a86b1697c6db6b6e1ab89ecaf (diff) | |
download | mrust-d681c0cfa1077e4646a292695b6a7426f2056414.tar.gz |
Typecheck Expressions - Short-circuit wildcard pattern matches
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 301c5d54..a0634022 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -3835,6 +3835,12 @@ void Context::handle_pattern(const Span& sp, ::HIR::Pattern& pat, const ::HIR::T } } + // For `_` patterns, there's nothing to match, so they just succeed with no derefs + if( pattern.m_data.is_Any() ) + { + return true; + } + // If the type is a borrow, then count derefs required for the borrow // - If the first non-borrow inner is an ivar, return false unsigned n_deref = 0; |