String patterns should have a single constructor of arity 0.
This commit is contained in:
Jakub Wieczorek 2014-06-09 01:28:26 +02:00
parent 9dca26cf92
commit 76f7eeef52
2 changed files with 19 additions and 0 deletions

View file

@ -240,6 +240,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &ctor, pats: Vec<Gc<Pat>>, lty:
&vec(_) => PatVec(pats, None, vec!()),
_ => unreachable!()
},
ty::ty_str => PatWild,
_ => {
assert_eq!(pats.len(), 1);
PatRegion(pats.get(0).clone())
@ -479,6 +480,7 @@ fn constructor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
vec(n) => n,
_ => 0u
},
ty::ty_str => 0u,
_ => 1u
},
ty::ty_enum(eid, _) => {