diff --git a/CLAUDE.md b/CLAUDE.md index 8409b18..fc612d8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -87,7 +87,7 @@ All i32 operations (arithmetic, division, comparison, bit-manip, shift/rotate) h ## Conventions -- Rust edition 2024, MSRV 1.85 +- Rust edition 2024, MSRV 1.88 - Edition 2024 notes: `unsafe fn` bodies require explicit inner `unsafe {}` blocks; `#[no_mangle]` must be `#[unsafe(no_mangle)]`; `static mut` access via `&raw const`/`&raw mut` - Bazel 8.x with bzlmod (`MODULE.bazel`, not `WORKSPACE`) - Renode tests use `rules_renode` (PulseEngine fork with macOS support) diff --git a/Cargo.toml b/Cargo.toml index db9198f..402357a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ resolver = "2" [workspace.package] version = "0.1.0" edition = "2024" -rust-version = "1.85" +rust-version = "1.88" authors = ["PulseEngine Team"] license = "Apache-2.0" repository = "https://github.com/pulseengine/synth" diff --git a/MODULE.bazel b/MODULE.bazel index 3a7da16..1c9a6c4 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -23,8 +23,8 @@ register_toolchains("@local_config_cc_toolchains//:all") # Rust toolchains rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") rust.toolchain( - edition = "2021", - versions = ["1.84.0"], + edition = "2024", + versions = ["1.88.0"], ) use_repo(rust, "rust_toolchains") register_toolchains("@rust_toolchains//:all") diff --git a/crates/BUILD.bazel b/crates/BUILD.bazel index d94196e..be93533 100644 --- a/crates/BUILD.bazel +++ b/crates/BUILD.bazel @@ -11,7 +11,7 @@ rust_library( name = "synth-core", srcs = glob(["synth-core/src/**/*.rs"]), crate_root = "synth-core/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ "@crates//:anyhow", "@crates//:serde", @@ -26,7 +26,7 @@ rust_library( name = "synth-frontend", srcs = glob(["synth-frontend/src/**/*.rs"]), crate_root = "synth-frontend/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -41,7 +41,7 @@ rust_library( name = "synth-analysis", srcs = glob(["synth-analysis/src/**/*.rs"]), crate_root = "synth-analysis/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", ":synth-cfg", @@ -54,7 +54,7 @@ rust_library( name = "synth-cfg", srcs = glob(["synth-cfg/src/**/*.rs"]), crate_root = "synth-cfg/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -66,7 +66,7 @@ rust_library( name = "synth-opt", srcs = glob(["synth-opt/src/**/*.rs"]), crate_root = "synth-opt/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-cfg", "@crates//:anyhow", @@ -78,7 +78,7 @@ rust_library( name = "synth-synthesis", srcs = glob(["synth-synthesis/src/**/*.rs"]), crate_root = "synth-synthesis/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", ":synth-opt", @@ -91,34 +91,19 @@ rust_library( ], ) -# Register allocation -rust_library( - name = "synth-regalloc", - srcs = glob(["synth-regalloc/src/**/*.rs"]), - crate_root = "synth-regalloc/src/lib.rs", - edition = "2021", - deps = [ - ":synth-core", - ":synth-opt", - "@crates//:anyhow", - # TODO: Add regalloc2 dependency - ], -) - # Code generation backend (ELF builder, linker scripts, ARM encoder) # ARM-specific modules require synth-synthesis (arm-cortex-m feature in Cargo) rust_library( name = "synth-backend", srcs = glob(["synth-backend/src/**/*.rs"]), crate_root = "synth-backend/src/lib.rs", - edition = "2021", + edition = "2024", rustc_flags = ["--cfg", "feature=\"arm-cortex-m\""], deps = [ ":synth-core", - ":synth-codegen", - ":synth-regalloc", ":synth-synthesis", "@crates//:anyhow", + "@crates//:thiserror", ], ) @@ -127,7 +112,7 @@ rust_library( name = "synth-backend-awsm", srcs = glob(["synth-backend-awsm/src/**/*.rs"]), crate_root = "synth-backend-awsm/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -140,7 +125,7 @@ rust_library( name = "synth-backend-wasker", srcs = glob(["synth-backend-wasker/src/**/*.rs"]), crate_root = "synth-backend-wasker/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -148,26 +133,12 @@ rust_library( ], ) -# Machine code generation -rust_library( - name = "synth-codegen", - srcs = glob(["synth-codegen/src/**/*.rs"]), - crate_root = "synth-codegen/src/lib.rs", - edition = "2021", - deps = [ - ":synth-core", - ":synth-opt", - ":synth-regalloc", - "@crates//:anyhow", - ], -) - # ABI and calling conventions rust_library( name = "synth-abi", srcs = glob(["synth-abi/src/**/*.rs"]), crate_root = "synth-abi/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-wit", "@crates//:anyhow", @@ -179,7 +150,7 @@ rust_library( name = "synth-wit", srcs = glob(["synth-wit/src/**/*.rs"]), crate_root = "synth-wit/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -193,7 +164,7 @@ rust_library( name = "synth-verify", srcs = glob(["synth-verify/src/**/*.rs"]), crate_root = "synth-verify/src/lib.rs", - edition = "2021", + edition = "2024", rustc_flags = [ "--cfg", "feature=\"z3-solver\"", "--cfg", "feature=\"arm\"", @@ -218,7 +189,7 @@ rust_library( name = "synth-memory", srcs = glob(["synth-memory/src/**/*.rs"]), crate_root = "synth-memory/src/lib.rs", - edition = "2021", + edition = "2024", crate_features = ["std"], deps = [ "@crates//:bitflags", @@ -230,7 +201,7 @@ rust_library( name = "synth-qemu", srcs = glob(["synth-qemu/src/**/*.rs"]), crate_root = "synth-qemu/src/lib.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", "@crates//:anyhow", @@ -242,7 +213,7 @@ rust_binary( name = "synth", srcs = glob(["synth-cli/src/**/*.rs"]), crate_root = "synth-cli/src/main.rs", - edition = "2021", + edition = "2024", deps = [ ":synth-core", ":synth-frontend", @@ -264,7 +235,7 @@ rust_library( srcs = glob(["synth-test/src/**/*.rs"], exclude = ["synth-test/src/main.rs"]), crate_root = "synth-test/src/lib.rs", crate_name = "synth_test", - edition = "2021", + edition = "2024", deps = [ "@crates//:anyhow", "@crates//:clap", @@ -282,7 +253,7 @@ rust_library( rust_binary( name = "synth-test", srcs = ["synth-test/src/main.rs"], - edition = "2021", + edition = "2024", deps = [ ":synth-test-lib", "@crates//:anyhow", @@ -300,11 +271,9 @@ filegroup( ":synth-cfg", ":synth-opt", ":synth-synthesis", - ":synth-regalloc", ":synth-backend", ":synth-backend-awsm", ":synth-backend-wasker", - ":synth-codegen", ":synth-abi", ":synth-wit", ":synth-verify", diff --git a/crates/synth-synthesis/tests/proptest_robustness.rs b/crates/synth-synthesis/tests/proptest_robustness.rs index 07a33ef..2572aa5 100644 --- a/crates/synth-synthesis/tests/proptest_robustness.rs +++ b/crates/synth-synthesis/tests/proptest_robustness.rs @@ -99,10 +99,10 @@ proptest! { let db = RuleDatabase::with_standard_rules(); let mut sel1 = InstructionSelector::new(db.rules().to_vec()); - let r1 = sel1.select(&[op.clone()]).unwrap(); + let r1 = sel1.select(std::slice::from_ref(&op)).unwrap(); let mut sel2 = InstructionSelector::new(db.rules().to_vec()); - let r2 = sel2.select(&[op]).unwrap(); + let r2 = sel2.select(std::slice::from_ref(&op)).unwrap(); prop_assert_eq!( r1.len(), r2.len(), diff --git a/crates/synth-synthesis/tests/rocq_correspondence.rs b/crates/synth-synthesis/tests/rocq_correspondence.rs index cbe1754..5d66d16 100644 --- a/crates/synth-synthesis/tests/rocq_correspondence.rs +++ b/crates/synth-synthesis/tests/rocq_correspondence.rs @@ -7,9 +7,7 @@ //! implementations agree. The Rocq proofs verify `compile_wasm_to_arm` preserves //! semantics; these tests verify the Rust code matches `compile_wasm_to_arm`. -use synth_synthesis::{ - ArmOp, InstructionSelector, Operand2, RuleDatabase, WasmOp, -}; +use synth_synthesis::{ArmOp, InstructionSelector, Operand2, RuleDatabase, WasmOp}; /// Helper: extract opcode names from an ARM instruction sequence, /// abstracting away register allocation. @@ -53,7 +51,9 @@ fn opcode_names(ops: &[ArmOp]) -> Vec<&'static str> { /// which has no peephole optimizations. fn select_single(wasm_op: WasmOp) -> Vec { let mut selector = InstructionSelector::new(vec![]); - let result = selector.select(&[wasm_op]).expect("selection should succeed"); + let result = selector + .select(&[wasm_op]) + .expect("selection should succeed"); result.into_iter().map(|instr| instr.op).collect() } @@ -317,10 +317,10 @@ fn instruction_counts_match_rocq() { (WasmOp::I32DivS, 1), (WasmOp::I32DivU, 1), // Two-instruction ops - (WasmOp::I32Rotl, 2), // RSB + ROR_reg - (WasmOp::I32Ctz, 2), // RBIT + CLZ - (WasmOp::I32RemS, 2), // SDIV + MLS - (WasmOp::I32RemU, 2), // UDIV + MLS + (WasmOp::I32Rotl, 2), // RSB + ROR_reg + (WasmOp::I32Ctz, 2), // RBIT + CLZ + (WasmOp::I32RemS, 2), // SDIV + MLS + (WasmOp::I32RemU, 2), // UDIV + MLS ]; for (wasm_op, expected_count) in &expected {