diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 915bb07df8e0..9905701e058d 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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 } } diff --git a/src/test/compile-fail/unop-neg-bool.rs b/src/test/compile-fail/unop-neg-bool.rs new file mode 100644 index 000000000000..6f1f1aba4593 --- /dev/null +++ b/src/test/compile-fail/unop-neg-bool.rs @@ -0,0 +1,3 @@ +fn main() { + -true; //~ ERROR cannot apply unary operator `-` to type `bool` +}