Skip to content

[1.38] #[bench] accepted on stable but not beta #63798

Closed
@CAD97

Description

@CAD97

Initially reported by @e-oz here.

[playground]

fn main() {
    println!("Hello, world!");
}

#[bench]
fn example() {}

On stable, you're allowed to define #[bench] tests in your library, even if calling them requires nightly. This broke at least one stable user, so we should at least consider continuing to ignore #[bench]-annotated functions when not run via cargo bench.

Is there some way to get a crater run to determine which libraries are using #[bench] in an otherwise stable crate, so we can suggest that they move benchmarks into a dedicated folder?

Metadata

Metadata

Assignees

Labels

A-libtestArea: `#[test]` / the `test` libraryA-stabilityArea: `#[stable]`, `#[unstable]` etc.P-highHigh priorityT-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions