-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: cargo wat
#142
Comments
I'd kind of expected |
If I just do $ RUST_BACKTRACE=1 cargo asm --target=wasm32-wasi nemolite2d_rs_lib::run_simulation
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', src/libcore/result.rs:1165:5
stack backtrace:
0: std::panicking::default_hook::{{closure}}
1: std::panicking::default_hook
2: std::panicking::rust_panic_with_hook
3: std::panicking::continue_panic_fmt
4: rust_begin_unwind
5: core::panicking::panic_fmt
6: core::result::unwrap_failed
7: cargo_asm::asm::ast::Directive::new
8: cargo_asm::asm::parse::function
9: cargo_asm::asm::run
10: cargo_asm::main
11: std::rt::lang_start::{{closure}}
12: std::panicking::try::do_call
13: __rust_maybe_catch_panic
14: std::rt::lang_start_internal
15: main
$ RUST_BACKTRACE=1 cargo asm --target=wasm32-unknown-unknown nemolite2d_rs_lib::run_simulation
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
0: std::panicking::default_hook::{{closure}}
1: std::panicking::default_hook
2: std::panicking::rust_panic_with_hook
3: std::panicking::continue_panic_fmt
4: rust_begin_unwind
5: core::panicking::panic_fmt
6: core::panicking::panic
7: cargo_asm::asm::ast::Directive::new
8: cargo_asm::asm::parse::function
9: cargo_asm::asm::run
10: cargo_asm::main
11: std::rt::lang_start::{{closure}}
12: std::panicking::try::do_call
13: __rust_maybe_catch_panic
14: std::rt::lang_start_internal
15: main |
I should probably include additional information: $ cargo asm --version
cargo-asm 0.1.16
$ rustc --version
rustc 1.39.0-nightly (c6e9c76c5 2019-09-04)
$ cargo --version
cargo 1.39.0-nightly (22f7dd049 2019-08-27) |
Ah yes, that makes sense.
For WASM, rustc assembly output probably outputs WASM textual format right ? I think this wouldn't be hard to implement. We just need to detect whether the target is a WASM target, and then use a different parser / AST for the WASM textual-format, of which I suppose there are many Rust crates available for that. |
👍 supporting |
Being able to see and compare generated asm and LLVM IR is super useful. It would great to be able to have another command to show the generated .wat or .wast (i.e. WebAssembly in text format) output so that it could be directly compared against the assembly and LLVM IR.
Thanks for a great package!
The text was updated successfully, but these errors were encountered: