Skip to content

cargo: Ensure 'perf' doesn't enable 'std' implicitly #1150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2025

Conversation

Palkovsky
Copy link
Contributor

Enabling perf-literal in the regex implicitly enables std (through perf-literal-multisubstring in the regex-automata). Effectively, it is impossible to use enable perf for no-std targets.

Quoting @BurntSushi:

I think one could make the argument that features like perf-literal-multisubstring are generally orthogonal to whether a dependency on std should be introduced. Indeed, that feature does enable optimizations other than SIMD. So it seems perfectly cromulent to me that one might want to enable it without dependency on std.

So I think here is what I propose:

  • Remove the std feature from perf-literal-multisubstring.
  • Add a new section to the crate features docs prominently calling out that some of the SIMD optimizations require a dependency on std. And that most features, including perf-* features, will not also implicitly add a dependency on std. Instead, it is expected that users configuring the features for the crate will do that.

Fixes #1147

Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

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

It's possible this breaks people, but I consider this a bug fix.

@BurntSushi BurntSushi merged commit 63a26c1 into rust-lang:master Aug 24, 2025
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.

2 participants