diff options
| author | Celina G. Val <celinval@amazon.com> | 2025-01-15 13:54:04 -0800 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2025-02-03 13:55:15 -0800 |
| commit | 3a14dbbd948e0d34264c546775572863eb6340c1 (patch) | |
| tree | 50ed0d064bf6f38c475f7f3d6fa6a5c19e493d0e /src | |
| parent | fa43703573a44cc7302bbe7ef29ce7b6f80a77ad (diff) | |
Refactor contract builtin macro + error handling
Instead of parsing the different components of a function signature, eagerly look for either the `where` keyword or the function body. - Also address feedback to use `From` instead of `TryFrom` in cranelift contract and ubcheck codegen.
Diffstat (limited to 'src')
| -rw-r--r-- | src/base.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/base.rs b/src/base.rs index de2ce1768fa..a2b9e5712e5 100644 --- a/src/base.rs +++ b/src/base.rs @@ -868,7 +868,7 @@ fn codegen_stmt<'tcx>( NullOp::UbChecks => { let val = fx.tcx.sess.ub_checks(); let val = CValue::by_val( - fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()), + fx.bcx.ins().iconst(types::I8, i64::from(val)), fx.layout_of(fx.tcx.types.bool), ); lval.write_cvalue(fx, val); @@ -877,7 +877,7 @@ fn codegen_stmt<'tcx>( NullOp::ContractChecks => { let val = fx.tcx.sess.contract_checks(); let val = CValue::by_val( - fx.bcx.ins().iconst(types::I8, i64::try_from(val).unwrap()), + fx.bcx.ins().iconst(types::I8, i64::from(val)), fx.layout_of(fx.tcx.types.bool), ); lval.write_cvalue(fx, val); |
