cargo-show-asm shows the code rustc actually produced
cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code
At a glance
- What is it?
- cargo-show-asm is a cargo subcommand that prints the assembly, the LLVM IR, the MIR or the WebAssembly behind a Rust function, and can interleave the original Rust source with the instructions so you can see which line produced which instruction. It is the tool you reach for when a benchmark says a function is slow and you need to know what the compiler did with it.
- Who is it for?
- cargo-show-asm suits a developer who has to explain a performance result to somebody else, since the interleaved source view turns an instruction dump into an argument, and it suits anyone learning what their Rust compiles to. It is a poor fit if you want a profiler, since it shows you what was generated rather than what ran, and it is a poor fit if your work happens on Windows, where the support is described as limited.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
It answers a question the optimiser will not volunteer
The tool is described in one line, a cargo subcommand that displays the assembly, LLVM IR, MIR and Wasm generated for Rust source code. The value is that this is the layer between your code and the machine, and it is the layer that goes wrong quietly. A function marked inline that was not inlined, a bounds check that survived, a vectorised loop that did not vectorise, a branch the optimiser predicted differently from what the source suggests. Reading the generated code settles those questions in a way that a flame graph cannot, because a flame graph tells you where the time went while this tells you what the compiler did. It also serves as a teaching tool, since the same command that answers a performance question shows a learner what their `for` loop became.
Narrow from the package to the function
The usage is a filter chain, and the documentation walks through it in three steps. First you focus on a single assembly producing target, which in the example is the library of a package called `isin`:
% cargo asm -p isin --libThen you narrow down to a function by giving a fragment of its name, and the fragment is the interesting part, because it is a filter rather than an exact match:
% cargo asm -p isin --lib from_And then you ask for the full result with the exact path:
% cargo asm -p isin --lib isin::base36::from_alphanumThe package option is required for workspace projects and can point at a dependency rather than your own code, which is how you would look at what a crate in your lock file actually compiles to. You can also select a different artifact with `--test`, `--bench`, `--example` or `--bin`, and the tool passes the usual cargo options through, including `--release`, which is the default, `--dev`, `--profile`, `--target` for cross compilation, `--target-dir`, and the `--frozen`, `--locked` and `--offline` switches, plus `-C` for rustc codegen flags and `-Z` for nightly cargo flags.
Six kinds of output, from machine code to MIR
The output type is chosen with a flag, and the set covers the whole compilation pipeline. `--asm` is the assembly, with `--intel` and `--att` choosing the syntax. `--disasm` disassembles binaries or object files instead of going through cargo, which is the mode for looking at something that was already built. `--llvm` shows the LLVM IR after the usual passes and `--llvm-input` shows it before any of them, and that pair is the one to reach for when a pass is misbehaving. `--mir` shows the MIR, which is the compiler's own mid-level representation and the place to look when a borrow check or an optimisation decision surprises you. `--wasm` shows the WebAssembly and needs the `wasm32-unknown-unknown` target installed. And `--mca` runs an llvm-mca analysis, which is the static throughput estimate, with extra parameters for the tool passed through `--mca-arg`. Each of these is a different question about the same function, and the tool exists so you can move up and down the pipeline without rebuilding the project by hand.
Interleaved source, and the label options that make it readable
The feature that turns a wall of assembly into something readable is `--rust`, which prints the Rust code interleaved with the instructions. Everything else in the postprocessing list exists to make that output survive contact with a real project. There are three ways to handle labels, which are the block markers in the disassembly, since different targets and different tool versions produce them differently. `-K` keeps all the original labels, `-B` strips the redundant ones but keeps the spaces in their place, and `-R` strips them entirely. Names have three settings too, with `--full-name` for the whole demangled name, `--short-name` for the demangled name without the hash suffix as the default, and `--keep-mangled` to leave the raw symbol. Then there is `--simplify` to strip some of the non-instruction information, `--include-constants` to pull in the sections holding string literals, `--context` to include the functions that are called, recursively, up to a given depth, and the source scope options, where `--this-workspace` shows only your own sources, `--all-crates` adds the sources from the registry, and `--all-sources` includes the standard library and the compiler itself.
Reading the call graph backwards
Most of these tools answer a question forwards, given a function, what does it compile to. The `--callers-of` filter answers it the other way, listing the functions that call something matching a regular expression, with an optional depth to control how far up the call graph it walks. That is the flag you want when a function you do not recognise shows up in a profile and you need to find who is responsible for it. The selection of what to display at the end is also more flexible than a single function name, since `--everything` dumps the whole file, a function name filters by name with multiple filters allowed when every one has to match, and an index selects a specific function when several share the same name, which happens with generics and with monomorphised copies.
The dependency list is the feature list
The manifest explains how the tool is put together, and the optional dependencies map exactly onto the optional capabilities. The core dependencies are the ordinary ones for a command line tool, anyhow for errors, bpaf for argument parsing with autocomplete enabled, cargo_metadata to inspect the workspace, nom for parsing, regex, serde for the JSON output, rustc-demangle for the name options, owo-colors and supports-color for the colour handling, and line-span and same-file for source mapping. Then the optional ones are the disassembly stack, with addr2line and gimli for the debug information, the `ar` crate for archives, capstone as the disassembler and object for reading binaries, and the whole group is behind the `disasm` feature, which is why the `--file` option says it requires the tool to be compiled with that feature. The default features are the unstable cargo metadata behaviour and a dull colour palette, with a bright colour option as the alternative, and the release profile has a separate LTO variant for the slowest build.
What to check before you rely on it
Three practical things. The platform support is spelled out as Linux and macOS with limited support for Windows, and the Rust support is both nightly and stable, with the architectures listed as x86, x86_64 and aarch64, and cross compilation is supported through the usual cargo `--target` flag. The minimum supported Rust version in the manifest is 1.88 and the edition is 2024, so an older toolchain will not build it. And the licence is a dual one, MIT or Apache-2.0, with the two licence files in the repository root, which is the usual choice for a tool that people may want to vendor. The repository also carries several sample projects, a plain one plus cdylib, merged and rlib variants, and a `tests/` directory, so the tool is exercised against the different artifact shapes it has to handle. There are no tagged releases, and the last push to the repository was on 2026-09-21, so the tool is installed from crates.io rather than from a release artefact.
Editorial conclusion
cargo-show-asm suits a developer who has to explain a performance result to somebody else, since the interleaved source view turns an instruction dump into an argument, and it suits anyone learning what their Rust compiles to. It is a poor fit if you want a profiler, since it shows you what was generated rather than what ran, and it is a poor fit if your work happens on Windows, where the support is described as limited. Before you install it, check three things: which output you actually need, because the disassembly of binaries and object files requires the optional feature and its own dependencies, whether your Rust version is new enough, with the manifest asking for 1.88 and edition 2024, and which licence you want, since the project is offered under MIT or Apache-2.0 and the last push to the repository was on 2026-09-21.
Frequently asked questions
What does cargo-show-asm show?
The assembly, the LLVM IR, the rustc MIR and the WebAssembly that rustc generated for Rust source code. The output type is chosen with flags, `--asm`, `--disasm`, `--llvm`, `--llvm-input`, `--mir`, `--wasm` and `--mca`, and `--rust` interleaves the original Rust source with the instructions.
How do I install cargo-show-asm?
With `cargo install cargo-show-asm`. The project is licensed MIT or Apache-2.0, is written in Rust on edition 2024 with a minimum supported Rust version of 1.88, and the last push to the repository was on 2026-09-21.
How do I look at one function with cargo asm?
Give a package and an artifact, then narrow by name. The documentation shows `cargo asm -p isin --lib` for the whole library, `cargo asm -p isin --lib from_` to filter by a fragment of the function name, and `cargo asm -p isin --lib isin::base36::from_alphanum` for the exact function. The package option is required for workspace projects and can point at a dependency.
Which platforms does cargo-show-asm support?
Linux and macOS with limited support for Windows, on both nightly and stable Rust, for the x86, x86_64 and aarch64 architectures, with cross compilation support through the usual cargo target flag. The WebAssembly output additionally needs the wasm32-unknown-unknown target installed.
Does cargo-show-asm need any optional dependencies for disassembly?
Yes. Disassembling binaries or object files with `--file` requires the tool to be compiled with the disasm feature, which pulls in addr2line, gimli, the ar crate, capstone and object. That whole group is optional in the manifest and is not part of the default features.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/pacak-cargo-show-asm)Was this useful?