auto merge of #4747 : sanxiyn/rust/integral-type, r=graydon

`ty::type_is_integral` returns `true` for `ty_bool`. This causes `-true` to compile, instead of resulting in a type error.
This commit is contained in:
bors 2013-02-04 19:59:06 -08:00
commit 52817092a9
2 changed files with 4 additions and 1 deletions

View file

@ -2435,7 +2435,7 @@ pub fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
pub fn type_is_integral(ty: t) -> bool {
match get(ty).sty {
ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) | ty_bool => true,
ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) => true,
_ => false
}
}

View file

@ -0,0 +1,3 @@
fn main() {
-true; //~ ERROR cannot apply unary operator `-` to type `bool`
}