├── .gitignore ├── src ├── lib.rs ├── arguments.rs ├── main.rs ├── common.rs └── tests.rs ├── Cargo.toml ├── .github └── workflows │ └── rust.yml ├── LICENSE ├── CHANGELOG.md ├── README.md ├── test └── assets │ ├── main_test.wat │ └── test_bad_imports.wat └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | tarpaulin-report.html 3 | 4 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | mod common; 2 | 3 | /// Rewire WASI functions. 4 | /// If there are no functions found for replacement, the module processing will not happen. 5 | /// This is done to avoid any modification if the ic-wasi-polyfill library was not included in the build. 6 | /// 7 | /// returns true if the module was modified 8 | pub fn process_module(m: &mut walrus::Module) -> bool { 9 | common::do_module_replacements(m) 10 | } 11 | 12 | /// Convenience function to get the list of functions imported 13 | /// 14 | /// returns pairs of values: (module name, function name) 15 | pub fn module_imports(m: &mut walrus::Module) -> Vec<(String, String)> { 16 | common::get_module_imports(m) 17 | } 18 | -------------------------------------------------------------------------------- /src/arguments.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | 3 | #[derive(Parser, Debug)] 4 | #[command(version, about=format!("Wasi dependency removal V{}", env!("CARGO_PKG_VERSION")), long_about = None)] 5 | pub struct Wasm2icArgs { 6 | /// Quiet mode 7 | #[arg(long, short, default_value_t = false)] 8 | pub quiet: bool, 9 | 10 | /// Show WASM module imports 11 | #[arg(long, short, default_value_t = false)] 12 | pub imports: bool, 13 | 14 | /// Input file to process (*.wasm or *.wat). 15 | pub input_file: String, 16 | 17 | /// Output file to store the processed Wasm (*.wasm or *.wat). 18 | #[arg(default_value_t = String::from("no_wasi.wasm"))] 19 | pub output_file: String, 20 | } 21 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wasi2ic" 3 | version = "0.2.17" 4 | edition = "2021" 5 | description = "This tool converts WebAssembly System Interface (WASI) dependent Wasm files to be compatible with the Internet Computer (IC) platform." 6 | keywords = ["ic", "internet-computer", "wasi"] 7 | license = "MIT" 8 | repository = "https://github.com/wasm-forge/wasi2ic" 9 | 10 | [lib] 11 | name = "wasi2ic" 12 | path = "src/lib.rs" 13 | 14 | [[bin]] 15 | name = "wasi2ic" 16 | path = "src/main.rs" 17 | 18 | [dependencies] 19 | walrus = "0.22.0" 20 | 21 | clap = { version = "4.5.48", features = ["derive"] } 22 | anyhow = { version = "1.0.100", default-features = false } 23 | env_logger = "0.11.8" 24 | log = "0.4.28" 25 | wasmprinter = "0.239.0" 26 | wat = "1.239.0" 27 | ic-wasm = "0.9.6" 28 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | RUST_LOG: debug 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Install Rust 21 | run: rustup update stable 22 | - name: Install cargo-llvm-cov 23 | uses: taiki-e/install-action@cargo-llvm-cov 24 | 25 | - name: Run tests 26 | run: cargo test --verbose 27 | 28 | - name: Generate code coverage 29 | run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info 30 | 31 | - name: Upload coverage to Codecov 32 | uses: codecov/codecov-action@v3 33 | with: 34 | token: ${{ secrets.CODECOV_TOKEN }} 35 | files: lcov.info 36 | fail_ci_if_error: true 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) 2023 wasm-forge 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [v0.2.17] 4 | - Fix infinite recursion 5 | - Refactor code structure 6 | 7 | ## [v0.2.16] 8 | - Minor text corrections 9 | - Support wasi2ic as a library 10 | - Add command line option to print out existing exports 11 | - After conversion, report if there are any unresolved dependencies left, return an error code if there is anything other than ic0 12 | - Update dependencies 13 | 14 | ## [v0.2.15] 15 | - Update dependencies 16 | - Support direct writing into .wat files 17 | - Minor refactoring 18 | 19 | 20 | ## [v0.2.14] 21 | - Dependency version updates 22 | - Use 'cargo install' to install the tool 23 | - Improved documentation 24 | 25 | 26 | ## [v0.2.13] 27 | - Refactor branching, use 'main' instead of 'master' 28 | - rename '_start' to '_initialize' 29 | 30 | 31 | ## [v0.2.12] 32 | - Update Cargo.toml package information 33 | - Use 'clap' for argument parsing 34 | - Support reading from .wat files 35 | 36 | 37 | 38 | 39 | [unreleased]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.16...main 40 | [v0.2.16]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.15...v0.2.16 41 | [v0.2.15]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.14...v0.2.15 42 | [v0.2.14]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.13...v0.2.14 43 | [v0.2.13]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.12...v0.2.13 44 | [v0.2.12]: https://github.com/wasm-forge/wasi2ic/compare/v0.2.11...v0.2.12 45 | 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## wasi2ic: WASI Polyfill Tool 5 | 6 | ![Tests](https://github.com/wasm-forge/wasi2ic/actions/workflows/rust.yml/badge.svg?event=push) 7 | [![Coverage](https://codecov.io/gh/wasm-forge/wasi2ic/graph/badge.svg?token=XE48Z6JSYS)](https://codecov.io/gh/wasm-forge/wasi2ic) 8 | 9 | `wasi2ic` is a command-line tool that replaces WebAssembly System Interface (WASI) specific function calls with their 10 | corresponding polyfill implementations. This allows you to run Wasm binaries compiled for `wasm32-wasi` on the Internet 11 | Computer. 12 | 13 | ## Installation 14 | 15 | Install `wasi2ic` using Cargo: 16 | 17 | ```bash 18 | cargo install wasi2ic 19 | ``` 20 | 21 | ## Usage 22 | 23 | Replace WASI dependencies in a Wasm file using: 24 | 25 | ```bash 26 | wasi2ic 27 | ``` 28 | 29 | This command reads the input Wasm file, removes WASI dependencies, and reroutes WASI calls to their IC-specific 30 | implementations. Note that the polyfill implementation must be present in your Wasm binary. 31 | 32 | To include the polyfill implementation in your Canister project, add the ic-wasi-polyfill dependency in it: 33 | ```bash 34 | cargo add ic-wasi-polyfill 35 | ``` 36 | 37 | Also you will need to add the initialization call to the polyfill library, basic example featuring user memory manager: 38 | 39 | ```rust 40 | use ic_stable_structures::{memory_manager::MemoryManager, DefaultMemoryImpl}; 41 | use std::cell::RefCell; 42 | 43 | thread_local! { 44 | static MEMORY_MANAGER: RefCell> = 45 | RefCell::new(MemoryManager::init(DefaultMemoryImpl::default())); 46 | } 47 | 48 | #[ic_cdk::init] 49 | fn init() { 50 | MEMORY_MANAGER.with(|m| { 51 | let m = m.borrow(); 52 | ic_wasi_polyfill::init_with_memory_manager(&[0u8; 32], &[], &m, 200..210); 53 | }); 54 | } 55 | ``` 56 | 57 | 58 | For more detailed information, see our [examples repository](https://github.com/wasm-forge/examples). 59 | 60 | 61 | ## Related repositories 62 | 63 | 64 | | Repository | Description | 65 | | --------------------------------------------- | ----------------------------- | 66 | | [ic-wasi-polyfill](https://github.com/wasm-forge/ic-wasi-polyfill) | Polyfill library implementing the low-level WASI calls. | 67 | | [stable-fs](https://github.com/wasm-forge/stable-fs) | Simple file system implementation based on the stable structures. The file system implements backend for the ic-wasi-polyfill | 68 | | [examples](https://github.com/wasm-forge/examples) | Repository containing various examplpes of running WASI projects on the IC. | 69 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod arguments; 2 | mod common; 3 | use crate::{arguments::Wasm2icArgs, common::get_module_imports}; 4 | use clap::Parser; 5 | use std::path::Path; 6 | 7 | fn is_wat(path: &Path) -> bool { 8 | if let Some(ext) = path.extension() { 9 | if ext == "wat" { 10 | return true; 11 | } 12 | } 13 | 14 | false 15 | } 16 | 17 | pub fn show_module_imports(module: &walrus::Module) { 18 | let imports = get_module_imports(module); 19 | println!("Module imports:"); 20 | for (mname, fname) in imports { 21 | println!(" import \"{mname}\" \"{fname}\""); 22 | } 23 | } 24 | 25 | //fn do_wasm_file_processing(input_wasm: &Path, output_wasm: &Path) -> Result<(), anyhow::Error> { 26 | pub fn do_wasm_file_processing(args: &Wasm2icArgs) -> Result<(), anyhow::Error> { 27 | log::info!( 28 | "Processing input file: '{}', writing output into '{}'", 29 | args.input_file, 30 | args.output_file 31 | ); 32 | 33 | if !args.quiet && !args.imports { 34 | println!( 35 | "wasi2ic {}: processing input file: '{}', writing output into '{}'", 36 | env!("CARGO_PKG_VERSION"), 37 | args.input_file, 38 | args.output_file 39 | ); 40 | } 41 | 42 | let input_wasm = Path::new(&args.input_file); 43 | let wasm = if is_wat(input_wasm) { 44 | wat::parse_file(input_wasm)? 45 | } else { 46 | std::fs::read(input_wasm)? 47 | }; 48 | 49 | // use the same parser as dfx here 50 | let mut module = ic_wasm::utils::parse_wasm(&wasm, true)?; //walrus::Module::from_buffer_with_config(&wasm, &config)?; 51 | 52 | if args.imports { 53 | show_module_imports(&module); 54 | } else { 55 | common::do_module_replacements(&mut module); 56 | let wasm = module.emit_wasm(); 57 | 58 | let output_wasm = Path::new(&args.output_file); 59 | if is_wat(output_wasm) { 60 | // write using wat printer 61 | let wat = wasmprinter::print_bytes(&wasm)?; 62 | std::fs::write(output_wasm, wat)?; 63 | } else { 64 | std::fs::write(output_wasm, wasm)?; 65 | }; 66 | 67 | let imports = get_module_imports(&module); 68 | 69 | for (mname, _fname) in imports { 70 | if mname != "ic0" { 71 | show_module_imports(&module); 72 | return Err(anyhow::anyhow!("There are imports remaining that are not compatible with the Internet Computer.")); 73 | } 74 | } 75 | } 76 | 77 | Ok(()) 78 | } 79 | 80 | fn main() -> anyhow::Result<()> { 81 | env_logger::init(); 82 | let args = arguments::Wasm2icArgs::parse(); 83 | 84 | do_wasm_file_processing(&args)?; 85 | 86 | Ok(()) 87 | } 88 | 89 | #[cfg(test)] 90 | mod tests; 91 | -------------------------------------------------------------------------------- /test/assets/main_test.wat: -------------------------------------------------------------------------------- 1 | (module $test_module 2 | (type (;0;) (func)) 3 | (type (;1;) (func (param i32))) 4 | (type (;2;) (func (param i32 i32))) 5 | (type (;3;) (func (param i32 i32) (result i32))) 6 | (type (;4;) (func (param i32 i32 i32))) 7 | (type (;5;) (func (param i32 i32 i32 i32) (result i32))) 8 | (import "ic0" "debug_print" (func $_dprint (;0;) (type 2))) 9 | (import "ic0" "msg_reply" (func $_msg_reply (;1;) (type 0))) 10 | (import "wasi_snapshot_preview1" "fd_write" (func $_wasi_snapshot_preview_fd_write (;2;) (type 5))) 11 | (import "wasi_snapshot_preview1" "random_get" (func $_wasi_snapshot_preview_random_get (;3;) (type 3))) 12 | (import "wasi_snapshot_preview1" "environ_get" (func $__imported_wasi_snapshot_preview1_environ_get (;4;) (type 3))) 13 | 14 | (table (;0;) 5 5 funcref) 15 | (elem (;0;) (i32.const 1) func $_wasi_snapshot_preview_fd_write $_wasi_snapshot_preview_random_get ) 16 | 17 | (func $_initialize (;6;) (type 0) 18 | i32.const 1 19 | i32.const 2 20 | call $_wasi_snapshot_preview_random_get 21 | 22 | (block $test_block 23 | i32.const 0 24 | (if 25 | (then 26 | (block $test_block3 27 | i32.const 1 28 | i32.const 2 29 | 30 | call $_wasi_snapshot_preview_random_get 31 | 32 | drop 33 | ) 34 | ) 35 | (else 36 | (loop $test_loop (result i32) 37 | i32.const 1 38 | i32.const 2 39 | 40 | call $_wasi_snapshot_preview_random_get 41 | 42 | br_if $test_loop 43 | 44 | i32.const 2 45 | ) 46 | 47 | drop 48 | 49 | ) 50 | ) 51 | ) 52 | 53 | i32.const 3 54 | i32.const 4 55 | i32.const 5 56 | call $_wasi_snapshot_preview_fd_write 57 | 58 | drop 59 | ) 60 | 61 | (func $__ic_custom_random_get (;7;) (type 3) (param i32 i32) (result i32) 62 | i32.const 0 63 | ref.func $_wasi_snapshot_preview_random_get 64 | table.set 0 65 | 66 | call $_msg_reply 67 | i32.const 421 68 | ) 69 | 70 | (func $__ic_custom_fd_write (;8;) (type 5) (param i32 i32 i32 i32) (result i32) 71 | i32.const 0 72 | i32.const 0 73 | call $_dprint 74 | i32.const 42 75 | ) 76 | 77 | (export "_initialize" (func $_initialize)) 78 | 79 | (export "f" (func $__ic_custom_random_get)) 80 | (export "lambda" (func $_lambda)) 81 | (export "lambda2" (func $_lambda)) 82 | 83 | (func $_lambda (@name "__ic_custom_random_get") (param $x i32) (result i32) (local.get $x)) 84 | 85 | (@producers 86 | (language "Rust" "") 87 | (language "C11" "") 88 | (processed-by "rustc" "1.84.0 (9fc6b4312 2025-01-07)") 89 | (processed-by "clang" "18.1.2-wasi-sdk (https://github.com/llvm/llvm-project 26a1d6601d727a96f4301d0d8647b5a42760ae0c)") 90 | ) 91 | (@custom "target_features" (after data) "custom target features") 92 | ) -------------------------------------------------------------------------------- /test/assets/test_bad_imports.wat: -------------------------------------------------------------------------------- 1 | (module $test_module 2 | (type (;0;) (func)) 3 | (type (;1;) (func (param i32))) 4 | (type (;2;) (func (param i32 i32))) 5 | (type (;3;) (func (param i32 i32) (result i32))) 6 | (type (;4;) (func (param i32 i32 i32))) 7 | (type (;5;) (func (param i32 i32 i32 i32) (result i32))) 8 | (import "ic0" "debug_print" (func $_dprint (;0;) (type 2))) 9 | (import "env" "some_function" (func $_some_function (;0;) (type 2))) 10 | (import "ic0" "msg_reply" (func $_msg_reply (;1;) (type 0))) 11 | (import "wasi_snapshot_preview1" "fd_write" (func $_wasi_snapshot_preview_fd_write (;2;) (type 5))) 12 | (import "wasi_snapshot_preview1" "random_get" (func $_wasi_snapshot_preview_random_get (;3;) (type 3))) 13 | (import "wasi_snapshot_preview1" "environ_get" (func $__imported_wasi_snapshot_preview1_environ_get (;4;) (type 3))) 14 | (import "wasi_snapshot_preview1" "proc_exit" (func $__imported_wasi_snapshot_preview1_proc_exit (;5;) (type 1))) 15 | 16 | (table (;0;) 5 5 funcref) 17 | (elem (;0;) (i32.const 1) func $_wasi_snapshot_preview_fd_write $_wasi_snapshot_preview_random_get ) 18 | 19 | (func $_initialize (;6;) (type 0) 20 | i32.const 1 21 | i32.const 2 22 | call $_wasi_snapshot_preview_random_get 23 | 24 | (block $test_block 25 | i32.const 0 26 | (if 27 | (then 28 | (block $test_block3 29 | i32.const 1 30 | i32.const 2 31 | 32 | call $_wasi_snapshot_preview_random_get 33 | 34 | drop 35 | ) 36 | ) 37 | (else 38 | (loop $test_loop (result i32) 39 | i32.const 1 40 | i32.const 2 41 | 42 | call $_wasi_snapshot_preview_random_get 43 | 44 | br_if $test_loop 45 | 46 | i32.const 2 47 | ) 48 | 49 | drop 50 | 51 | ) 52 | ) 53 | ) 54 | 55 | i32.const 3 56 | i32.const 4 57 | i32.const 5 58 | call $_wasi_snapshot_preview_fd_write 59 | 60 | call $__imported_wasi_snapshot_preview1_proc_exit 61 | ) 62 | 63 | (func $__ic_custom_random_get (;7;) (type 3) (param i32 i32) (result i32) 64 | i32.const 0 65 | ref.func $_wasi_snapshot_preview_random_get 66 | table.set 0 67 | 68 | call $_msg_reply 69 | i32.const 421 70 | ) 71 | 72 | (func $__ic_custom_fd_write (;8;) (type 5) (param i32 i32 i32 i32) (result i32) 73 | i32.const 0 74 | i32.const 0 75 | call $_dprint 76 | i32.const 0 77 | i32.const 0 78 | call $_some_function 79 | i32.const 42 80 | ) 81 | 82 | (export "_initialize" (func $_initialize)) 83 | 84 | (export "f" (func $__ic_custom_random_get)) 85 | (export "lambda" (func $_lambda)) 86 | (export "lambda2" (func $_lambda)) 87 | 88 | (func $_lambda (@name "__ic_custom_random_get") (param $x i32) (result i32) (local.get $x)) 89 | 90 | (@producers 91 | (language "Rust" "") 92 | (language "C11" "") 93 | (processed-by "rustc" "1.84.0 (9fc6b4312 2025-01-07)") 94 | (processed-by "clang" "18.1.2-wasi-sdk (https://github.com/llvm/llvm-project 26a1d6601d727a96f4301d0d8647b5a42760ae0c)") 95 | ) 96 | 97 | ) -------------------------------------------------------------------------------- /src/common.rs: -------------------------------------------------------------------------------- 1 | use std::collections::{HashMap, HashSet}; 2 | use walrus::ElementItems; 3 | use walrus::{ir::Instr, FunctionId}; 4 | 5 | const WASI_UNSTABLE: &str = "wasi_unstable"; 6 | const WASI_SNAPSHOT_PREVIEW1: &str = "wasi_snapshot_preview1"; 7 | 8 | fn get_replacement_module_id( 9 | module: &walrus::Module, 10 | module_name: &str, 11 | import_name: &str, 12 | fn_id: FunctionId, 13 | ) -> Option { 14 | // we only support wasi_unstable and wasi_snapshot_preview1 modules 15 | if module_name != WASI_UNSTABLE && module_name != WASI_SNAPSHOT_PREVIEW1 { 16 | return None; 17 | } 18 | 19 | let searched_function_name = format!("__ic_custom_{import_name}"); 20 | 21 | // 1) Search by function name 22 | for fun in module.funcs.iter() { 23 | if let Some(name) = &fun.name { 24 | if *name == searched_function_name { 25 | let original_ty = module.funcs.get(fn_id).ty(); 26 | let replacement_ty = module.funcs.get(fun.id()).ty(); 27 | 28 | if original_ty != replacement_ty { 29 | log::error!( 30 | "Type mismatch for replacement {}::{}: original {:?}, replacement {:?}", 31 | module_name, 32 | import_name, 33 | original_ty, 34 | replacement_ty 35 | ); 36 | return None; 37 | } 38 | 39 | if matches!(module.funcs.get(fun.id()).kind, walrus::FunctionKind::Import(_)) { 40 | log::error!( 41 | "Replacement function {} must not be an imported function", 42 | searched_function_name 43 | ); 44 | return None; 45 | } 46 | 47 | log::debug!( 48 | "Function replacement found: {:?} -> {:?}.", 49 | module.funcs.get(fn_id).name, 50 | module.funcs.get(fun.id()).name 51 | ); 52 | 53 | return Some(fun.id()); 54 | } 55 | } 56 | } 57 | 58 | // 2) additionally try searching exports, in case the original function was renamed 59 | for export in module.exports.iter() { 60 | if export.name != searched_function_name { 61 | continue; 62 | } 63 | 64 | match export.item { 65 | walrus::ExportItem::Function(exported_function) => { 66 | let original_ty = module.funcs.get(fn_id).ty(); 67 | let replacement_ty = module.funcs.get(exported_function).ty(); 68 | 69 | if original_ty != replacement_ty { 70 | log::error!( 71 | "Type mismatch for exported replacement {}::{}: original {:?}, replacement {:?}", 72 | module_name, 73 | import_name, 74 | original_ty, 75 | replacement_ty 76 | ); 77 | return None; 78 | } 79 | 80 | if matches!( 81 | module.funcs.get(exported_function).kind, 82 | walrus::FunctionKind::Import(_) 83 | ) { 84 | log::error!( 85 | "Exported replacement function {} must not be an imported function", 86 | searched_function_name 87 | ); 88 | return None; 89 | } 90 | 91 | log::debug!( 92 | "Function replacement found in exports: {:?} -> {:?}.", 93 | module.funcs.get(fn_id).name, 94 | module.funcs.get(exported_function).name 95 | ); 96 | 97 | return Some(exported_function); 98 | } 99 | walrus::ExportItem::Table(_) 100 | | walrus::ExportItem::Memory(_) 101 | | walrus::ExportItem::Global(_) => {} 102 | } 103 | } 104 | 105 | log::warn!( 106 | "Could not find the replacement for the WASI function: {module_name}::{import_name}" 107 | ); 108 | 109 | None 110 | } 111 | 112 | pub(crate) fn gather_replacement_ids(m: &walrus::Module) -> HashMap { 113 | // gather functions for replacements 114 | let mut fn_replacement_ids: HashMap = HashMap::new(); 115 | 116 | for imp in m.imports.iter() { 117 | match imp.kind { 118 | walrus::ImportKind::Function(fn_id) => { 119 | let replace_id = 120 | get_replacement_module_id(m, imp.module.as_str(), imp.name.as_str(), fn_id); 121 | 122 | if let Some(rep_id) = replace_id { 123 | fn_replacement_ids.insert(fn_id, rep_id); 124 | } 125 | } 126 | 127 | walrus::ImportKind::Table(_) 128 | | walrus::ImportKind::Memory(_) 129 | | walrus::ImportKind::Global(_) => {} 130 | } 131 | } 132 | 133 | log::debug!("Gathered replacement IDs {fn_replacement_ids:?}"); 134 | 135 | fn_replacement_ids 136 | } 137 | 138 | fn replace_calls(m: &mut walrus::Module, fn_replacement_ids: &HashMap) { 139 | // First, patch element segments 140 | for elem in m.elements.iter_mut() { 141 | match &mut elem.items { 142 | ElementItems::Functions(function_ids) => { 143 | for func_id in function_ids.iter_mut() { 144 | if let Some(&new_id) = fn_replacement_ids.get(func_id) { 145 | log::debug!( 146 | "Replace func id in element: old ID: {:?}, new ID {:?}", 147 | func_id, 148 | new_id 149 | ); 150 | 151 | *func_id = new_id; 152 | } 153 | } 154 | } 155 | ElementItems::Expressions(_, _) => { 156 | // Expressions do not contain FunctionId directly here. 157 | } 158 | } 159 | } 160 | 161 | // Then, replace dependent calls in function bodies 162 | for fun in m.funcs.iter_mut() { 163 | log::debug!("Processing function `{:?}`", fun.name); 164 | 165 | match &mut fun.kind { 166 | walrus::FunctionKind::Import(_import_fun) => { 167 | // nothing to rewrite in imported bodies 168 | } 169 | 170 | walrus::FunctionKind::Local(local_fun) => { 171 | let block_id: walrus::ir::InstrSeqId = local_fun.entry_block(); 172 | let mut visited: HashSet = HashSet::new(); 173 | replace_calls_in_instructions(block_id, fn_replacement_ids, local_fun, &mut visited); 174 | } 175 | 176 | walrus::FunctionKind::Uninitialized(_) => {} 177 | } 178 | } 179 | } 180 | 181 | fn replace_calls_in_instructions( 182 | block_id: walrus::ir::InstrSeqId, 183 | fn_replacement_ids: &HashMap, 184 | local_fun: &mut walrus::LocalFunction, 185 | visited: &mut HashSet, 186 | ) { 187 | if !visited.insert(block_id) { 188 | // already visited this block in this function; avoid infinite recursion 189 | return; 190 | } 191 | 192 | log::debug!("Entering block {block_id:?}"); 193 | 194 | let instructions = &mut local_fun.block_mut(block_id).instrs; 195 | 196 | let mut block_ids = Vec::new(); 197 | 198 | for (ins, _location) in instructions.iter_mut() { 199 | match ins { 200 | Instr::RefFunc(ref_func_inst) => { 201 | if let Some(&new_id) = fn_replacement_ids.get(&ref_func_inst.func) { 202 | log::debug!( 203 | "Replace ref_func old ID: {:?}, new ID {:?}", 204 | ref_func_inst.func, 205 | new_id 206 | ); 207 | ref_func_inst.func = new_id; 208 | } 209 | } 210 | Instr::Call(call_inst) => { 211 | if let Some(&new_id) = fn_replacement_ids.get(&call_inst.func) { 212 | log::debug!( 213 | "Replace function call: old ID: {:?}, new ID {:?}", 214 | call_inst.func, 215 | new_id 216 | ); 217 | call_inst.func = new_id; 218 | } 219 | } 220 | Instr::ReturnCall(call_inst) => { 221 | if let Some(&new_id) = fn_replacement_ids.get(&call_inst.func) { 222 | log::debug!( 223 | "Replace function return call: old ID: {:?}, new ID {:?}", 224 | call_inst.func, 225 | new_id 226 | ); 227 | call_inst.func = new_id; 228 | } 229 | } 230 | Instr::Block(block_ins) => { 231 | block_ids.push(block_ins.seq); 232 | } 233 | Instr::Loop(loop_ins) => { 234 | block_ids.push(loop_ins.seq); 235 | } 236 | Instr::IfElse(if_else) => { 237 | block_ids.push(if_else.consequent); 238 | block_ids.push(if_else.alternative); 239 | } 240 | Instr::CallIndirect(_) 241 | | Instr::LocalGet(_) 242 | | Instr::LocalSet(_) 243 | | Instr::LocalTee(_) 244 | | Instr::GlobalGet(_) 245 | | Instr::GlobalSet(_) 246 | | Instr::Const(_) 247 | | Instr::Binop(_) 248 | | Instr::Unop(_) 249 | | Instr::Select(_) 250 | | Instr::Unreachable(_) 251 | | Instr::Br(_) 252 | | Instr::BrIf(_) 253 | | Instr::BrTable(_) 254 | | Instr::Drop(_) 255 | | Instr::Return(_) 256 | | Instr::MemorySize(_) 257 | | Instr::MemoryGrow(_) 258 | | Instr::MemoryInit(_) 259 | | Instr::DataDrop(_) 260 | | Instr::MemoryCopy(_) 261 | | Instr::MemoryFill(_) 262 | | Instr::Load(_) 263 | | Instr::Store(_) 264 | | Instr::AtomicRmw(_) 265 | | Instr::Cmpxchg(_) 266 | | Instr::AtomicNotify(_) 267 | | Instr::AtomicWait(_) 268 | | Instr::AtomicFence(_) 269 | | Instr::TableGet(_) 270 | | Instr::TableSet(_) 271 | | Instr::TableGrow(_) 272 | | Instr::TableSize(_) 273 | | Instr::TableFill(_) 274 | | Instr::RefNull(_) 275 | | Instr::RefIsNull(_) 276 | | Instr::V128Bitselect(_) 277 | | Instr::I8x16Swizzle(_) 278 | | Instr::I8x16Shuffle(_) 279 | | Instr::LoadSimd(_) 280 | | Instr::TableInit(_) 281 | | Instr::ElemDrop(_) 282 | | Instr::TableCopy(_) 283 | // | Instr::TernOp(_) // will be needed with walrus version 0.23 or later 284 | | Instr::ReturnCallIndirect(_) => { 285 | } 286 | } 287 | } 288 | 289 | // process additional instructions inside nested blocks 290 | for nested_block_id in block_ids { 291 | replace_calls_in_instructions(nested_block_id, fn_replacement_ids, local_fun, visited) 292 | } 293 | } 294 | 295 | pub(crate) fn add_start_entry(module: &mut walrus::Module) { 296 | // try to find the start (_initialize) function 297 | let initialize_function = module.funcs.by_name("_initialize"); 298 | log::info!("_initialize function found: {initialize_function:?}"); 299 | 300 | if let Some(initialize) = initialize_function { 301 | if module.start.is_none() { 302 | log::info!("Setting module start function to _initialize"); 303 | module.start = Some(initialize); 304 | } else { 305 | log::debug!("Module already has a start function; leaving it unchanged"); 306 | } 307 | } 308 | } 309 | 310 | pub(crate) fn remove_start_export(module: &mut walrus::Module) { 311 | let mut export_found: Option = None; 312 | 313 | // try to find the start export 314 | for export in module.exports.iter() { 315 | if !export.name.starts_with("_initialize") { 316 | continue; 317 | } 318 | 319 | if let walrus::ExportItem::Function(_) = export.item { 320 | export_found = Some(export.id()); 321 | break; 322 | } 323 | } 324 | 325 | // remove export, if it was found 326 | if let Some(export_id) = export_found { 327 | log::debug!("Removing _initialize export"); 328 | module.exports.delete(export_id); 329 | } 330 | } 331 | 332 | pub(crate) fn do_module_replacements(module: &mut walrus::Module) -> bool { 333 | // find corresponding IDs for replacements 334 | let fn_replacement_ids = gather_replacement_ids(module); 335 | 336 | if fn_replacement_ids.is_empty() { 337 | // do not modify module, if there are no functions to rewire 338 | log::debug!("No WASI imports to replace; leaving module unchanged"); 339 | return false; 340 | } 341 | 342 | // do recursive call replacement 343 | replace_calls(module, &fn_replacement_ids); 344 | 345 | // add _initialize entry (this is needed to do initialization) 346 | add_start_entry(module); 347 | 348 | // remove the _initialize export to clean up the module exports 349 | remove_start_export(module); 350 | 351 | // clean-up unused imports 352 | walrus::passes::gc::run(module); 353 | 354 | true 355 | } 356 | 357 | pub(crate) fn get_module_imports(module: &walrus::Module) -> Vec<(String, String)> { 358 | let mut module_imports: Vec<(String, String)> = Vec::new(); 359 | 360 | for imp in module.imports.iter() { 361 | match imp.kind { 362 | walrus::ImportKind::Function(_fn_id) => { 363 | module_imports.push(( 364 | imp.module.as_str().to_string(), 365 | imp.name.as_str().to_string(), 366 | )); 367 | } 368 | 369 | walrus::ImportKind::Table(_) 370 | | walrus::ImportKind::Memory(_) 371 | | walrus::ImportKind::Global(_) => {} 372 | } 373 | } 374 | 375 | module_imports 376 | } 377 | -------------------------------------------------------------------------------- /src/tests.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use crate::*; 4 | 5 | #[test] 6 | fn test_add_start_entry() { 7 | let wat = r#" 8 | (module 9 | (func $add (param i32 i32) (result i32) 10 | local.get 0 11 | local.get 1 12 | i32.add 13 | ) 14 | 15 | (func $_initialize 16 | i32.const 2 17 | i32.const 3 18 | call $add 19 | i32.const 5 20 | i32.const 7 21 | call $add 22 | drop 23 | drop 24 | ) 25 | ) 26 | "#; 27 | 28 | let binary = wat::parse_str(wat).unwrap(); 29 | let mut module = walrus::Module::from_buffer(&binary).unwrap(); 30 | 31 | assert!(module.start.is_none()); 32 | 33 | common::add_start_entry(&mut module); 34 | 35 | assert!(module.start.is_some()); 36 | } 37 | 38 | #[test] 39 | fn test_remove_start_export() { 40 | let wat = r#" 41 | (module 42 | (func $add (param i32 i32) (result i32) 43 | local.get 0 44 | local.get 1 45 | i32.add 46 | ) 47 | 48 | (func $_initialize 49 | i32.const 2 50 | i32.const 3 51 | call $add 52 | i32.const 5 53 | i32.const 7 54 | call $add 55 | drop 56 | drop 57 | ) 58 | 59 | (export "_initialize" (func $_initialize)) 60 | ) 61 | "#; 62 | 63 | let binary = wat::parse_str(wat).unwrap(); 64 | let mut module = walrus::Module::from_buffer(&binary).unwrap(); 65 | 66 | let mut export_found: Option = None; 67 | 68 | // try to find the initialize export 69 | for export in module.exports.iter() { 70 | if !export.name.starts_with("_initialize") { 71 | continue; 72 | } 73 | 74 | if let walrus::ExportItem::Function(_) = export.item { 75 | export_found = Some(export.id()); 76 | } 77 | } 78 | 79 | assert!(export_found.is_some()); 80 | 81 | common::remove_start_export(&mut module); 82 | 83 | let mut export_found: Option = None; 84 | // try to find the initialize export 85 | for export in module.exports.iter() { 86 | if !export.name.starts_with("_initialize") { 87 | continue; 88 | } 89 | 90 | if let walrus::ExportItem::Function(_) = export.item { 91 | export_found = Some(export.id()); 92 | } 93 | } 94 | 95 | assert!(export_found.is_none()); 96 | } 97 | 98 | #[test] 99 | fn test_gather_replacement_ids() { 100 | let wat = r#" 101 | (module 102 | (type (;0;) (func)) 103 | (type (;1;) (func (param i32))) 104 | (type (;2;) (func (param i32 i32))) 105 | (type (;3;) (func (param i32 i32) (result i32))) 106 | (type (;4;) (func (param i32 i32 i32))) 107 | (type (;5;) (func (param i32 i32 i32 i32) (result i32))) 108 | 109 | (import "ic0" "debug_print" (func $_dprint (;0;) (type 2))) 110 | (import "ic0" "msg_reply" (func $_msg_reply (;1;) (type 0))) 111 | (import "wasi_unstable" "fd_write" (func $_wasi_unstable_fd_write (;2;) (type 5))) 112 | (import "wasi_unstable" "random_get" (func $_wasi_unstable_random_get (;3;) (type 3))) 113 | (import "wasi_unstable" "environ_get" (func $__imported_wasi_unstable_environ_get (;4;) (type 3))) 114 | (import "wasi_unstable" "proc_exit" (func $__imported_wasi_unstable_proc_exit (;5;) (type 1))) 115 | 116 | (func $_initialize (;6;) (type 0) 117 | i32.const 1 118 | i32.const 2 119 | call $__ic_custom_random_get 120 | i32.const 1 121 | i32.const 2 122 | call $_wasi_unstable_random_get 123 | i32.const 4 124 | i32.const 5 125 | call $_wasi_unstable_fd_write 126 | drop 127 | ) 128 | 129 | (func $__ic_custom_random_get (;8;) (type 3) (param i32 i32) (result i32) 130 | call $_msg_reply 131 | 132 | i32.const 421 133 | ) 134 | 135 | (func $ic_dummy_fd_write (;7;) (type 5) (param i32 i32 i32 i32) (result i32) 136 | i32.const 0 137 | i32.const 0 138 | call $_dprint 139 | i32.const 42 140 | ) 141 | 142 | (export "__ic_custom_fd_write" (func $ic_dummy_fd_write)) 143 | (export "_initialize" (func $_initialize)) 144 | ) 145 | "#; 146 | 147 | let binary = wat::parse_str(wat).unwrap(); 148 | let module = walrus::Module::from_buffer(&binary).unwrap(); 149 | 150 | let id_reps: HashMap = common::gather_replacement_ids(&module) 151 | .iter() 152 | .map(|(x, y)| (x.index(), y.index())) 153 | .collect(); 154 | 155 | assert!(id_reps[&2] == 8); 156 | assert!(id_reps[&3] == 7); 157 | } 158 | 159 | #[test] 160 | fn test_do_module_replacements() { 161 | let wat = r#" 162 | (module 163 | (type (;0;) (func)) 164 | (type (;1;) (func (param i32))) 165 | (type (;2;) (func (param i32 i32))) 166 | (type (;3;) (func (param i32 i32) (result i32))) 167 | (type (;4;) (func (param i32 i32 i32))) 168 | (type (;5;) (func (param i32 i32 i32 i32) (result i32))) 169 | 170 | (import "ic0" "debug_print" (func $_dprint (;0;) (type 2))) 171 | (import "ic0" "msg_reply" (func $_msg_reply (;1;) (type 0))) 172 | (import "wasi_snapshot_preview1" "fd_write" (func $_wasi_snapshot_preview_fd_write (;2;) (type 5))) 173 | (import "wasi_snapshot_preview1" "random_get" (func $_wasi_snapshot_preview_random_get (;3;) (type 3))) 174 | (import "wasi_snapshot_preview1" "environ_get" (func $__imported_wasi_snapshot_preview1_environ_get (;4;) (type 3))) 175 | (import "wasi_snapshot_preview1" "proc_exit" (func $__imported_wasi_snapshot_preview1_proc_exit (;5;) (type 1))) 176 | 177 | (table (;0;) 5 5 funcref) 178 | (elem (;0;) (i32.const 1) func $_wasi_snapshot_preview_fd_write $_wasi_snapshot_preview_random_get ) 179 | 180 | (memory (export "memory") 1 100) 181 | 182 | (data (i32.const 0x0000) 183 | "\65\66\67\68" 184 | ) 185 | 186 | (func $_initialize (;6;) (type 0) 187 | i32.const 1 188 | i32.const 2 189 | call $_wasi_snapshot_preview_random_get 190 | 191 | (block $test_block 192 | i32.const 0 193 | (if 194 | (then 195 | (block $test_block3 196 | i32.const 1 197 | i32.const 2 198 | 199 | call $_wasi_snapshot_preview_random_get 200 | 201 | drop 202 | ) 203 | ) 204 | (else 205 | (loop $test_loop (result i32) 206 | i32.const 1 207 | i32.const 2 208 | 209 | call $_wasi_snapshot_preview_random_get 210 | 211 | br_if $test_loop 212 | 213 | i32.const 2 214 | ) 215 | 216 | drop 217 | 218 | ) 219 | ) 220 | ) 221 | 222 | i32.const 3 223 | i32.const 4 224 | i32.const 5 225 | call $_wasi_snapshot_preview_fd_write 226 | 227 | call $__imported_wasi_snapshot_preview1_proc_exit 228 | ) 229 | 230 | (func $__ic_custom_random_get (;7;) (type 3) (param i32 i32) (result i32) 231 | i32.const 0 232 | ref.func $_wasi_snapshot_preview_random_get 233 | table.set 0 234 | 235 | call $_msg_reply 236 | i32.const 421 237 | ) 238 | 239 | (func $__ic_custom_fd_write (;8;) (type 5) (param i32 i32 i32 i32) (result i32) 240 | i32.const 0 241 | i32.const 0 242 | call $_dprint 243 | i32.const 42 244 | ) 245 | 246 | (export "_initialize" (func $_initialize)) 247 | ) 248 | "#; 249 | 250 | let binary = wat::parse_str(wat).unwrap(); 251 | let mut module = walrus::Module::from_buffer(&binary).unwrap(); 252 | 253 | common::do_module_replacements(&mut module); 254 | 255 | // we expect random_get and fd_write to be replaced, environ_get to be removed and the calls to the proc_exit to remain 256 | let imports = module.imports; 257 | 258 | let result = imports.find("ic0", "debug_print"); 259 | assert!(result.is_some()); 260 | let result = imports.find("ic0", "msg_reply"); 261 | assert!(result.is_some()); 262 | let result = imports.find("wasi_snapshot_preview1", "proc_exit"); 263 | assert!(result.is_some()); 264 | let result = imports.find("wasi_snapshot_preview1", "fd_write"); 265 | assert!(result.is_none()); 266 | let result = imports.find("wasi_snapshot_preview1", "random_get"); 267 | assert!(result.is_none()); 268 | let result = imports.find("wasi_snapshot_preview1", "environ_get"); 269 | assert!(result.is_none()); 270 | } 271 | 272 | #[test] 273 | fn test_do_module_replacements_remaining_imports() { 274 | let wat = r#" 275 | (module 276 | (type (;0;) (func)) 277 | (type (;1;) (func (param i32))) 278 | (type (;2;) (func (param i32 i32))) 279 | (type (;3;) (func (param i32 i32) (result i32))) 280 | (type (;4;) (func (param i32 i32 i32))) 281 | (type (;5;) (func (param i32 i32 i32 i32) (result i32))) 282 | 283 | (import "ic0" "debug_print" (func $_dprint (;0;) (type 2))) 284 | (import "env" "some_function" (func $_some_function (;0;) (type 2))) 285 | (import "ic0" "msg_reply" (func $_msg_reply (;1;) (type 0))) 286 | (import "wasi_snapshot_preview1" "fd_write" (func $_wasi_snapshot_preview_fd_write (;2;) (type 5))) 287 | (import "wasi_snapshot_preview1" "random_get" (func $_wasi_snapshot_preview_random_get (;3;) (type 3))) 288 | (import "wasi_snapshot_preview1" "environ_get" (func $__imported_wasi_snapshot_preview1_environ_get (;4;) (type 3))) 289 | (import "wasi_snapshot_preview1" "proc_exit" (func $__imported_wasi_snapshot_preview1_proc_exit (;5;) (type 1))) 290 | 291 | (table (;0;) 5 5 funcref) 292 | (elem (;0;) (i32.const 1) func $_wasi_snapshot_preview_fd_write $_wasi_snapshot_preview_random_get ) 293 | 294 | (memory (export "memory") 1 100) 295 | 296 | (data (i32.const 0x0000) 297 | "\65\66\67\68" 298 | ) 299 | 300 | (func $_initialize (;6;) (type 0) 301 | i32.const 1 302 | i32.const 2 303 | call $_wasi_snapshot_preview_random_get 304 | 305 | (block $test_block 306 | i32.const 0 307 | (if 308 | (then 309 | (block $test_block3 310 | i32.const 1 311 | i32.const 2 312 | 313 | call $_wasi_snapshot_preview_random_get 314 | 315 | drop 316 | ) 317 | ) 318 | (else 319 | (loop $test_loop (result i32) 320 | i32.const 1 321 | i32.const 2 322 | 323 | call $_wasi_snapshot_preview_random_get 324 | 325 | br_if $test_loop 326 | 327 | i32.const 2 328 | ) 329 | 330 | drop 331 | 332 | ) 333 | ) 334 | ) 335 | 336 | i32.const 3 337 | i32.const 4 338 | i32.const 5 339 | call $_wasi_snapshot_preview_fd_write 340 | 341 | call $__imported_wasi_snapshot_preview1_proc_exit 342 | ) 343 | 344 | (func $__ic_custom_random_get (;7;) (type 3) (param i32 i32) (result i32) 345 | i32.const 0 346 | ref.func $_wasi_snapshot_preview_random_get 347 | table.set 0 348 | 349 | call $_msg_reply 350 | i32.const 421 351 | ) 352 | 353 | (func $__ic_custom_fd_write (;8;) (type 5) (param i32 i32 i32 i32) (result i32) 354 | i32.const 0 355 | i32.const 0 356 | call $_dprint 357 | i32.const 0 358 | i32.const 0 359 | call $_some_function 360 | i32.const 42 361 | ) 362 | 363 | (export "_initialize" (func $_initialize)) 364 | ) 365 | "#; 366 | 367 | let binary = wat::parse_str(wat).unwrap(); 368 | let mut module = walrus::Module::from_buffer(&binary).unwrap(); 369 | 370 | common::do_module_replacements(&mut module); 371 | 372 | // we expect random_get and fd_write to be replaced, environ_get to be removed and the calls to the proc_exit to remain 373 | let imports = module.imports; 374 | 375 | let result = imports.find("ic0", "debug_print"); 376 | assert!(result.is_some()); 377 | let result = imports.find("ic0", "msg_reply"); 378 | assert!(result.is_some()); 379 | let result = imports.find("wasi_snapshot_preview1", "proc_exit"); 380 | assert!(result.is_some()); 381 | let result = imports.find("wasi_snapshot_preview1", "fd_write"); 382 | assert!(result.is_none()); 383 | let result = imports.find("wasi_snapshot_preview1", "random_get"); 384 | assert!(result.is_none()); 385 | let result = imports.find("wasi_snapshot_preview1", "environ_get"); 386 | assert!(result.is_none()); 387 | 388 | let result = imports.find("env", "some_function"); 389 | assert!(result.is_some()); 390 | } 391 | 392 | #[test] 393 | fn test_file_processing() { 394 | std::fs::create_dir_all("target/test").unwrap(); 395 | 396 | let args: arguments::Wasm2icArgs = arguments::Wasm2icArgs { 397 | quiet: false, 398 | imports: false, 399 | input_file: "test/assets/main_test.wat".to_string(), 400 | output_file: "target/test/nowasi.wasm".to_string(), 401 | }; 402 | 403 | let input_file = Path::new(&args.input_file); 404 | assert!(input_file.exists()); 405 | 406 | let output_wasm = Path::new(&args.output_file); 407 | let _ = std::fs::remove_file(output_wasm); 408 | assert!(!output_wasm.exists()); 409 | 410 | do_wasm_file_processing(&args).unwrap(); 411 | 412 | assert!(output_wasm.exists()); 413 | 414 | let module = walrus::Module::from_file(output_wasm).unwrap(); 415 | 416 | // we expect random_get and fd_write to be replaced, environ_get to be removed and the calls to the proc_exit to remain 417 | let imports = module.imports; 418 | 419 | let result = imports.find("ic0", "debug_print"); 420 | assert!(result.is_some()); 421 | let result = imports.find("ic0", "msg_reply"); 422 | assert!(result.is_some()); 423 | let result = imports.find("wasi_snapshot_preview1", "fd_write"); 424 | assert!(result.is_none()); 425 | let result = imports.find("wasi_snapshot_preview1", "random_get"); 426 | assert!(result.is_none()); 427 | let result = imports.find("wasi_snapshot_preview1", "environ_get"); 428 | assert!(result.is_none()); 429 | } 430 | 431 | #[test] 432 | fn test_bad_import() { 433 | std::fs::create_dir_all("target/test").unwrap(); 434 | 435 | let args: arguments::Wasm2icArgs = arguments::Wasm2icArgs { 436 | quiet: false, 437 | imports: false, 438 | input_file: "test/assets/test_bad_imports.wat".to_string(), 439 | output_file: "target/test/nowasi1.wasm".to_string(), 440 | }; 441 | 442 | let input_file = Path::new(&args.input_file); 443 | assert!(input_file.exists()); 444 | 445 | let output_wasm = Path::new(&args.output_file); 446 | let _ = std::fs::remove_file(output_wasm); 447 | assert!(!output_wasm.exists()); 448 | 449 | let process_result = do_wasm_file_processing(&args); 450 | 451 | assert!(output_wasm.exists()); 452 | 453 | assert!(process_result.is_err()); 454 | } 455 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "adler32" 7 | version = "1.2.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" 10 | 11 | [[package]] 12 | name = "ahash" 13 | version = "0.8.12" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" 16 | dependencies = [ 17 | "cfg-if", 18 | "once_cell", 19 | "version_check", 20 | "zerocopy", 21 | ] 22 | 23 | [[package]] 24 | name = "aho-corasick" 25 | version = "1.1.3" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 28 | dependencies = [ 29 | "memchr", 30 | ] 31 | 32 | [[package]] 33 | name = "allocator-api2" 34 | version = "0.2.21" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" 37 | 38 | [[package]] 39 | name = "anstream" 40 | version = "0.6.20" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" 43 | dependencies = [ 44 | "anstyle", 45 | "anstyle-parse", 46 | "anstyle-query", 47 | "anstyle-wincon", 48 | "colorchoice", 49 | "is_terminal_polyfill", 50 | "utf8parse", 51 | ] 52 | 53 | [[package]] 54 | name = "anstyle" 55 | version = "1.0.11" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" 58 | 59 | [[package]] 60 | name = "anstyle-parse" 61 | version = "0.2.7" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" 64 | dependencies = [ 65 | "utf8parse", 66 | ] 67 | 68 | [[package]] 69 | name = "anstyle-query" 70 | version = "1.1.4" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" 73 | dependencies = [ 74 | "windows-sys 0.60.2", 75 | ] 76 | 77 | [[package]] 78 | name = "anstyle-wincon" 79 | version = "3.0.10" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" 82 | dependencies = [ 83 | "anstyle", 84 | "once_cell_polyfill", 85 | "windows-sys 0.60.2", 86 | ] 87 | 88 | [[package]] 89 | name = "anyhow" 90 | version = "1.0.100" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" 93 | 94 | [[package]] 95 | name = "arrayvec" 96 | version = "0.5.2" 97 | source = "registry+https://github.com/rust-lang/crates.io-index" 98 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 99 | 100 | [[package]] 101 | name = "autocfg" 102 | version = "1.5.0" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" 105 | 106 | [[package]] 107 | name = "binread" 108 | version = "2.2.0" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "16598dfc8e6578e9b597d9910ba2e73618385dc9f4b1d43dd92c349d6be6418f" 111 | dependencies = [ 112 | "binread_derive", 113 | "lazy_static", 114 | "rustversion", 115 | ] 116 | 117 | [[package]] 118 | name = "binread_derive" 119 | version = "2.1.0" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "1d9672209df1714ee804b1f4d4f68c8eb2a90b1f7a07acf472f88ce198ef1fed" 122 | dependencies = [ 123 | "either", 124 | "proc-macro2", 125 | "quote", 126 | "syn 1.0.109", 127 | ] 128 | 129 | [[package]] 130 | name = "bitflags" 131 | version = "2.9.4" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" 134 | 135 | [[package]] 136 | name = "block-buffer" 137 | version = "0.10.4" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 140 | dependencies = [ 141 | "generic-array", 142 | ] 143 | 144 | [[package]] 145 | name = "bumpalo" 146 | version = "3.19.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" 149 | 150 | [[package]] 151 | name = "byteorder" 152 | version = "1.5.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 155 | 156 | [[package]] 157 | name = "candid" 158 | version = "0.10.19" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "3ea81e16df186fae1979175058f05dfbfac6e2fdf3b161edcbdc440ef09232cf" 161 | dependencies = [ 162 | "anyhow", 163 | "binread", 164 | "byteorder", 165 | "candid_derive", 166 | "hex", 167 | "ic_principal", 168 | "leb128", 169 | "num-bigint", 170 | "num-traits", 171 | "paste", 172 | "pretty", 173 | "serde", 174 | "serde_bytes", 175 | "stacker", 176 | "thiserror", 177 | ] 178 | 179 | [[package]] 180 | name = "candid_derive" 181 | version = "0.10.19" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "2e6d499625531c41f474e55160a40313b33d002262ddaae40cade71bcc3bc75a" 184 | dependencies = [ 185 | "lazy_static", 186 | "proc-macro2", 187 | "quote", 188 | "syn 2.0.106", 189 | ] 190 | 191 | [[package]] 192 | name = "cc" 193 | version = "1.2.38" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9" 196 | dependencies = [ 197 | "find-msvc-tools", 198 | "jobserver", 199 | "libc", 200 | "shlex", 201 | ] 202 | 203 | [[package]] 204 | name = "cfg-if" 205 | version = "1.0.3" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" 208 | 209 | [[package]] 210 | name = "clap" 211 | version = "4.5.48" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" 214 | dependencies = [ 215 | "clap_builder", 216 | "clap_derive", 217 | ] 218 | 219 | [[package]] 220 | name = "clap_builder" 221 | version = "4.5.48" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" 224 | dependencies = [ 225 | "anstream", 226 | "anstyle", 227 | "clap_lex", 228 | "strsim", 229 | ] 230 | 231 | [[package]] 232 | name = "clap_derive" 233 | version = "4.5.47" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" 236 | dependencies = [ 237 | "heck 0.5.0", 238 | "proc-macro2", 239 | "quote", 240 | "syn 2.0.106", 241 | ] 242 | 243 | [[package]] 244 | name = "clap_lex" 245 | version = "0.7.5" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" 248 | 249 | [[package]] 250 | name = "codespan-reporting" 251 | version = "0.12.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" 254 | dependencies = [ 255 | "serde", 256 | "termcolor", 257 | "unicode-width 0.2.1", 258 | ] 259 | 260 | [[package]] 261 | name = "colorchoice" 262 | version = "1.0.4" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" 265 | 266 | [[package]] 267 | name = "core2" 268 | version = "0.4.0" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" 271 | dependencies = [ 272 | "memchr", 273 | ] 274 | 275 | [[package]] 276 | name = "cpufeatures" 277 | version = "0.2.17" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" 280 | dependencies = [ 281 | "libc", 282 | ] 283 | 284 | [[package]] 285 | name = "crc32fast" 286 | version = "1.5.0" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" 289 | dependencies = [ 290 | "cfg-if", 291 | ] 292 | 293 | [[package]] 294 | name = "crypto-common" 295 | version = "0.1.6" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 298 | dependencies = [ 299 | "generic-array", 300 | "typenum", 301 | ] 302 | 303 | [[package]] 304 | name = "cxx" 305 | version = "1.0.185" 306 | source = "registry+https://github.com/rust-lang/crates.io-index" 307 | checksum = "2f81de88da10862f22b5b3a60f18f6f42bbe7cb8faa24845dd7b1e4e22190e77" 308 | dependencies = [ 309 | "cc", 310 | "cxx-build", 311 | "cxxbridge-cmd", 312 | "cxxbridge-flags", 313 | "cxxbridge-macro", 314 | "foldhash 0.2.0", 315 | "link-cplusplus", 316 | ] 317 | 318 | [[package]] 319 | name = "cxx-build" 320 | version = "1.0.185" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "5edd58bf75c3fdfc80d79806403af626570662f7b6cc782a7fabe156166bd6d6" 323 | dependencies = [ 324 | "cc", 325 | "codespan-reporting", 326 | "indexmap 2.11.4", 327 | "proc-macro2", 328 | "quote", 329 | "scratch", 330 | "syn 2.0.106", 331 | ] 332 | 333 | [[package]] 334 | name = "cxxbridge-cmd" 335 | version = "1.0.185" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "fd46bf2b541a4e0c2d5abba76607379ee05d68e714868e3cb406dc8d591ce2d2" 338 | dependencies = [ 339 | "clap", 340 | "codespan-reporting", 341 | "indexmap 2.11.4", 342 | "proc-macro2", 343 | "quote", 344 | "syn 2.0.106", 345 | ] 346 | 347 | [[package]] 348 | name = "cxxbridge-flags" 349 | version = "1.0.185" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "2c79b68f6a3a8f809d39b38ae8af61305a6113819b19b262643b9c21353b92d9" 352 | 353 | [[package]] 354 | name = "cxxbridge-macro" 355 | version = "1.0.185" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "862b7fdb048ff9ef0779a0d0a03affd09746c4c875543746b640756be9cff2af" 358 | dependencies = [ 359 | "indexmap 2.11.4", 360 | "proc-macro2", 361 | "quote", 362 | "rustversion", 363 | "syn 2.0.106", 364 | ] 365 | 366 | [[package]] 367 | name = "dary_heap" 368 | version = "0.3.8" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "06d2e3287df1c007e74221c49ca10a95d557349e54b3a75dc2fb14712c751f04" 371 | 372 | [[package]] 373 | name = "data-encoding" 374 | version = "2.9.0" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" 377 | 378 | [[package]] 379 | name = "digest" 380 | version = "0.10.7" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 383 | dependencies = [ 384 | "block-buffer", 385 | "crypto-common", 386 | ] 387 | 388 | [[package]] 389 | name = "either" 390 | version = "1.15.0" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" 393 | 394 | [[package]] 395 | name = "env_filter" 396 | version = "0.1.3" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" 399 | dependencies = [ 400 | "log", 401 | "regex", 402 | ] 403 | 404 | [[package]] 405 | name = "env_logger" 406 | version = "0.11.8" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" 409 | dependencies = [ 410 | "anstream", 411 | "anstyle", 412 | "env_filter", 413 | "jiff", 414 | "log", 415 | ] 416 | 417 | [[package]] 418 | name = "equivalent" 419 | version = "1.0.2" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 422 | 423 | [[package]] 424 | name = "errno" 425 | version = "0.3.14" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" 428 | dependencies = [ 429 | "libc", 430 | "windows-sys 0.61.0", 431 | ] 432 | 433 | [[package]] 434 | name = "fallible-iterator" 435 | version = "0.2.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 438 | 439 | [[package]] 440 | name = "fastrand" 441 | version = "2.3.0" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 444 | 445 | [[package]] 446 | name = "find-msvc-tools" 447 | version = "0.1.2" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" 450 | 451 | [[package]] 452 | name = "foldhash" 453 | version = "0.1.5" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" 456 | 457 | [[package]] 458 | name = "foldhash" 459 | version = "0.2.0" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" 462 | 463 | [[package]] 464 | name = "generic-array" 465 | version = "0.14.7" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 468 | dependencies = [ 469 | "typenum", 470 | "version_check", 471 | ] 472 | 473 | [[package]] 474 | name = "getrandom" 475 | version = "0.3.3" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" 478 | dependencies = [ 479 | "cfg-if", 480 | "libc", 481 | "r-efi", 482 | "wasi", 483 | ] 484 | 485 | [[package]] 486 | name = "gimli" 487 | version = "0.26.2" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" 490 | dependencies = [ 491 | "fallible-iterator", 492 | "indexmap 1.9.3", 493 | "stable_deref_trait", 494 | ] 495 | 496 | [[package]] 497 | name = "hashbrown" 498 | version = "0.12.3" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 501 | 502 | [[package]] 503 | name = "hashbrown" 504 | version = "0.14.5" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 507 | dependencies = [ 508 | "ahash", 509 | "allocator-api2", 510 | "serde", 511 | ] 512 | 513 | [[package]] 514 | name = "hashbrown" 515 | version = "0.15.5" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" 518 | dependencies = [ 519 | "foldhash 0.1.5", 520 | "serde", 521 | ] 522 | 523 | [[package]] 524 | name = "hashbrown" 525 | version = "0.16.0" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" 528 | 529 | [[package]] 530 | name = "heck" 531 | version = "0.4.1" 532 | source = "registry+https://github.com/rust-lang/crates.io-index" 533 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 534 | 535 | [[package]] 536 | name = "heck" 537 | version = "0.5.0" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 540 | 541 | [[package]] 542 | name = "hex" 543 | version = "0.4.3" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 546 | 547 | [[package]] 548 | name = "ic-wasm" 549 | version = "0.9.6" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "7d98698bf4f64dc66c38a1d9bf68c91949518f6105df37341840ebba8d3020c3" 552 | dependencies = [ 553 | "anyhow", 554 | "candid", 555 | "clap", 556 | "libflate", 557 | "rustc-demangle", 558 | "serde", 559 | "serde_json", 560 | "tempfile", 561 | "thiserror", 562 | "walrus", 563 | "wasm-opt", 564 | "wasmparser 0.223.1", 565 | ] 566 | 567 | [[package]] 568 | name = "ic_principal" 569 | version = "0.1.1" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "1762deb6f7c8d8c2bdee4b6c5a47b60195b74e9b5280faa5ba29692f8e17429c" 572 | dependencies = [ 573 | "crc32fast", 574 | "data-encoding", 575 | "serde", 576 | "sha2", 577 | "thiserror", 578 | ] 579 | 580 | [[package]] 581 | name = "id-arena" 582 | version = "2.2.1" 583 | source = "registry+https://github.com/rust-lang/crates.io-index" 584 | checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" 585 | 586 | [[package]] 587 | name = "indexmap" 588 | version = "1.9.3" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 591 | dependencies = [ 592 | "autocfg", 593 | "hashbrown 0.12.3", 594 | ] 595 | 596 | [[package]] 597 | name = "indexmap" 598 | version = "2.11.4" 599 | source = "registry+https://github.com/rust-lang/crates.io-index" 600 | checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" 601 | dependencies = [ 602 | "equivalent", 603 | "hashbrown 0.16.0", 604 | "serde", 605 | "serde_core", 606 | ] 607 | 608 | [[package]] 609 | name = "is_terminal_polyfill" 610 | version = "1.70.1" 611 | source = "registry+https://github.com/rust-lang/crates.io-index" 612 | checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 613 | 614 | [[package]] 615 | name = "itoa" 616 | version = "1.0.15" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" 619 | 620 | [[package]] 621 | name = "jiff" 622 | version = "0.2.15" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" 625 | dependencies = [ 626 | "jiff-static", 627 | "log", 628 | "portable-atomic", 629 | "portable-atomic-util", 630 | "serde", 631 | ] 632 | 633 | [[package]] 634 | name = "jiff-static" 635 | version = "0.2.15" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" 638 | dependencies = [ 639 | "proc-macro2", 640 | "quote", 641 | "syn 2.0.106", 642 | ] 643 | 644 | [[package]] 645 | name = "jobserver" 646 | version = "0.1.34" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" 649 | dependencies = [ 650 | "getrandom", 651 | "libc", 652 | ] 653 | 654 | [[package]] 655 | name = "lazy_static" 656 | version = "1.5.0" 657 | source = "registry+https://github.com/rust-lang/crates.io-index" 658 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 659 | 660 | [[package]] 661 | name = "leb128" 662 | version = "0.2.5" 663 | source = "registry+https://github.com/rust-lang/crates.io-index" 664 | checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" 665 | 666 | [[package]] 667 | name = "leb128fmt" 668 | version = "0.1.0" 669 | source = "registry+https://github.com/rust-lang/crates.io-index" 670 | checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" 671 | 672 | [[package]] 673 | name = "libc" 674 | version = "0.2.175" 675 | source = "registry+https://github.com/rust-lang/crates.io-index" 676 | checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 677 | 678 | [[package]] 679 | name = "libflate" 680 | version = "2.1.0" 681 | source = "registry+https://github.com/rust-lang/crates.io-index" 682 | checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" 683 | dependencies = [ 684 | "adler32", 685 | "core2", 686 | "crc32fast", 687 | "dary_heap", 688 | "libflate_lz77", 689 | ] 690 | 691 | [[package]] 692 | name = "libflate_lz77" 693 | version = "2.1.0" 694 | source = "registry+https://github.com/rust-lang/crates.io-index" 695 | checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" 696 | dependencies = [ 697 | "core2", 698 | "hashbrown 0.14.5", 699 | "rle-decode-fast", 700 | ] 701 | 702 | [[package]] 703 | name = "link-cplusplus" 704 | version = "1.0.12" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82" 707 | dependencies = [ 708 | "cc", 709 | ] 710 | 711 | [[package]] 712 | name = "linux-raw-sys" 713 | version = "0.11.0" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" 716 | 717 | [[package]] 718 | name = "log" 719 | version = "0.4.28" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" 722 | 723 | [[package]] 724 | name = "memchr" 725 | version = "2.7.5" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" 728 | 729 | [[package]] 730 | name = "num-bigint" 731 | version = "0.4.6" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" 734 | dependencies = [ 735 | "num-integer", 736 | "num-traits", 737 | "serde", 738 | ] 739 | 740 | [[package]] 741 | name = "num-integer" 742 | version = "0.1.46" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" 745 | dependencies = [ 746 | "num-traits", 747 | ] 748 | 749 | [[package]] 750 | name = "num-traits" 751 | version = "0.2.19" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 754 | dependencies = [ 755 | "autocfg", 756 | ] 757 | 758 | [[package]] 759 | name = "once_cell" 760 | version = "1.21.3" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 763 | 764 | [[package]] 765 | name = "once_cell_polyfill" 766 | version = "1.70.1" 767 | source = "registry+https://github.com/rust-lang/crates.io-index" 768 | checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" 769 | 770 | [[package]] 771 | name = "paste" 772 | version = "1.0.15" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 775 | 776 | [[package]] 777 | name = "portable-atomic" 778 | version = "1.11.1" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" 781 | 782 | [[package]] 783 | name = "portable-atomic-util" 784 | version = "0.2.4" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" 787 | dependencies = [ 788 | "portable-atomic", 789 | ] 790 | 791 | [[package]] 792 | name = "pretty" 793 | version = "0.12.4" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "ac98773b7109bc75f475ab5a134c9b64b87e59d776d31098d8f346922396a477" 796 | dependencies = [ 797 | "arrayvec", 798 | "typed-arena", 799 | "unicode-width 0.1.14", 800 | ] 801 | 802 | [[package]] 803 | name = "proc-macro2" 804 | version = "1.0.101" 805 | source = "registry+https://github.com/rust-lang/crates.io-index" 806 | checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" 807 | dependencies = [ 808 | "unicode-ident", 809 | ] 810 | 811 | [[package]] 812 | name = "psm" 813 | version = "0.1.26" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f" 816 | dependencies = [ 817 | "cc", 818 | ] 819 | 820 | [[package]] 821 | name = "quote" 822 | version = "1.0.40" 823 | source = "registry+https://github.com/rust-lang/crates.io-index" 824 | checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 825 | dependencies = [ 826 | "proc-macro2", 827 | ] 828 | 829 | [[package]] 830 | name = "r-efi" 831 | version = "5.3.0" 832 | source = "registry+https://github.com/rust-lang/crates.io-index" 833 | checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" 834 | 835 | [[package]] 836 | name = "regex" 837 | version = "1.11.2" 838 | source = "registry+https://github.com/rust-lang/crates.io-index" 839 | checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" 840 | dependencies = [ 841 | "aho-corasick", 842 | "memchr", 843 | "regex-automata", 844 | "regex-syntax", 845 | ] 846 | 847 | [[package]] 848 | name = "regex-automata" 849 | version = "0.4.10" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" 852 | dependencies = [ 853 | "aho-corasick", 854 | "memchr", 855 | "regex-syntax", 856 | ] 857 | 858 | [[package]] 859 | name = "regex-syntax" 860 | version = "0.8.6" 861 | source = "registry+https://github.com/rust-lang/crates.io-index" 862 | checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" 863 | 864 | [[package]] 865 | name = "rle-decode-fast" 866 | version = "1.0.3" 867 | source = "registry+https://github.com/rust-lang/crates.io-index" 868 | checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" 869 | 870 | [[package]] 871 | name = "rustc-demangle" 872 | version = "0.1.26" 873 | source = "registry+https://github.com/rust-lang/crates.io-index" 874 | checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" 875 | 876 | [[package]] 877 | name = "rustix" 878 | version = "1.1.2" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" 881 | dependencies = [ 882 | "bitflags", 883 | "errno", 884 | "libc", 885 | "linux-raw-sys", 886 | "windows-sys 0.61.0", 887 | ] 888 | 889 | [[package]] 890 | name = "rustversion" 891 | version = "1.0.22" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" 894 | 895 | [[package]] 896 | name = "ryu" 897 | version = "1.0.20" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" 900 | 901 | [[package]] 902 | name = "scratch" 903 | version = "1.0.9" 904 | source = "registry+https://github.com/rust-lang/crates.io-index" 905 | checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2" 906 | 907 | [[package]] 908 | name = "semver" 909 | version = "1.0.27" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" 912 | 913 | [[package]] 914 | name = "serde" 915 | version = "1.0.226" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" 918 | dependencies = [ 919 | "serde_core", 920 | "serde_derive", 921 | ] 922 | 923 | [[package]] 924 | name = "serde_bytes" 925 | version = "0.11.19" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" 928 | dependencies = [ 929 | "serde", 930 | "serde_core", 931 | ] 932 | 933 | [[package]] 934 | name = "serde_core" 935 | version = "1.0.226" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" 938 | dependencies = [ 939 | "serde_derive", 940 | ] 941 | 942 | [[package]] 943 | name = "serde_derive" 944 | version = "1.0.226" 945 | source = "registry+https://github.com/rust-lang/crates.io-index" 946 | checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" 947 | dependencies = [ 948 | "proc-macro2", 949 | "quote", 950 | "syn 2.0.106", 951 | ] 952 | 953 | [[package]] 954 | name = "serde_json" 955 | version = "1.0.145" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" 958 | dependencies = [ 959 | "itoa", 960 | "memchr", 961 | "ryu", 962 | "serde", 963 | "serde_core", 964 | ] 965 | 966 | [[package]] 967 | name = "sha2" 968 | version = "0.10.9" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" 971 | dependencies = [ 972 | "cfg-if", 973 | "cpufeatures", 974 | "digest", 975 | ] 976 | 977 | [[package]] 978 | name = "shlex" 979 | version = "1.3.0" 980 | source = "registry+https://github.com/rust-lang/crates.io-index" 981 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 982 | 983 | [[package]] 984 | name = "stable_deref_trait" 985 | version = "1.2.0" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 988 | 989 | [[package]] 990 | name = "stacker" 991 | version = "0.1.21" 992 | source = "registry+https://github.com/rust-lang/crates.io-index" 993 | checksum = "cddb07e32ddb770749da91081d8d0ac3a16f1a569a18b20348cd371f5dead06b" 994 | dependencies = [ 995 | "cc", 996 | "cfg-if", 997 | "libc", 998 | "psm", 999 | "windows-sys 0.59.0", 1000 | ] 1001 | 1002 | [[package]] 1003 | name = "strsim" 1004 | version = "0.11.1" 1005 | source = "registry+https://github.com/rust-lang/crates.io-index" 1006 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1007 | 1008 | [[package]] 1009 | name = "strum" 1010 | version = "0.24.1" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" 1013 | 1014 | [[package]] 1015 | name = "strum_macros" 1016 | version = "0.24.3" 1017 | source = "registry+https://github.com/rust-lang/crates.io-index" 1018 | checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" 1019 | dependencies = [ 1020 | "heck 0.4.1", 1021 | "proc-macro2", 1022 | "quote", 1023 | "rustversion", 1024 | "syn 1.0.109", 1025 | ] 1026 | 1027 | [[package]] 1028 | name = "syn" 1029 | version = "1.0.109" 1030 | source = "registry+https://github.com/rust-lang/crates.io-index" 1031 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1032 | dependencies = [ 1033 | "proc-macro2", 1034 | "quote", 1035 | "unicode-ident", 1036 | ] 1037 | 1038 | [[package]] 1039 | name = "syn" 1040 | version = "2.0.106" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 1043 | dependencies = [ 1044 | "proc-macro2", 1045 | "quote", 1046 | "unicode-ident", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "tempfile" 1051 | version = "3.23.0" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" 1054 | dependencies = [ 1055 | "fastrand", 1056 | "getrandom", 1057 | "once_cell", 1058 | "rustix", 1059 | "windows-sys 0.61.0", 1060 | ] 1061 | 1062 | [[package]] 1063 | name = "termcolor" 1064 | version = "1.4.1" 1065 | source = "registry+https://github.com/rust-lang/crates.io-index" 1066 | checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" 1067 | dependencies = [ 1068 | "winapi-util", 1069 | ] 1070 | 1071 | [[package]] 1072 | name = "thiserror" 1073 | version = "1.0.69" 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" 1075 | checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" 1076 | dependencies = [ 1077 | "thiserror-impl", 1078 | ] 1079 | 1080 | [[package]] 1081 | name = "thiserror-impl" 1082 | version = "1.0.69" 1083 | source = "registry+https://github.com/rust-lang/crates.io-index" 1084 | checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" 1085 | dependencies = [ 1086 | "proc-macro2", 1087 | "quote", 1088 | "syn 2.0.106", 1089 | ] 1090 | 1091 | [[package]] 1092 | name = "typed-arena" 1093 | version = "2.0.2" 1094 | source = "registry+https://github.com/rust-lang/crates.io-index" 1095 | checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" 1096 | 1097 | [[package]] 1098 | name = "typenum" 1099 | version = "1.18.0" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" 1102 | 1103 | [[package]] 1104 | name = "unicode-ident" 1105 | version = "1.0.19" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" 1108 | 1109 | [[package]] 1110 | name = "unicode-width" 1111 | version = "0.1.14" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1114 | 1115 | [[package]] 1116 | name = "unicode-width" 1117 | version = "0.2.1" 1118 | source = "registry+https://github.com/rust-lang/crates.io-index" 1119 | checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" 1120 | 1121 | [[package]] 1122 | name = "utf8parse" 1123 | version = "0.2.2" 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" 1125 | checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 1126 | 1127 | [[package]] 1128 | name = "version_check" 1129 | version = "0.9.5" 1130 | source = "registry+https://github.com/rust-lang/crates.io-index" 1131 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 1132 | 1133 | [[package]] 1134 | name = "walrus" 1135 | version = "0.22.0" 1136 | source = "registry+https://github.com/rust-lang/crates.io-index" 1137 | checksum = "d68aa3c7b80be75c8458fc087453e5a31a226cfffede2e9b932393b2ea1c624a" 1138 | dependencies = [ 1139 | "anyhow", 1140 | "gimli", 1141 | "id-arena", 1142 | "leb128", 1143 | "log", 1144 | "walrus-macro", 1145 | "wasm-encoder 0.212.0", 1146 | "wasmparser 0.212.0", 1147 | ] 1148 | 1149 | [[package]] 1150 | name = "walrus-macro" 1151 | version = "0.22.0" 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" 1153 | checksum = "439ad39ff894c43c9649fa724cdde9a6fc50b855d517ef071a93e5df82fe51d3" 1154 | dependencies = [ 1155 | "heck 0.5.0", 1156 | "proc-macro2", 1157 | "quote", 1158 | "syn 2.0.106", 1159 | ] 1160 | 1161 | [[package]] 1162 | name = "wasi" 1163 | version = "0.14.7+wasi-0.2.4" 1164 | source = "registry+https://github.com/rust-lang/crates.io-index" 1165 | checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" 1166 | dependencies = [ 1167 | "wasip2", 1168 | ] 1169 | 1170 | [[package]] 1171 | name = "wasi2ic" 1172 | version = "0.2.17" 1173 | dependencies = [ 1174 | "anyhow", 1175 | "clap", 1176 | "env_logger", 1177 | "ic-wasm", 1178 | "log", 1179 | "walrus", 1180 | "wasmprinter", 1181 | "wat", 1182 | ] 1183 | 1184 | [[package]] 1185 | name = "wasip2" 1186 | version = "1.0.1+wasi-0.2.4" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" 1189 | dependencies = [ 1190 | "wit-bindgen", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "wasm-encoder" 1195 | version = "0.212.0" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" 1198 | dependencies = [ 1199 | "leb128", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "wasm-encoder" 1204 | version = "0.239.0" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" 1207 | dependencies = [ 1208 | "leb128fmt", 1209 | "wasmparser 0.239.0", 1210 | ] 1211 | 1212 | [[package]] 1213 | name = "wasm-opt" 1214 | version = "0.116.1" 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" 1216 | checksum = "2fd87a4c135535ffed86123b6fb0f0a5a0bc89e50416c942c5f0662c645f679c" 1217 | dependencies = [ 1218 | "anyhow", 1219 | "libc", 1220 | "strum", 1221 | "strum_macros", 1222 | "tempfile", 1223 | "thiserror", 1224 | "wasm-opt-cxx-sys", 1225 | "wasm-opt-sys", 1226 | ] 1227 | 1228 | [[package]] 1229 | name = "wasm-opt-cxx-sys" 1230 | version = "0.116.0" 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" 1232 | checksum = "8c57b28207aa724318fcec6575fe74803c23f6f266fce10cbc9f3f116762f12e" 1233 | dependencies = [ 1234 | "anyhow", 1235 | "cxx", 1236 | "cxx-build", 1237 | "wasm-opt-sys", 1238 | ] 1239 | 1240 | [[package]] 1241 | name = "wasm-opt-sys" 1242 | version = "0.116.0" 1243 | source = "registry+https://github.com/rust-lang/crates.io-index" 1244 | checksum = "8a1cce564dc768dacbdb718fc29df2dba80bd21cb47d8f77ae7e3d95ceb98cbe" 1245 | dependencies = [ 1246 | "anyhow", 1247 | "cc", 1248 | "cxx", 1249 | "cxx-build", 1250 | ] 1251 | 1252 | [[package]] 1253 | name = "wasmparser" 1254 | version = "0.212.0" 1255 | source = "registry+https://github.com/rust-lang/crates.io-index" 1256 | checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" 1257 | dependencies = [ 1258 | "ahash", 1259 | "bitflags", 1260 | "hashbrown 0.14.5", 1261 | "indexmap 2.11.4", 1262 | "semver", 1263 | "serde", 1264 | ] 1265 | 1266 | [[package]] 1267 | name = "wasmparser" 1268 | version = "0.223.1" 1269 | source = "registry+https://github.com/rust-lang/crates.io-index" 1270 | checksum = "664b980991ed9a8c834eb528a8979ab1109edcf52dc05dd5751e2cc3fb31035d" 1271 | dependencies = [ 1272 | "bitflags", 1273 | "hashbrown 0.15.5", 1274 | "indexmap 2.11.4", 1275 | "semver", 1276 | "serde", 1277 | ] 1278 | 1279 | [[package]] 1280 | name = "wasmparser" 1281 | version = "0.239.0" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" 1284 | dependencies = [ 1285 | "bitflags", 1286 | "indexmap 2.11.4", 1287 | "semver", 1288 | ] 1289 | 1290 | [[package]] 1291 | name = "wasmprinter" 1292 | version = "0.239.0" 1293 | source = "registry+https://github.com/rust-lang/crates.io-index" 1294 | checksum = "b3981f3d51f39f24f5fc90f93049a90f08dbbca8deba602cd46bb8ca67a94718" 1295 | dependencies = [ 1296 | "anyhow", 1297 | "termcolor", 1298 | "wasmparser 0.239.0", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "wast" 1303 | version = "239.0.0" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "9139176fe8a2590e0fb174cdcaf373b224cb93c3dde08e4297c1361d2ba1ea5d" 1306 | dependencies = [ 1307 | "bumpalo", 1308 | "leb128fmt", 1309 | "memchr", 1310 | "unicode-width 0.2.1", 1311 | "wasm-encoder 0.239.0", 1312 | ] 1313 | 1314 | [[package]] 1315 | name = "wat" 1316 | version = "1.239.0" 1317 | source = "registry+https://github.com/rust-lang/crates.io-index" 1318 | checksum = "3e1c941927d34709f255558166f8901a2005f8ab4a9650432e9281b7cc6f3b75" 1319 | dependencies = [ 1320 | "wast", 1321 | ] 1322 | 1323 | [[package]] 1324 | name = "winapi-util" 1325 | version = "0.1.11" 1326 | source = "registry+https://github.com/rust-lang/crates.io-index" 1327 | checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" 1328 | dependencies = [ 1329 | "windows-sys 0.61.0", 1330 | ] 1331 | 1332 | [[package]] 1333 | name = "windows-link" 1334 | version = "0.1.3" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" 1337 | 1338 | [[package]] 1339 | name = "windows-link" 1340 | version = "0.2.0" 1341 | source = "registry+https://github.com/rust-lang/crates.io-index" 1342 | checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" 1343 | 1344 | [[package]] 1345 | name = "windows-sys" 1346 | version = "0.59.0" 1347 | source = "registry+https://github.com/rust-lang/crates.io-index" 1348 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 1349 | dependencies = [ 1350 | "windows-targets 0.52.6", 1351 | ] 1352 | 1353 | [[package]] 1354 | name = "windows-sys" 1355 | version = "0.60.2" 1356 | source = "registry+https://github.com/rust-lang/crates.io-index" 1357 | checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" 1358 | dependencies = [ 1359 | "windows-targets 0.53.3", 1360 | ] 1361 | 1362 | [[package]] 1363 | name = "windows-sys" 1364 | version = "0.61.0" 1365 | source = "registry+https://github.com/rust-lang/crates.io-index" 1366 | checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" 1367 | dependencies = [ 1368 | "windows-link 0.2.0", 1369 | ] 1370 | 1371 | [[package]] 1372 | name = "windows-targets" 1373 | version = "0.52.6" 1374 | source = "registry+https://github.com/rust-lang/crates.io-index" 1375 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1376 | dependencies = [ 1377 | "windows_aarch64_gnullvm 0.52.6", 1378 | "windows_aarch64_msvc 0.52.6", 1379 | "windows_i686_gnu 0.52.6", 1380 | "windows_i686_gnullvm 0.52.6", 1381 | "windows_i686_msvc 0.52.6", 1382 | "windows_x86_64_gnu 0.52.6", 1383 | "windows_x86_64_gnullvm 0.52.6", 1384 | "windows_x86_64_msvc 0.52.6", 1385 | ] 1386 | 1387 | [[package]] 1388 | name = "windows-targets" 1389 | version = "0.53.3" 1390 | source = "registry+https://github.com/rust-lang/crates.io-index" 1391 | checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" 1392 | dependencies = [ 1393 | "windows-link 0.1.3", 1394 | "windows_aarch64_gnullvm 0.53.0", 1395 | "windows_aarch64_msvc 0.53.0", 1396 | "windows_i686_gnu 0.53.0", 1397 | "windows_i686_gnullvm 0.53.0", 1398 | "windows_i686_msvc 0.53.0", 1399 | "windows_x86_64_gnu 0.53.0", 1400 | "windows_x86_64_gnullvm 0.53.0", 1401 | "windows_x86_64_msvc 0.53.0", 1402 | ] 1403 | 1404 | [[package]] 1405 | name = "windows_aarch64_gnullvm" 1406 | version = "0.52.6" 1407 | source = "registry+https://github.com/rust-lang/crates.io-index" 1408 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1409 | 1410 | [[package]] 1411 | name = "windows_aarch64_gnullvm" 1412 | version = "0.53.0" 1413 | source = "registry+https://github.com/rust-lang/crates.io-index" 1414 | checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" 1415 | 1416 | [[package]] 1417 | name = "windows_aarch64_msvc" 1418 | version = "0.52.6" 1419 | source = "registry+https://github.com/rust-lang/crates.io-index" 1420 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1421 | 1422 | [[package]] 1423 | name = "windows_aarch64_msvc" 1424 | version = "0.53.0" 1425 | source = "registry+https://github.com/rust-lang/crates.io-index" 1426 | checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" 1427 | 1428 | [[package]] 1429 | name = "windows_i686_gnu" 1430 | version = "0.52.6" 1431 | source = "registry+https://github.com/rust-lang/crates.io-index" 1432 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1433 | 1434 | [[package]] 1435 | name = "windows_i686_gnu" 1436 | version = "0.53.0" 1437 | source = "registry+https://github.com/rust-lang/crates.io-index" 1438 | checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" 1439 | 1440 | [[package]] 1441 | name = "windows_i686_gnullvm" 1442 | version = "0.52.6" 1443 | source = "registry+https://github.com/rust-lang/crates.io-index" 1444 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1445 | 1446 | [[package]] 1447 | name = "windows_i686_gnullvm" 1448 | version = "0.53.0" 1449 | source = "registry+https://github.com/rust-lang/crates.io-index" 1450 | checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" 1451 | 1452 | [[package]] 1453 | name = "windows_i686_msvc" 1454 | version = "0.52.6" 1455 | source = "registry+https://github.com/rust-lang/crates.io-index" 1456 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1457 | 1458 | [[package]] 1459 | name = "windows_i686_msvc" 1460 | version = "0.53.0" 1461 | source = "registry+https://github.com/rust-lang/crates.io-index" 1462 | checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" 1463 | 1464 | [[package]] 1465 | name = "windows_x86_64_gnu" 1466 | version = "0.52.6" 1467 | source = "registry+https://github.com/rust-lang/crates.io-index" 1468 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1469 | 1470 | [[package]] 1471 | name = "windows_x86_64_gnu" 1472 | version = "0.53.0" 1473 | source = "registry+https://github.com/rust-lang/crates.io-index" 1474 | checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" 1475 | 1476 | [[package]] 1477 | name = "windows_x86_64_gnullvm" 1478 | version = "0.52.6" 1479 | source = "registry+https://github.com/rust-lang/crates.io-index" 1480 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1481 | 1482 | [[package]] 1483 | name = "windows_x86_64_gnullvm" 1484 | version = "0.53.0" 1485 | source = "registry+https://github.com/rust-lang/crates.io-index" 1486 | checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" 1487 | 1488 | [[package]] 1489 | name = "windows_x86_64_msvc" 1490 | version = "0.52.6" 1491 | source = "registry+https://github.com/rust-lang/crates.io-index" 1492 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1493 | 1494 | [[package]] 1495 | name = "windows_x86_64_msvc" 1496 | version = "0.53.0" 1497 | source = "registry+https://github.com/rust-lang/crates.io-index" 1498 | checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 1499 | 1500 | [[package]] 1501 | name = "wit-bindgen" 1502 | version = "0.46.0" 1503 | source = "registry+https://github.com/rust-lang/crates.io-index" 1504 | checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" 1505 | 1506 | [[package]] 1507 | name = "zerocopy" 1508 | version = "0.8.27" 1509 | source = "registry+https://github.com/rust-lang/crates.io-index" 1510 | checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" 1511 | dependencies = [ 1512 | "zerocopy-derive", 1513 | ] 1514 | 1515 | [[package]] 1516 | name = "zerocopy-derive" 1517 | version = "0.8.27" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" 1520 | dependencies = [ 1521 | "proc-macro2", 1522 | "quote", 1523 | "syn 2.0.106", 1524 | ] 1525 | --------------------------------------------------------------------------------