CRATER: Analyze effect of format_args! deduplication#154205
CRATER: Analyze effect of format_args! deduplication#154205traviscross wants to merge 5 commits intorust-lang:mainfrom
format_args! deduplication#154205Conversation
Co-authored-by: Shoyu Vanilla (Flint) <modulo641@gmail.com>
|
@bors try |
This comment has been minimized.
This comment has been minimized.
…cation, r=<try> CRATER: Analyze effect `format_args!` deduplication
format_args! deduplicationformat_args! deduplication
When crater tests a crate, `cargo build` compiles all of its dependencies too, and each dependency's `format_args!` invocations were producing `[FMTARGS]` lines in the same log. This inflates the totals -- a popular crate like `serde` gets counted once per test subject that depends on it -- and makes per-crate attribution meaningless. Cargo already distinguishes root crates from dependencies: it passes `--cap-lints allow` to rustc for dependencies, which is how dependency warnings are suppressed. Let's use the same signal. We check `self.tcx.sess.opts.lint_cap` and skip the instrumentation output when it's `Some(Allow)`. We also add a `"crate"` field to the JSON output with the crate name (via `tcx.crate_name(LOCAL_CRATE)`) for sanity checking. With this, each crater log contains `[FMTARGS]` lines only from the crate being tested, which gives correct ecosystem-wide counts without post-hoc deduplication.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
…cation, r=<try> CRATER: Analyze effect of `format_args!` deduplication
|
@craterbot run mode=check-only crates=top-10000 p=1 |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
The structural deduplication we used in the first crater run can't
distinguish different format strings that happen to have identical
property profiles. Without a source location identifier, two
`println!("{x} is valid")` and `println!("{y} is ready")` in the same
crate produce identical JSON and collapse into one "unique"
invocation.
Let's add a `"loc"` field containing `file:line:col` derived from
`fmt.span.lo()`. With this, the analysis script can deduplicate on
`(crate, loc)` -- correctly collapsing multi-target compilations of
the same source-level `format_args!` while keeping structurally
similar but distinct invocations separate.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
…cation, r=<try> CRATER: Analyze effect of `format_args!` deduplication
|
@craterbot run mode=check-only crates=top-10000 p=1 |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
|
Thanks craterbot. |
|
Apparently @craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
View all comments
This is an instrumented rustc for doing a crater run to analyze:
format_args!#149926format_args!: only de-duplicate captured identifiers that refer to places #152480cc @dianne @nikomatsakis