Skip to content

Consider rlib targets in addition to lib targets#430

Merged
djc merged 2 commits intoflamegraph-rs:mainfrom
divergentdave:lib-or-rlib
Jan 30, 2026
Merged

Consider rlib targets in addition to lib targets#430
djc merged 2 commits intoflamegraph-rs:mainfrom
divergentdave:lib-or-rlib

Conversation

@divergentdave
Copy link
Contributor

This changes target filtering in cargo-flamegraph to consider TargetKind::Rlib in addition to TargetKind::Lib. If the crate-type metadata has been customized, such that it no longer contains the default of lib, this affects the TargetKind seen in the list of targets produced by cargo metadata. The lib crate type acts as an alias for a different library type, depending on context. Thus, we should consider rlib targets when trying to run unit tests, just as we consider lib. The --unit-test-kind CLI option still has possible values of bin and lib, but the latter now checks for both kinds of library targets. This closes #422. I have tested this on crates with a crate-type that includes lib, rlib, and both.

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Curious what you're benchmarking...

@divergentdave
Copy link
Contributor Author

This came up with zk-cred-longfellow. We customized crate-type because we're targeting WASM.

@djc djc merged commit c0c0bcc into flamegraph-rs:main Jan 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failes when [lib] section included in Cargo.toml

2 participants