Skip to content

Commit 6d5428c

Browse files
committed
Let type_is_integral return false for bool type
1 parent 9556629 commit 6d5428c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ pub fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
24352435
24362436
pub fn type_is_integral(ty: t) -> bool {
24372437
match get(ty).sty {
2438-
ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) | ty_bool => true,
2438+
ty_infer(IntVar(_)) | ty_int(_) | ty_uint(_) => true,
24392439
_ => false
24402440
}
24412441
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
-true; //~ ERROR cannot apply unary operator `-` to type `bool`
3+
}

0 commit comments

Comments
 (0)