Don't refute "()" in let-bindings (fixes #3104).
This commit is contained in:
@@ -420,6 +420,7 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
|
|||||||
is_refutable(tcx, sub)
|
is_refutable(tcx, sub)
|
||||||
}
|
}
|
||||||
pat_wild | pat_ident(_, _, none) => { false }
|
pat_wild | pat_ident(_, _, none) => { false }
|
||||||
|
pat_lit(@{node: expr_lit(@{node: lit_nil, _}), _}) => { false } // "()"
|
||||||
pat_lit(_) | pat_range(_, _) => { true }
|
pat_lit(_) | pat_range(_, _) => { true }
|
||||||
pat_rec(fields, _) => {
|
pat_rec(fields, _) => {
|
||||||
for fields.each |it| {
|
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 ((),()) = ((),());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user