Don't refute "()" in let-bindings (fixes #3104).
This commit is contained in:
parent
8694ef6fb3
commit
9b489f6fff
2 changed files with 4 additions and 0 deletions
|
@ -420,6 +420,7 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
|
|||
is_refutable(tcx, sub)
|
||||
}
|
||||
pat_wild | pat_ident(_, _, none) => { false }
|
||||
pat_lit(@{node: expr_lit(@{node: lit_nil, _}), _}) => { false } // "()"
|
||||
pat_lit(_) | pat_range(_, _) => { true }
|
||||
pat_rec(fields, _) => {
|
||||
for fields.each |it| {
|
||||
|
|
3
src/test/run-pass/irrefutable-unit.rs
Normal file
3
src/test/run-pass/irrefutable-unit.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
let ((),()) = ((),());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue