Skip to content

CRATER: Analyze effect of format_args! deduplication#154205

Draft
traviscross wants to merge 5 commits intorust-lang:mainfrom
traviscross:TC/crater-for-format_args-deduplication
Draft

CRATER: Analyze effect of format_args! deduplication#154205
traviscross wants to merge 5 commits intorust-lang:mainfrom
traviscross:TC/crater-for-format_args-deduplication

Conversation

@traviscross
Copy link
Copy Markdown
Contributor

@traviscross traviscross commented Mar 22, 2026

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 22, 2026
@traviscross
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 22, 2026
…cation, r=<try>

CRATER: Analyze effect `format_args!` deduplication
@traviscross traviscross changed the title CRATER: Analyze effect format_args! deduplication CRATER: Analyze effect of format_args! deduplication Mar 22, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 22, 2026

☀️ Try build successful (CI)
Build commit: 34547a6 (34547a62f24f000c096164e9e68c12381940788d, parent: 562dee4820c458d823175268e41601d4c060588a)

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.
@traviscross
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 23, 2026
…cation, r=<try>

CRATER: Analyze effect of `format_args!` deduplication
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 23, 2026

☀️ Try build successful (CI)
Build commit: 1463461 (1463461488056994d1b84e8b752e7c11c7fae7aa, parent: bbe853615821442ef11d6cd42a30a73432b38d89)

@traviscross
Copy link
Copy Markdown
Contributor Author

@craterbot run mode=check-only crates=top-10000 p=1

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154205 created and queued.
🤖 Automatically detected try build 1463461
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2026
@rust-lang rust-lang deleted a comment from craterbot Mar 23, 2026
@craterbot
Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154205 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154205 is completed!
📊 0 regressed and 0 fixed (10000 total)
📊 47 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154205/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 24, 2026
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.
@traviscross
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 25, 2026
…cation, r=<try>

CRATER: Analyze effect of `format_args!` deduplication
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 25, 2026

☀️ Try build successful (CI)
Build commit: 38c2997 (38c2997544af84fe301d600d6896397738163002, parent: 8a703520e80d87d4423c01f9d4fbc9e5f6533a02)

@traviscross
Copy link
Copy Markdown
Contributor Author

@craterbot run mode=check-only crates=top-10000 p=1

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154205-1 created and queued.
🤖 Automatically detected try build 38c2997
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 25, 2026
@craterbot
Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154205-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154205-1 is completed!
📊 1 regressed and 0 fixed (10000 total)
📊 40 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154205-1/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Mar 26, 2026
@traviscross
Copy link
Copy Markdown
Contributor Author

Thanks craterbot.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 27, 2026
@traviscross traviscross reopened this Mar 27, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 27, 2026
@traviscross
Copy link
Copy Markdown
Contributor Author

Apparently top-{n} is broken. See rust-lang/crater#813.

@craterbot check

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154205-2 created and queued.
🤖 Automatically detected try build 38c2997
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 27, 2026
@rust-log-analyzer

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants