BinOpKind
This commit is contained in:
parent
3d5753fda1
commit
fe8955bd58
|
@ -3314,24 +3314,24 @@ impl<'a> LoweringContext<'a> {
|
|||
fn lower_binop(&mut self, b: BinOp) -> hir::BinOp {
|
||||
Spanned {
|
||||
node: match b.node {
|
||||
BinOpKind::Add => hir::BiAdd,
|
||||
BinOpKind::Sub => hir::BiSub,
|
||||
BinOpKind::Mul => hir::BiMul,
|
||||
BinOpKind::Div => hir::BiDiv,
|
||||
BinOpKind::Rem => hir::BiRem,
|
||||
BinOpKind::And => hir::BiAnd,
|
||||
BinOpKind::Or => hir::BiOr,
|
||||
BinOpKind::BitXor => hir::BiBitXor,
|
||||
BinOpKind::BitAnd => hir::BiBitAnd,
|
||||
BinOpKind::BitOr => hir::BiBitOr,
|
||||
BinOpKind::Shl => hir::BiShl,
|
||||
BinOpKind::Shr => hir::BiShr,
|
||||
BinOpKind::Eq => hir::BiEq,
|
||||
BinOpKind::Lt => hir::BiLt,
|
||||
BinOpKind::Le => hir::BiLe,
|
||||
BinOpKind::Ne => hir::BiNe,
|
||||
BinOpKind::Ge => hir::BiGe,
|
||||
BinOpKind::Gt => hir::BiGt,
|
||||
BinOpKind::Add => hir::BinOpKind::Add,
|
||||
BinOpKind::Sub => hir::BinOpKind::Sub,
|
||||
BinOpKind::Mul => hir::BinOpKind::Mul,
|
||||
BinOpKind::Div => hir::BinOpKind::Div,
|
||||
BinOpKind::Rem => hir::BinOpKind::Rem,
|
||||
BinOpKind::And => hir::BinOpKind::And,
|
||||
BinOpKind::Or => hir::BinOpKind::Or,
|
||||
BinOpKind::BitXor => hir::BinOpKind::BitXor,
|
||||
BinOpKind::BitAnd => hir::BinOpKind::BitAnd,
|
||||
BinOpKind::BitOr => hir::BinOpKind::BitOr,
|
||||
BinOpKind::Shl => hir::BinOpKind::Shl,
|
||||
BinOpKind::Shr => hir::BinOpKind::Shr,
|
||||
BinOpKind::Eq => hir::BinOpKind::Eq,
|
||||
BinOpKind::Lt => hir::BinOpKind::Lt,
|
||||
BinOpKind::Le => hir::BinOpKind::Le,
|
||||
BinOpKind::Ne => hir::BinOpKind::Ne,
|
||||
BinOpKind::Ge => hir::BinOpKind::Ge,
|
||||
BinOpKind::Gt => hir::BinOpKind::Gt,
|
||||
},
|
||||
span: b.span,
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
// The Rust HIR.
|
||||
|
||||
pub use self::BinOp_::*;
|
||||
pub use self::BlockCheckMode::*;
|
||||
pub use self::CaptureClause::*;
|
||||
pub use self::Decl_::*;
|
||||
|
@ -941,98 +940,103 @@ impl Mutability {
|
|||
}
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)]
|
||||
pub enum BinOp_ {
|
||||
pub enum BinOpKind {
|
||||
/// The `+` operator (addition)
|
||||
BiAdd,
|
||||
Add,
|
||||
/// The `-` operator (subtraction)
|
||||
BiSub,
|
||||
Sub,
|
||||
/// The `*` operator (multiplication)
|
||||
BiMul,
|
||||
Mul,
|
||||
/// The `/` operator (division)
|
||||
BiDiv,
|
||||
Div,
|
||||
/// The `%` operator (modulus)
|
||||
BiRem,
|
||||
Rem,
|
||||
/// The `&&` operator (logical and)
|
||||
BiAnd,
|
||||
And,
|
||||
/// The `||` operator (logical or)
|
||||
BiOr,
|
||||
Or,
|
||||
/// The `^` operator (bitwise xor)
|
||||
BiBitXor,
|
||||
BitXor,
|
||||
/// The `&` operator (bitwise and)
|
||||
BiBitAnd,
|
||||
BitAnd,
|
||||
/// The `|` operator (bitwise or)
|
||||
BiBitOr,
|
||||
BitOr,
|
||||
/// The `<<` operator (shift left)
|
||||
BiShl,
|
||||
Shl,
|
||||
/// The `>>` operator (shift right)
|
||||
BiShr,
|
||||
Shr,
|
||||
/// The `==` operator (equality)
|
||||
BiEq,
|
||||
Eq,
|
||||
/// The `<` operator (less than)
|
||||
BiLt,
|
||||
Lt,
|
||||
/// The `<=` operator (less than or equal to)
|
||||
BiLe,
|
||||
Le,
|
||||
/// The `!=` operator (not equal to)
|
||||
BiNe,
|
||||
Ne,
|
||||
/// The `>=` operator (greater than or equal to)
|
||||
BiGe,
|
||||
Ge,
|
||||
/// The `>` operator (greater than)
|
||||
BiGt,
|
||||
Gt,
|
||||
}
|
||||
|
||||
impl BinOp_ {
|
||||
impl BinOpKind {
|
||||
pub fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
BiAdd => "+",
|
||||
BiSub => "-",
|
||||
BiMul => "*",
|
||||
BiDiv => "/",
|
||||
BiRem => "%",
|
||||
BiAnd => "&&",
|
||||
BiOr => "||",
|
||||
BiBitXor => "^",
|
||||
BiBitAnd => "&",
|
||||
BiBitOr => "|",
|
||||
BiShl => "<<",
|
||||
BiShr => ">>",
|
||||
BiEq => "==",
|
||||
BiLt => "<",
|
||||
BiLe => "<=",
|
||||
BiNe => "!=",
|
||||
BiGe => ">=",
|
||||
BiGt => ">",
|
||||
BinOpKind::Add => "+",
|
||||
BinOpKind::Sub => "-",
|
||||
BinOpKind::Mul => "*",
|
||||
BinOpKind::Div => "/",
|
||||
BinOpKind::Rem => "%",
|
||||
BinOpKind::And => "&&",
|
||||
BinOpKind::Or => "||",
|
||||
BinOpKind::BitXor => "^",
|
||||
BinOpKind::BitAnd => "&",
|
||||
BinOpKind::BitOr => "|",
|
||||
BinOpKind::Shl => "<<",
|
||||
BinOpKind::Shr => ">>",
|
||||
BinOpKind::Eq => "==",
|
||||
BinOpKind::Lt => "<",
|
||||
BinOpKind::Le => "<=",
|
||||
BinOpKind::Ne => "!=",
|
||||
BinOpKind::Ge => ">=",
|
||||
BinOpKind::Gt => ">",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_lazy(self) -> bool {
|
||||
match self {
|
||||
BiAnd | BiOr => true,
|
||||
BinOpKind::And | BinOpKind::Or => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_shift(self) -> bool {
|
||||
match self {
|
||||
BiShl | BiShr => true,
|
||||
BinOpKind::Shl | BinOpKind::Shr => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_comparison(self) -> bool {
|
||||
match self {
|
||||
BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
|
||||
BiAnd |
|
||||
BiOr |
|
||||
BiAdd |
|
||||
BiSub |
|
||||
BiMul |
|
||||
BiDiv |
|
||||
BiRem |
|
||||
BiBitXor |
|
||||
BiBitAnd |
|
||||
BiBitOr |
|
||||
BiShl |
|
||||
BiShr => false,
|
||||
BinOpKind::Eq |
|
||||
BinOpKind::Lt |
|
||||
BinOpKind::Le |
|
||||
BinOpKind::Ne |
|
||||
BinOpKind::Gt |
|
||||
BinOpKind::Ge => true,
|
||||
BinOpKind::And |
|
||||
BinOpKind::Or |
|
||||
BinOpKind::Add |
|
||||
BinOpKind::Sub |
|
||||
BinOpKind::Mul |
|
||||
BinOpKind::Div |
|
||||
BinOpKind::Rem |
|
||||
BinOpKind::BitXor |
|
||||
BinOpKind::BitAnd |
|
||||
BinOpKind::BitOr |
|
||||
BinOpKind::Shl |
|
||||
BinOpKind::Shr => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1042,32 +1046,32 @@ impl BinOp_ {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<ast::BinOpKind> for BinOp_ {
|
||||
impl Into<ast::BinOpKind> for BinOpKind {
|
||||
fn into(self) -> ast::BinOpKind {
|
||||
match self {
|
||||
BiAdd => ast::BinOpKind::Add,
|
||||
BiSub => ast::BinOpKind::Sub,
|
||||
BiMul => ast::BinOpKind::Mul,
|
||||
BiDiv => ast::BinOpKind::Div,
|
||||
BiRem => ast::BinOpKind::Rem,
|
||||
BiAnd => ast::BinOpKind::And,
|
||||
BiOr => ast::BinOpKind::Or,
|
||||
BiBitXor => ast::BinOpKind::BitXor,
|
||||
BiBitAnd => ast::BinOpKind::BitAnd,
|
||||
BiBitOr => ast::BinOpKind::BitOr,
|
||||
BiShl => ast::BinOpKind::Shl,
|
||||
BiShr => ast::BinOpKind::Shr,
|
||||
BiEq => ast::BinOpKind::Eq,
|
||||
BiLt => ast::BinOpKind::Lt,
|
||||
BiLe => ast::BinOpKind::Le,
|
||||
BiNe => ast::BinOpKind::Ne,
|
||||
BiGe => ast::BinOpKind::Ge,
|
||||
BiGt => ast::BinOpKind::Gt,
|
||||
BinOpKind::Add => ast::BinOpKind::Add,
|
||||
BinOpKind::Sub => ast::BinOpKind::Sub,
|
||||
BinOpKind::Mul => ast::BinOpKind::Mul,
|
||||
BinOpKind::Div => ast::BinOpKind::Div,
|
||||
BinOpKind::Rem => ast::BinOpKind::Rem,
|
||||
BinOpKind::And => ast::BinOpKind::And,
|
||||
BinOpKind::Or => ast::BinOpKind::Or,
|
||||
BinOpKind::BitXor => ast::BinOpKind::BitXor,
|
||||
BinOpKind::BitAnd => ast::BinOpKind::BitAnd,
|
||||
BinOpKind::BitOr => ast::BinOpKind::BitOr,
|
||||
BinOpKind::Shl => ast::BinOpKind::Shl,
|
||||
BinOpKind::Shr => ast::BinOpKind::Shr,
|
||||
BinOpKind::Eq => ast::BinOpKind::Eq,
|
||||
BinOpKind::Lt => ast::BinOpKind::Lt,
|
||||
BinOpKind::Le => ast::BinOpKind::Le,
|
||||
BinOpKind::Ne => ast::BinOpKind::Ne,
|
||||
BinOpKind::Ge => ast::BinOpKind::Ge,
|
||||
BinOpKind::Gt => ast::BinOpKind::Gt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type BinOp = Spanned<BinOp_>;
|
||||
pub type BinOp = Spanned<BinOpKind>;
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)]
|
||||
pub enum UnOp {
|
||||
|
|
|
@ -1292,8 +1292,8 @@ impl<'a> State<'a> {
|
|||
// These cases need parens: `x as i32 < y` has the parser thinking that `i32 < y` is
|
||||
// the beginning of a path type. It starts trying to parse `x as (i32 < y ...` instead
|
||||
// of `(x as i32) < ...`. We need to convince it _not_ to do that.
|
||||
(&hir::ExprCast { .. }, hir::BinOp_::BiLt) |
|
||||
(&hir::ExprCast { .. }, hir::BinOp_::BiShl) => parser::PREC_FORCE_PAREN,
|
||||
(&hir::ExprCast { .. }, hir::BinOpKind::Lt) |
|
||||
(&hir::ExprCast { .. }, hir::BinOpKind::Shl) => parser::PREC_FORCE_PAREN,
|
||||
_ => left_prec,
|
||||
};
|
||||
|
||||
|
@ -2413,30 +2413,30 @@ fn stmt_ends_with_semi(stmt: &hir::Stmt_) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn bin_op_to_assoc_op(op: hir::BinOp_) -> AssocOp {
|
||||
use hir::BinOp_::*;
|
||||
fn bin_op_to_assoc_op(op: hir::BinOpKind) -> AssocOp {
|
||||
use hir::BinOpKind::*;
|
||||
match op {
|
||||
BiAdd => AssocOp::Add,
|
||||
BiSub => AssocOp::Subtract,
|
||||
BiMul => AssocOp::Multiply,
|
||||
BiDiv => AssocOp::Divide,
|
||||
BiRem => AssocOp::Modulus,
|
||||
Add => AssocOp::Add,
|
||||
Sub => AssocOp::Subtract,
|
||||
Mul => AssocOp::Multiply,
|
||||
Div => AssocOp::Divide,
|
||||
Rem => AssocOp::Modulus,
|
||||
|
||||
BiAnd => AssocOp::LAnd,
|
||||
BiOr => AssocOp::LOr,
|
||||
And => AssocOp::LAnd,
|
||||
Or => AssocOp::LOr,
|
||||
|
||||
BiBitXor => AssocOp::BitXor,
|
||||
BiBitAnd => AssocOp::BitAnd,
|
||||
BiBitOr => AssocOp::BitOr,
|
||||
BiShl => AssocOp::ShiftLeft,
|
||||
BiShr => AssocOp::ShiftRight,
|
||||
BitXor => AssocOp::BitXor,
|
||||
BitAnd => AssocOp::BitAnd,
|
||||
BitOr => AssocOp::BitOr,
|
||||
Shl => AssocOp::ShiftLeft,
|
||||
Shr => AssocOp::ShiftRight,
|
||||
|
||||
BiEq => AssocOp::Equal,
|
||||
BiLt => AssocOp::Less,
|
||||
BiLe => AssocOp::LessEqual,
|
||||
BiNe => AssocOp::NotEqual,
|
||||
BiGe => AssocOp::GreaterEqual,
|
||||
BiGt => AssocOp::Greater,
|
||||
Eq => AssocOp::Equal,
|
||||
Lt => AssocOp::Less,
|
||||
Le => AssocOp::LessEqual,
|
||||
Ne => AssocOp::NotEqual,
|
||||
Ge => AssocOp::GreaterEqual,
|
||||
Gt => AssocOp::Greater,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -437,28 +437,28 @@ impl_stable_hash_for!(enum hir::PatKind {
|
|||
Slice(one, two, three)
|
||||
});
|
||||
|
||||
impl_stable_hash_for!(enum hir::BinOp_ {
|
||||
BiAdd,
|
||||
BiSub,
|
||||
BiMul,
|
||||
BiDiv,
|
||||
BiRem,
|
||||
BiAnd,
|
||||
BiOr,
|
||||
BiBitXor,
|
||||
BiBitAnd,
|
||||
BiBitOr,
|
||||
BiShl,
|
||||
BiShr,
|
||||
BiEq,
|
||||
BiLt,
|
||||
BiLe,
|
||||
BiNe,
|
||||
BiGe,
|
||||
BiGt
|
||||
impl_stable_hash_for!(enum hir::BinOpKind {
|
||||
Add,
|
||||
Sub,
|
||||
Mul,
|
||||
Div,
|
||||
Rem,
|
||||
And,
|
||||
Or,
|
||||
BitXor,
|
||||
BitAnd,
|
||||
BitOr,
|
||||
Shl,
|
||||
Shr,
|
||||
Eq,
|
||||
Lt,
|
||||
Le,
|
||||
Ne,
|
||||
Ge,
|
||||
Gt
|
||||
});
|
||||
|
||||
impl_stable_hash_for_spanned!(hir::BinOp_);
|
||||
impl_stable_hash_for_spanned!(hir::BinOpKind);
|
||||
|
||||
impl_stable_hash_for!(enum hir::UnOp {
|
||||
UnDeref,
|
||||
|
|
|
@ -943,8 +943,8 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr:
|
|||
// scopes, meaning that temporaries cannot outlive them.
|
||||
// This ensures fixed size stacks.
|
||||
|
||||
hir::ExprBinary(codemap::Spanned { node: hir::BiAnd, .. }, _, ref r) |
|
||||
hir::ExprBinary(codemap::Spanned { node: hir::BiOr, .. }, _, ref r) => {
|
||||
hir::ExprKind::Binary(codemap::Spanned { node: hir::BinOpKind::And, .. }, _, ref r) |
|
||||
hir::ExprKind::Binary(codemap::Spanned { node: hir::BinOpKind::Or, .. }, _, ref r) => {
|
||||
// For shortcircuiting operators, mark the RHS as a terminating
|
||||
// scope since it only executes conditionally.
|
||||
terminating(r.hir_id.local_id);
|
||||
|
|
|
@ -256,24 +256,24 @@ impl BorrowKind {
|
|||
}
|
||||
|
||||
impl BinOp {
|
||||
pub fn to_hir_binop(self) -> hir::BinOp_ {
|
||||
pub fn to_hir_binop(self) -> hir::BinOpKind {
|
||||
match self {
|
||||
BinOp::Add => hir::BinOp_::BiAdd,
|
||||
BinOp::Sub => hir::BinOp_::BiSub,
|
||||
BinOp::Mul => hir::BinOp_::BiMul,
|
||||
BinOp::Div => hir::BinOp_::BiDiv,
|
||||
BinOp::Rem => hir::BinOp_::BiRem,
|
||||
BinOp::BitXor => hir::BinOp_::BiBitXor,
|
||||
BinOp::BitAnd => hir::BinOp_::BiBitAnd,
|
||||
BinOp::BitOr => hir::BinOp_::BiBitOr,
|
||||
BinOp::Shl => hir::BinOp_::BiShl,
|
||||
BinOp::Shr => hir::BinOp_::BiShr,
|
||||
BinOp::Eq => hir::BinOp_::BiEq,
|
||||
BinOp::Ne => hir::BinOp_::BiNe,
|
||||
BinOp::Lt => hir::BinOp_::BiLt,
|
||||
BinOp::Gt => hir::BinOp_::BiGt,
|
||||
BinOp::Le => hir::BinOp_::BiLe,
|
||||
BinOp::Ge => hir::BinOp_::BiGe,
|
||||
BinOp::Add => hir::BinOpKind::Add,
|
||||
BinOp::Sub => hir::BinOpKind::Sub,
|
||||
BinOp::Mul => hir::BinOpKind::Mul,
|
||||
BinOp::Div => hir::BinOpKind::Div,
|
||||
BinOp::Rem => hir::BinOpKind::Rem,
|
||||
BinOp::BitXor => hir::BinOpKind::BitXor,
|
||||
BinOp::BitAnd => hir::BinOpKind::BitAnd,
|
||||
BinOp::BitOr => hir::BinOpKind::BitOr,
|
||||
BinOp::Shl => hir::BinOpKind::Shl,
|
||||
BinOp::Shr => hir::BinOpKind::Shr,
|
||||
BinOp::Eq => hir::BinOpKind::Eq,
|
||||
BinOp::Ne => hir::BinOpKind::Ne,
|
||||
BinOp::Lt => hir::BinOpKind::Lt,
|
||||
BinOp::Gt => hir::BinOpKind::Gt,
|
||||
BinOp::Le => hir::BinOpKind::Le,
|
||||
BinOp::Ge => hir::BinOpKind::Ge,
|
||||
BinOp::Offset => unreachable!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,16 +124,16 @@ impl<'a, 'tcx> Drop for StatRecorder<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn bin_op_to_icmp_predicate(op: hir::BinOp_,
|
||||
pub fn bin_op_to_icmp_predicate(op: hir::BinOpKind,
|
||||
signed: bool)
|
||||
-> llvm::IntPredicate {
|
||||
match op {
|
||||
hir::BiEq => llvm::IntEQ,
|
||||
hir::BiNe => llvm::IntNE,
|
||||
hir::BiLt => if signed { llvm::IntSLT } else { llvm::IntULT },
|
||||
hir::BiLe => if signed { llvm::IntSLE } else { llvm::IntULE },
|
||||
hir::BiGt => if signed { llvm::IntSGT } else { llvm::IntUGT },
|
||||
hir::BiGe => if signed { llvm::IntSGE } else { llvm::IntUGE },
|
||||
hir::BinOpKind::Eq => llvm::IntEQ,
|
||||
hir::BinOpKind::Ne => llvm::IntNE,
|
||||
hir::BinOpKind::Lt => if signed { llvm::IntSLT } else { llvm::IntULT },
|
||||
hir::BinOpKind::Le => if signed { llvm::IntSLE } else { llvm::IntULE },
|
||||
hir::BinOpKind::Gt => if signed { llvm::IntSGT } else { llvm::IntUGT },
|
||||
hir::BinOpKind::Ge => if signed { llvm::IntSGE } else { llvm::IntUGE },
|
||||
op => {
|
||||
bug!("comparison_op_to_icmp_predicate: expected comparison operator, \
|
||||
found {:?}",
|
||||
|
@ -142,14 +142,14 @@ pub fn bin_op_to_icmp_predicate(op: hir::BinOp_,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn bin_op_to_fcmp_predicate(op: hir::BinOp_) -> llvm::RealPredicate {
|
||||
pub fn bin_op_to_fcmp_predicate(op: hir::BinOpKind) -> llvm::RealPredicate {
|
||||
match op {
|
||||
hir::BiEq => llvm::RealOEQ,
|
||||
hir::BiNe => llvm::RealUNE,
|
||||
hir::BiLt => llvm::RealOLT,
|
||||
hir::BiLe => llvm::RealOLE,
|
||||
hir::BiGt => llvm::RealOGT,
|
||||
hir::BiGe => llvm::RealOGE,
|
||||
hir::BinOpKind::Eq => llvm::RealOEQ,
|
||||
hir::BinOpKind::Ne => llvm::RealUNE,
|
||||
hir::BinOpKind::Lt => llvm::RealOLT,
|
||||
hir::BinOpKind::Le => llvm::RealOLE,
|
||||
hir::BinOpKind::Gt => llvm::RealOGT,
|
||||
hir::BinOpKind::Ge => llvm::RealOGE,
|
||||
op => {
|
||||
bug!("comparison_op_to_fcmp_predicate: expected comparison operator, \
|
||||
found {:?}",
|
||||
|
@ -164,7 +164,7 @@ pub fn compare_simd_types<'a, 'tcx>(
|
|||
rhs: ValueRef,
|
||||
t: Ty<'tcx>,
|
||||
ret_ty: Type,
|
||||
op: hir::BinOp_
|
||||
op: hir::BinOpKind
|
||||
) -> ValueRef {
|
||||
let signed = match t.sty {
|
||||
ty::TyFloat(_) => {
|
||||
|
@ -332,12 +332,12 @@ pub fn coerce_unsized_into<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
|||
}
|
||||
|
||||
pub fn cast_shift_expr_rhs(
|
||||
cx: &Builder, op: hir::BinOp_, lhs: ValueRef, rhs: ValueRef
|
||||
cx: &Builder, op: hir::BinOpKind, lhs: ValueRef, rhs: ValueRef
|
||||
) -> ValueRef {
|
||||
cast_shift_rhs(op, lhs, rhs, |a, b| cx.trunc(a, b), |a, b| cx.zext(a, b))
|
||||
}
|
||||
|
||||
fn cast_shift_rhs<F, G>(op: hir::BinOp_,
|
||||
fn cast_shift_rhs<F, G>(op: hir::BinOpKind,
|
||||
lhs: ValueRef,
|
||||
rhs: ValueRef,
|
||||
trunc: F,
|
||||
|
|
|
@ -350,7 +350,7 @@ pub fn build_unchecked_lshift<'a, 'tcx>(
|
|||
lhs: ValueRef,
|
||||
rhs: ValueRef
|
||||
) -> ValueRef {
|
||||
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOp_::BiShl, lhs, rhs);
|
||||
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shl, lhs, rhs);
|
||||
// #1877, #10183: Ensure that input is always valid
|
||||
let rhs = shift_mask_rhs(bx, rhs);
|
||||
bx.shl(lhs, rhs)
|
||||
|
@ -359,7 +359,7 @@ pub fn build_unchecked_lshift<'a, 'tcx>(
|
|||
pub fn build_unchecked_rshift<'a, 'tcx>(
|
||||
bx: &Builder<'a, 'tcx>, lhs_t: Ty<'tcx>, lhs: ValueRef, rhs: ValueRef
|
||||
) -> ValueRef {
|
||||
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOp_::BiShr, lhs, rhs);
|
||||
let rhs = base::cast_shift_expr_rhs(bx, hir::BinOpKind::Shr, lhs, rhs);
|
||||
// #1877, #10183: Ensure that input is always valid
|
||||
let rhs = shift_mask_rhs(bx, rhs);
|
||||
let is_signed = lhs_t.is_signed();
|
||||
|
|
|
@ -1022,12 +1022,12 @@ fn generic_simd_intrinsic<'a, 'tcx>(
|
|||
let in_len = arg_tys[0].simd_size(tcx);
|
||||
|
||||
let comparison = match name {
|
||||
"simd_eq" => Some(hir::BiEq),
|
||||
"simd_ne" => Some(hir::BiNe),
|
||||
"simd_lt" => Some(hir::BiLt),
|
||||
"simd_le" => Some(hir::BiLe),
|
||||
"simd_gt" => Some(hir::BiGt),
|
||||
"simd_ge" => Some(hir::BiGe),
|
||||
"simd_eq" => Some(hir::BinOpKind::Eq),
|
||||
"simd_ne" => Some(hir::BinOpKind::Ne),
|
||||
"simd_lt" => Some(hir::BinOpKind::Lt),
|
||||
"simd_le" => Some(hir::BinOpKind::Le),
|
||||
"simd_gt" => Some(hir::BinOpKind::Gt),
|
||||
"simd_ge" => Some(hir::BinOpKind::Ge),
|
||||
_ => None
|
||||
};
|
||||
|
||||
|
|
|
@ -194,11 +194,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
|
||||
fn is_valid<T: cmp::PartialOrd>(binop: hir::BinOp, v: T, min: T, max: T) -> bool {
|
||||
match binop.node {
|
||||
hir::BiLt => v > min && v <= max,
|
||||
hir::BiLe => v >= min && v < max,
|
||||
hir::BiGt => v >= min && v < max,
|
||||
hir::BiGe => v > min && v <= max,
|
||||
hir::BiEq | hir::BiNe => v >= min && v <= max,
|
||||
hir::BinOpKind::Lt => v > min && v <= max,
|
||||
hir::BinOpKind::Le => v >= min && v < max,
|
||||
hir::BinOpKind::Gt => v >= min && v < max,
|
||||
hir::BinOpKind::Ge => v > min && v <= max,
|
||||
hir::BinOpKind::Eq | hir::BinOpKind::Ne => v >= min && v <= max,
|
||||
_ => bug!(),
|
||||
}
|
||||
}
|
||||
|
@ -206,10 +206,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
fn rev_binop(binop: hir::BinOp) -> hir::BinOp {
|
||||
codemap::respan(binop.span,
|
||||
match binop.node {
|
||||
hir::BiLt => hir::BiGt,
|
||||
hir::BiLe => hir::BiGe,
|
||||
hir::BiGt => hir::BiLt,
|
||||
hir::BiGe => hir::BiLe,
|
||||
hir::BinOpKind::Lt => hir::BinOpKind::Gt,
|
||||
hir::BinOpKind::Le => hir::BinOpKind::Ge,
|
||||
hir::BinOpKind::Gt => hir::BinOpKind::Lt,
|
||||
hir::BinOpKind::Ge => hir::BinOpKind::Le,
|
||||
_ => return binop,
|
||||
})
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
|
|||
|
||||
fn is_comparison(binop: hir::BinOp) -> bool {
|
||||
match binop.node {
|
||||
hir::BiEq | hir::BiLt | hir::BiLe | hir::BiNe | hir::BiGe | hir::BiGt => true,
|
||||
hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,16 +102,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
|
|||
// attribute which does exist on the comparison trait methods
|
||||
hir::ExprBinary(bin_op, ..) => {
|
||||
match bin_op.node {
|
||||
hir::BiEq | hir::BiLt | hir::BiLe | hir::BiNe | hir::BiGe | hir::BiGt => {
|
||||
hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => {
|
||||
Some("comparison")
|
||||
},
|
||||
hir::BiAdd | hir::BiSub | hir::BiDiv | hir::BiMul | hir::BiRem => {
|
||||
hir::BinOpKind::Add | hir::BinOpKind::Sub | hir::BinOpKind::Div | hir::BinOpKind::Mul | hir::BinOpKind::Rem => {
|
||||
Some("arithmetic operation")
|
||||
},
|
||||
hir::BiAnd | hir::BiOr => {
|
||||
hir::BinOpKind::And | hir::BinOpKind::Or => {
|
||||
Some("logical operation")
|
||||
},
|
||||
hir::BiBitXor | hir::BiBitAnd | hir::BiBitOr | hir::BiShl | hir::BiShr => {
|
||||
hir::BinOpKind::BitXor | hir::BinOpKind::BitAnd | hir::BinOpKind::BitOr | hir::BinOpKind::Shl | hir::BinOpKind::Shr => {
|
||||
Some("bitwise operation")
|
||||
},
|
||||
}
|
||||
|
|
|
@ -325,14 +325,14 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
|
|||
match (op.node, cx.constness) {
|
||||
// FIXME(eddyb) use logical ops in constants when
|
||||
// they can handle that kind of control-flow.
|
||||
(hir::BinOp_::BiAnd, hir::Constness::Const) => {
|
||||
(hir::BinOpKind::And, hir::Constness::Const) => {
|
||||
ExprKind::Binary {
|
||||
op: BinOp::BitAnd,
|
||||
lhs: lhs.to_ref(),
|
||||
rhs: rhs.to_ref(),
|
||||
}
|
||||
}
|
||||
(hir::BinOp_::BiOr, hir::Constness::Const) => {
|
||||
(hir::BinOpKind::Or, hir::Constness::Const) => {
|
||||
ExprKind::Binary {
|
||||
op: BinOp::BitOr,
|
||||
lhs: lhs.to_ref(),
|
||||
|
@ -340,14 +340,14 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
(hir::BinOp_::BiAnd, hir::Constness::NotConst) => {
|
||||
(hir::BinOpKind::And, hir::Constness::NotConst) => {
|
||||
ExprKind::LogicalOp {
|
||||
op: LogicalOp::And,
|
||||
lhs: lhs.to_ref(),
|
||||
rhs: rhs.to_ref(),
|
||||
}
|
||||
}
|
||||
(hir::BinOp_::BiOr, hir::Constness::NotConst) => {
|
||||
(hir::BinOpKind::Or, hir::Constness::NotConst) => {
|
||||
ExprKind::LogicalOp {
|
||||
op: LogicalOp::Or,
|
||||
lhs: lhs.to_ref(),
|
||||
|
@ -930,24 +930,24 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
|
|||
}
|
||||
|
||||
|
||||
fn bin_op(op: hir::BinOp_) -> BinOp {
|
||||
fn bin_op(op: hir::BinOpKind) -> BinOp {
|
||||
match op {
|
||||
hir::BinOp_::BiAdd => BinOp::Add,
|
||||
hir::BinOp_::BiSub => BinOp::Sub,
|
||||
hir::BinOp_::BiMul => BinOp::Mul,
|
||||
hir::BinOp_::BiDiv => BinOp::Div,
|
||||
hir::BinOp_::BiRem => BinOp::Rem,
|
||||
hir::BinOp_::BiBitXor => BinOp::BitXor,
|
||||
hir::BinOp_::BiBitAnd => BinOp::BitAnd,
|
||||
hir::BinOp_::BiBitOr => BinOp::BitOr,
|
||||
hir::BinOp_::BiShl => BinOp::Shl,
|
||||
hir::BinOp_::BiShr => BinOp::Shr,
|
||||
hir::BinOp_::BiEq => BinOp::Eq,
|
||||
hir::BinOp_::BiLt => BinOp::Lt,
|
||||
hir::BinOp_::BiLe => BinOp::Le,
|
||||
hir::BinOp_::BiNe => BinOp::Ne,
|
||||
hir::BinOp_::BiGe => BinOp::Ge,
|
||||
hir::BinOp_::BiGt => BinOp::Gt,
|
||||
hir::BinOpKind::Add => BinOp::Add,
|
||||
hir::BinOpKind::Sub => BinOp::Sub,
|
||||
hir::BinOpKind::Mul => BinOp::Mul,
|
||||
hir::BinOpKind::Div => BinOp::Div,
|
||||
hir::BinOpKind::Rem => BinOp::Rem,
|
||||
hir::BinOpKind::BitXor => BinOp::BitXor,
|
||||
hir::BinOpKind::BitAnd => BinOp::BitAnd,
|
||||
hir::BinOpKind::BitOr => BinOp::BitOr,
|
||||
hir::BinOpKind::Shl => BinOp::Shl,
|
||||
hir::BinOpKind::Shr => BinOp::Shr,
|
||||
hir::BinOpKind::Eq => BinOp::Eq,
|
||||
hir::BinOpKind::Lt => BinOp::Lt,
|
||||
hir::BinOpKind::Le => BinOp::Le,
|
||||
hir::BinOpKind::Ne => BinOp::Ne,
|
||||
hir::BinOpKind::Ge => BinOp::Ge,
|
||||
hir::BinOpKind::Gt => BinOp::Gt,
|
||||
_ => bug!("no equivalent for ast binop {:?}", op),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,9 +356,9 @@ fn check_expr_kind<'a, 'tcx>(
|
|||
}
|
||||
match v.tables.node_id_to_type(lhs.hir_id).sty {
|
||||
ty::TyRawPtr(_) => {
|
||||
assert!(op.node == hir::BiEq || op.node == hir::BiNe ||
|
||||
op.node == hir::BiLe || op.node == hir::BiLt ||
|
||||
op.node == hir::BiGe || op.node == hir::BiGt);
|
||||
assert!(op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne ||
|
||||
op.node == hir::BinOpKind::Le || op.node == hir::BinOpKind::Lt ||
|
||||
op.node == hir::BinOpKind::Ge || op.node == hir::BinOpKind::Gt);
|
||||
|
||||
NotPromotable
|
||||
}
|
||||
|
|
|
@ -285,20 +285,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
let missing_trait = match op.node {
|
||||
hir::BiAdd => Some("std::ops::AddAssign"),
|
||||
hir::BiSub => Some("std::ops::SubAssign"),
|
||||
hir::BiMul => Some("std::ops::MulAssign"),
|
||||
hir::BiDiv => Some("std::ops::DivAssign"),
|
||||
hir::BiRem => Some("std::ops::RemAssign"),
|
||||
hir::BiBitAnd => Some("std::ops::BitAndAssign"),
|
||||
hir::BiBitXor => Some("std::ops::BitXorAssign"),
|
||||
hir::BiBitOr => Some("std::ops::BitOrAssign"),
|
||||
hir::BiShl => Some("std::ops::ShlAssign"),
|
||||
hir::BiShr => Some("std::ops::ShrAssign"),
|
||||
hir::BinOpKind::Add => Some("std::ops::AddAssign"),
|
||||
hir::BinOpKind::Sub => Some("std::ops::SubAssign"),
|
||||
hir::BinOpKind::Mul => Some("std::ops::MulAssign"),
|
||||
hir::BinOpKind::Div => Some("std::ops::DivAssign"),
|
||||
hir::BinOpKind::Rem => Some("std::ops::RemAssign"),
|
||||
hir::BinOpKind::BitAnd => Some("std::ops::BitAndAssign"),
|
||||
hir::BinOpKind::BitXor => Some("std::ops::BitXorAssign"),
|
||||
hir::BinOpKind::BitOr => Some("std::ops::BitOrAssign"),
|
||||
hir::BinOpKind::Shl => Some("std::ops::ShlAssign"),
|
||||
hir::BinOpKind::Shr => Some("std::ops::ShrAssign"),
|
||||
_ => None
|
||||
};
|
||||
if let Some(missing_trait) = missing_trait {
|
||||
if op.node == hir::BiAdd &&
|
||||
if op.node == hir::BinOpKind::Add &&
|
||||
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
||||
rhs_ty, &mut err) {
|
||||
// This has nothing here because it means we did string
|
||||
|
@ -353,23 +353,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
let missing_trait = match op.node {
|
||||
hir::BiAdd => Some("std::ops::Add"),
|
||||
hir::BiSub => Some("std::ops::Sub"),
|
||||
hir::BiMul => Some("std::ops::Mul"),
|
||||
hir::BiDiv => Some("std::ops::Div"),
|
||||
hir::BiRem => Some("std::ops::Rem"),
|
||||
hir::BiBitAnd => Some("std::ops::BitAnd"),
|
||||
hir::BiBitXor => Some("std::ops::BitXor"),
|
||||
hir::BiBitOr => Some("std::ops::BitOr"),
|
||||
hir::BiShl => Some("std::ops::Shl"),
|
||||
hir::BiShr => Some("std::ops::Shr"),
|
||||
hir::BiEq | hir::BiNe => Some("std::cmp::PartialEq"),
|
||||
hir::BiLt | hir::BiLe | hir::BiGt | hir::BiGe =>
|
||||
hir::BinOpKind::Add => Some("std::ops::Add"),
|
||||
hir::BinOpKind::Sub => Some("std::ops::Sub"),
|
||||
hir::BinOpKind::Mul => Some("std::ops::Mul"),
|
||||
hir::BinOpKind::Div => Some("std::ops::Div"),
|
||||
hir::BinOpKind::Rem => Some("std::ops::Rem"),
|
||||
hir::BinOpKind::BitAnd => Some("std::ops::BitAnd"),
|
||||
hir::BinOpKind::BitXor => Some("std::ops::BitXor"),
|
||||
hir::BinOpKind::BitOr => Some("std::ops::BitOr"),
|
||||
hir::BinOpKind::Shl => Some("std::ops::Shl"),
|
||||
hir::BinOpKind::Shr => Some("std::ops::Shr"),
|
||||
hir::BinOpKind::Eq | hir::BinOpKind::Ne => Some("std::cmp::PartialEq"),
|
||||
hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Gt | hir::BinOpKind::Ge =>
|
||||
Some("std::cmp::PartialOrd"),
|
||||
_ => None
|
||||
};
|
||||
if let Some(missing_trait) = missing_trait {
|
||||
if op.node == hir::BiAdd &&
|
||||
if op.node == hir::BinOpKind::Add &&
|
||||
self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
|
||||
rhs_ty, &mut err) {
|
||||
// This has nothing here because it means we did string
|
||||
|
@ -508,20 +508,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
};
|
||||
let (opname, trait_did) = if let Op::Binary(op, IsAssign::Yes) = op {
|
||||
match op.node {
|
||||
hir::BiAdd => ("add_assign", lang.add_assign_trait()),
|
||||
hir::BiSub => ("sub_assign", lang.sub_assign_trait()),
|
||||
hir::BiMul => ("mul_assign", lang.mul_assign_trait()),
|
||||
hir::BiDiv => ("div_assign", lang.div_assign_trait()),
|
||||
hir::BiRem => ("rem_assign", lang.rem_assign_trait()),
|
||||
hir::BiBitXor => ("bitxor_assign", lang.bitxor_assign_trait()),
|
||||
hir::BiBitAnd => ("bitand_assign", lang.bitand_assign_trait()),
|
||||
hir::BiBitOr => ("bitor_assign", lang.bitor_assign_trait()),
|
||||
hir::BiShl => ("shl_assign", lang.shl_assign_trait()),
|
||||
hir::BiShr => ("shr_assign", lang.shr_assign_trait()),
|
||||
hir::BiLt | hir::BiLe |
|
||||
hir::BiGe | hir::BiGt |
|
||||
hir::BiEq | hir::BiNe |
|
||||
hir::BiAnd | hir::BiOr => {
|
||||
hir::BinOpKind::Add => ("add_assign", lang.add_assign_trait()),
|
||||
hir::BinOpKind::Sub => ("sub_assign", lang.sub_assign_trait()),
|
||||
hir::BinOpKind::Mul => ("mul_assign", lang.mul_assign_trait()),
|
||||
hir::BinOpKind::Div => ("div_assign", lang.div_assign_trait()),
|
||||
hir::BinOpKind::Rem => ("rem_assign", lang.rem_assign_trait()),
|
||||
hir::BinOpKind::BitXor => ("bitxor_assign", lang.bitxor_assign_trait()),
|
||||
hir::BinOpKind::BitAnd => ("bitand_assign", lang.bitand_assign_trait()),
|
||||
hir::BinOpKind::BitOr => ("bitor_assign", lang.bitor_assign_trait()),
|
||||
hir::BinOpKind::Shl => ("shl_assign", lang.shl_assign_trait()),
|
||||
hir::BinOpKind::Shr => ("shr_assign", lang.shr_assign_trait()),
|
||||
hir::BinOpKind::Lt | hir::BinOpKind::Le |
|
||||
hir::BinOpKind::Ge | hir::BinOpKind::Gt |
|
||||
hir::BinOpKind::Eq | hir::BinOpKind::Ne |
|
||||
hir::BinOpKind::And | hir::BinOpKind::Or => {
|
||||
span_bug!(span,
|
||||
"impossible assignment operation: {}=",
|
||||
op.node.as_str())
|
||||
|
@ -529,23 +529,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
} else if let Op::Binary(op, IsAssign::No) = op {
|
||||
match op.node {
|
||||
hir::BiAdd => ("add", lang.add_trait()),
|
||||
hir::BiSub => ("sub", lang.sub_trait()),
|
||||
hir::BiMul => ("mul", lang.mul_trait()),
|
||||
hir::BiDiv => ("div", lang.div_trait()),
|
||||
hir::BiRem => ("rem", lang.rem_trait()),
|
||||
hir::BiBitXor => ("bitxor", lang.bitxor_trait()),
|
||||
hir::BiBitAnd => ("bitand", lang.bitand_trait()),
|
||||
hir::BiBitOr => ("bitor", lang.bitor_trait()),
|
||||
hir::BiShl => ("shl", lang.shl_trait()),
|
||||
hir::BiShr => ("shr", lang.shr_trait()),
|
||||
hir::BiLt => ("lt", lang.partial_ord_trait()),
|
||||
hir::BiLe => ("le", lang.partial_ord_trait()),
|
||||
hir::BiGe => ("ge", lang.partial_ord_trait()),
|
||||
hir::BiGt => ("gt", lang.partial_ord_trait()),
|
||||
hir::BiEq => ("eq", lang.eq_trait()),
|
||||
hir::BiNe => ("ne", lang.eq_trait()),
|
||||
hir::BiAnd | hir::BiOr => {
|
||||
hir::BinOpKind::Add => ("add", lang.add_trait()),
|
||||
hir::BinOpKind::Sub => ("sub", lang.sub_trait()),
|
||||
hir::BinOpKind::Mul => ("mul", lang.mul_trait()),
|
||||
hir::BinOpKind::Div => ("div", lang.div_trait()),
|
||||
hir::BinOpKind::Rem => ("rem", lang.rem_trait()),
|
||||
hir::BinOpKind::BitXor => ("bitxor", lang.bitxor_trait()),
|
||||
hir::BinOpKind::BitAnd => ("bitand", lang.bitand_trait()),
|
||||
hir::BinOpKind::BitOr => ("bitor", lang.bitor_trait()),
|
||||
hir::BinOpKind::Shl => ("shl", lang.shl_trait()),
|
||||
hir::BinOpKind::Shr => ("shr", lang.shr_trait()),
|
||||
hir::BinOpKind::Lt => ("lt", lang.partial_ord_trait()),
|
||||
hir::BinOpKind::Le => ("le", lang.partial_ord_trait()),
|
||||
hir::BinOpKind::Ge => ("ge", lang.partial_ord_trait()),
|
||||
hir::BinOpKind::Gt => ("gt", lang.partial_ord_trait()),
|
||||
hir::BinOpKind::Eq => ("eq", lang.eq_trait()),
|
||||
hir::BinOpKind::Ne => ("ne", lang.eq_trait()),
|
||||
hir::BinOpKind::And | hir::BinOpKind::Or => {
|
||||
span_bug!(span, "&& and || are not overloadable")
|
||||
}
|
||||
}
|
||||
|
@ -608,31 +608,31 @@ enum BinOpCategory {
|
|||
impl BinOpCategory {
|
||||
fn from(op: hir::BinOp) -> BinOpCategory {
|
||||
match op.node {
|
||||
hir::BiShl | hir::BiShr =>
|
||||
hir::BinOpKind::Shl | hir::BinOpKind::Shr =>
|
||||
BinOpCategory::Shift,
|
||||
|
||||
hir::BiAdd |
|
||||
hir::BiSub |
|
||||
hir::BiMul |
|
||||
hir::BiDiv |
|
||||
hir::BiRem =>
|
||||
hir::BinOpKind::Add |
|
||||
hir::BinOpKind::Sub |
|
||||
hir::BinOpKind::Mul |
|
||||
hir::BinOpKind::Div |
|
||||
hir::BinOpKind::Rem =>
|
||||
BinOpCategory::Math,
|
||||
|
||||
hir::BiBitXor |
|
||||
hir::BiBitAnd |
|
||||
hir::BiBitOr =>
|
||||
hir::BinOpKind::BitXor |
|
||||
hir::BinOpKind::BitAnd |
|
||||
hir::BinOpKind::BitOr =>
|
||||
BinOpCategory::Bitwise,
|
||||
|
||||
hir::BiEq |
|
||||
hir::BiNe |
|
||||
hir::BiLt |
|
||||
hir::BiLe |
|
||||
hir::BiGe |
|
||||
hir::BiGt =>
|
||||
hir::BinOpKind::Eq |
|
||||
hir::BinOpKind::Ne |
|
||||
hir::BinOpKind::Lt |
|
||||
hir::BinOpKind::Le |
|
||||
hir::BinOpKind::Ge |
|
||||
hir::BinOpKind::Gt =>
|
||||
BinOpCategory::Comparison,
|
||||
|
||||
hir::BiAnd |
|
||||
hir::BiOr =>
|
||||
hir::BinOpKind::And |
|
||||
hir::BinOpKind::Or =>
|
||||
BinOpCategory::Shortcircuit,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue