Skip to content

Commit 78d23ae

Browse files
authored
Merge branch 'main' into itemref
2 parents ec415c0 + a036f24 commit 78d23ae

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

engine/lib/import_thir.ml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ end) : EXPR = struct
246246
(typ : ty) =
247247
let overloaded_names_of_binop : Thir.bin_op -> Concrete_ident.name =
248248
function
249-
| Add -> Core__ops__arith__Add__add
250-
| Sub -> Core__ops__arith__Sub__sub
251-
| Mul -> Core__ops__arith__Mul__mul
249+
| Add | AddUnchecked -> Core__ops__arith__Add__add
250+
| Sub | SubUnchecked -> Core__ops__arith__Sub__sub
251+
| Mul | MulUnchecked -> Core__ops__arith__Mul__mul
252252
| Div -> Core__ops__arith__Div__div
253253
| Rem -> Core__ops__arith__Rem__rem
254254
| BitXor -> Core__ops__bit__BitXor__bitxor
255255
| BitAnd -> Core__ops__bit__BitAnd__bitand
256256
| BitOr -> Core__ops__bit__BitOr__bitor
257-
| Shl -> Core__ops__bit__Shl__shl
258-
| Shr -> Core__ops__bit__Shr__shr
257+
| Shl | ShlUnchecked -> Core__ops__bit__Shl__shl
258+
| Shr | ShrUnchecked -> Core__ops__bit__Shr__shr
259259
| Lt -> Core__cmp__PartialOrd__lt
260260
| Le -> Core__cmp__PartialOrd__le
261261
| Ne -> Core__cmp__PartialEq__ne
@@ -271,16 +271,16 @@ end) : EXPR = struct
271271
| Offset -> Core__ptr__const_ptr__Impl__offset
272272
in
273273
let primitive_names_of_binop : Thir.bin_op -> Concrete_ident.name = function
274-
| Add -> Rust_primitives__u128__add
275-
| Sub -> Rust_primitives__u128__sub
276-
| Mul -> Rust_primitives__u128__mul
274+
| Add | AddUnchecked -> Rust_primitives__u128__add
275+
| Sub | SubUnchecked -> Rust_primitives__u128__sub
276+
| Mul | MulUnchecked -> Rust_primitives__u128__mul
277277
| Div -> Rust_primitives__u128__div
278278
| Rem -> Rust_primitives__u128__rem
279279
| BitXor -> Rust_primitives__u128__bit_xor
280280
| BitAnd -> Rust_primitives__u128__bit_and
281281
| BitOr -> Rust_primitives__u128__bit_or
282-
| Shl -> Rust_primitives__u128__shl
283-
| Shr -> Rust_primitives__u128__shr
282+
| Shl | ShlUnchecked -> Rust_primitives__u128__shl
283+
| Shr | ShrUnchecked -> Rust_primitives__u128__shr
284284
| Lt -> Rust_primitives__u128__lt
285285
| Le -> Rust_primitives__u128__le
286286
| Ne -> Rust_primitives__u128__ne
@@ -332,11 +332,12 @@ end) : EXPR = struct
332332
let expected, f =
333333
match op with
334334
| Add | Sub | Mul | AddWithOverflow | SubWithOverflow
335-
| MulWithOverflow | Div ->
335+
| MulWithOverflow | AddUnchecked | SubUnchecked | MulUnchecked | Div
336+
->
336337
both int <|> both float
337338
| Rem | Cmp -> both int
338339
| BitXor | BitAnd | BitOr -> both int <|> both bool
339-
| Shl | Shr -> int <*> int
340+
| Shl | Shr | ShlUnchecked | ShrUnchecked -> int <*> int
340341
| Lt | Le | Ne | Ge | Gt -> both int <|> both float
341342
| Eq -> both int <|> both float <|> both bool
342343
| Offset -> ("", fun _ -> Some "")

frontend/exporter/src/types/mir.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -963,35 +963,24 @@ pub enum UnOp {
963963
#[derive(AdtInto, Copy, Clone, Debug, JsonSchema)]
964964
#[args(<'slt, S: UnderOwnerState<'slt>>, from: mir::BinOp, state: S as _s)]
965965
pub enum BinOp {
966-
// We merge the checked and unchecked variants because in either case overflow is failure.
967-
#[custom_arm(
968-
rustc_middle::mir::BinOp::Add | rustc_middle::mir::BinOp::AddUnchecked => BinOp::Add,
969-
)]
970966
Add,
971-
#[custom_arm(
972-
rustc_middle::mir::BinOp::Sub | rustc_middle::mir::BinOp::SubUnchecked => BinOp::Sub,
973-
)]
974-
Sub,
975-
#[custom_arm(
976-
rustc_middle::mir::BinOp::Mul | rustc_middle::mir::BinOp::MulUnchecked => BinOp::Mul,
977-
)]
978-
Mul,
967+
AddUnchecked,
979968
AddWithOverflow,
969+
Sub,
970+
SubUnchecked,
980971
SubWithOverflow,
972+
Mul,
973+
MulUnchecked,
981974
MulWithOverflow,
982975
Div,
983976
Rem,
984977
BitXor,
985978
BitAnd,
986979
BitOr,
987-
#[custom_arm(
988-
rustc_middle::mir::BinOp::Shl | rustc_middle::mir::BinOp::ShlUnchecked => BinOp::Shl,
989-
)]
990980
Shl,
991-
#[custom_arm(
992-
rustc_middle::mir::BinOp::Shr | rustc_middle::mir::BinOp::ShrUnchecked => BinOp::Shr,
993-
)]
981+
ShlUnchecked,
994982
Shr,
983+
ShrUnchecked,
995984
Eq,
996985
Lt,
997986
Le,

0 commit comments

Comments
 (0)