Description
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:
- The first character must be a Unicode XID start character (most letters), a digit, or
_
. - Subsequent characters must be a Unicode XID continue character (a digit,
_
, or most letters),-
, or+
.
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.