-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
Description
As of rust-lang/rust#86041, Clone impls for array types are now implemented in library code rather than using clone shims. As such, the TyArray case in crucible-mir's clone shim logic is now unreachable, and we can remove it to simplify things:
crucible/crucible-mir/src/Mir/TransCustom.hs
Lines 2138 to 2155 in c76f025
| cloneShimDef (TyArray ty len) parts | |
| | [part] <- parts = CustomMirOp $ \ops -> do | |
| lv <- case ops of | |
| [Move lv] -> return lv | |
| [Copy lv] -> return lv | |
| [op] -> mirFail $ "cloneShimDef: expected lvalue operand, but got " ++ show op | |
| _ -> mirFail $ "cloneShimDef: expected exactly one argument, but got " ++ show (length ops) | |
| -- The argument to the clone shim is `&[T; n]`. The clone method for | |
| -- elements requires `&T`, computed as `&arg[i]`. | |
| let elementRefRvs = map (\i -> | |
| Ref Shared (LProj (LProj lv Deref) (ConstantIndex i len False)) "_") [0 .. len - 1] | |
| elementRefExps <- mapM evalRval elementRefRvs | |
| elementRefOps <- mapM (\expr -> makeTempOperand (TyRef ty Immut) expr) elementRefExps | |
| clonedExps <- mapM (\op -> callExp part [op]) elementRefOps | |
| Some tpr <- tyToReprM ty | |
| buildArrayLit tpr clonedExps | |
| | otherwise = CustomOp $ \_ _ -> mirFail $ | |
| "expected exactly one clone function for in array clone shim, but got " ++ show parts |
See GaloisInc/mir-json#197 for the corresponding mir-json-side issue.