Skip to content

fix: show Run lens for fn main in bench targets#22357

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
MavenRain:fix-bench-run-lens
May 14, 2026
Merged

fix: show Run lens for fn main in bench targets#22357
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
MavenRain:fix-bench-run-lens

Conversation

@MavenRain
Copy link
Copy Markdown
Contributor

crates/rust-analyzer/src/handlers/request.rs enumerates TargetKind::Bin | TargetKind::Example | TargetKind::Test in two places (code-lens annotation config at line 1660 and should_skip_target at line 2341) but omits TargetKind::Bench. The existing analogous list in target_spec.rs:255 does include Bench, so this looks like a copy-paste oversight. Result: a fn main() in benches/*.rs with harness = false produces a RunnableKind::Bin runnable, but the annotation layer's should_skip_runnable skips it because the LSP config passes binary_target = false for bench targets.

Closes #21948.

  `request.rs` was passing `binary_target = true` for
  TargetKind::Bin, Example, and Test, but not for Bench, so a
  `fn main()` in `benches/foo.rs` (typical with
  `harness = false`) was suppressed by `should_skip_runnable`
  in the annotations layer.  Mirror `target_spec.rs:255` by
  including Bench in both the code-lens config check and
  `should_skip_target`.

  Closes rust-lang#21948.

Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2026
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 14, 2026
Merged via the queue into rust-lang:master with commit 331854d May 14, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2026
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.

Benchmarks don't have a "▶Run" button

3 participants