mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-02 21:17:39 +00:00
Don't warn about char
comparisons in constexprs
This commit is contained in:
parent
40feadb966
commit
2060266c16
@ -490,6 +490,17 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
|
||||
_ => span_bug!(e.span, "typeck error"),
|
||||
})
|
||||
}
|
||||
(Char(a), Char(b)) => {
|
||||
Bool(match op.node {
|
||||
hir::BiEq => a == b,
|
||||
hir::BiNe => a != b,
|
||||
hir::BiLt => a < b,
|
||||
hir::BiLe => a <= b,
|
||||
hir::BiGe => a >= b,
|
||||
hir::BiGt => a > b,
|
||||
_ => span_bug!(e.span, "typeck error"),
|
||||
})
|
||||
}
|
||||
|
||||
_ => signal!(e, MiscBinaryOp),
|
||||
}
|
||||
|
@ -13,6 +13,10 @@
|
||||
#![deny(const_err)]
|
||||
|
||||
const X: *const u8 = b"" as _;
|
||||
const Y: bool = 'A' == 'B';
|
||||
const Z: char = 'A';
|
||||
const W: bool = Z <= 'B';
|
||||
|
||||
|
||||
fn main() {
|
||||
let _ = ((-1 as i8) << 8 - 1) as f32;
|
||||
|
Loading…
Reference in New Issue
Block a user