Skip to content

Tracking issue for restricted feature name syntax. #8813

Closed
@ehuss

Description

@ehuss

This issue is for tracking a backwards-incompatible change to add new restrictions to the syntax of a feature name.

Historically, Cargo has been extremely permissive for feature names, allowing them to be any string as long as it isn't empty. crates.io has imposed its own limitations on feature names, specifically all characters must be is_ascii_alphanumeric, -, _, or +.

We would like to introduce new syntax to the feature system to introduce new capabilities. For example, prefixes such as dep:, or the ? character for weakly enabling features. However, this extended syntax may conflict with existing feature names if a project is using punctuation or other symbols in their feature names.

The new feature name restrictions are:

This is being initially implemented as a warning with the intent to make it an error sometime in the future.

We do not expect this to be a problem for projects, since crates.io already imposes strict requirements on the feature name syntax. However, for projects that aren't published to crates.io, it may be possible that they will conflict with the new restrictions.

If your project has encountered the new warning, please leave a comment explaining which characters you are using with an example, and an indication if it would be difficult or possible for you to transition to the more restrictive syntax.

Metadata

Metadata

Assignees

Labels

A-featuresArea: features — conditional compilationC-tracking-issueCategory: A tracking issue for something unstable.S-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.S-waiting-on-feedbackStatus: An implemented feature is waiting on community feedback for bugs or design concerns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions