diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 4a0448c0b2449..1cbaeed9f2519 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 0000000000000..6f1f1aba45930 --- /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` +}