Skip to content

Commit d00d64d

Browse files
committed
Auto merge of #8943 - ehuss:beta-features-with-dot, r=Eh2406
[beta] Add period to allowed feature name characters. Beta backport of #8932.
2 parents c1dfca0 + 7bd820d commit d00d64d

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

src/cargo/core/summary.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,11 @@ fn validate_feature_name(config: &Config, pkg_id: PackageId, name: &str) -> Carg
460460
}
461461
}
462462
for ch in chars {
463-
if !(unicode_xid::UnicodeXID::is_xid_continue(ch) || ch == '-' || ch == '+') {
463+
if !(unicode_xid::UnicodeXID::is_xid_continue(ch) || ch == '-' || ch == '+' || ch == '.') {
464464
config.shell().warn(&format!(
465465
"invalid character `{}` in feature `{}` in package {}, \
466-
characters must be Unicode XID characters or `+` \
467-
(numbers, `+`, `-`, `_`, or most letters)\n\
466+
characters must be Unicode XID characters, `+`, or `.` \
467+
(numbers, `+`, `-`, `_`, `.`, or most letters)\n\
468468
{}",
469469
ch, name, pkg_id, FUTURE
470470
))?;

src/doc/src/reference/semver.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub struct Foo {
224224
///////////////////////////////////////////////////////////
225225
// Example usage that will break.
226226
fn main() {
227-
let x = updated_crate::Foo { f1: 123 }; // Error: missing field `f2`
227+
let x = updated_crate::Foo { f1: 123 }; // Error: cannot construct `Foo`
228228
}
229229
```
230230

@@ -738,7 +738,7 @@ pub struct Foo<A: Eq> {
738738
use updated_crate::Foo;
739739
740740
fn main() {
741-
let s = Foo { f1: 1.23 }; // Error: the trait bound `{float}: std::cmp::Eq` is not satisfied
741+
let s = Foo { f1: 1.23 }; // Error: the trait bound `{float}: Eq` is not satisfied
742742
}
743743
```
744744

@@ -1070,7 +1070,7 @@ pub fn foo<T: Copy + IntoIterator<Item = u8>>(x: T) {}
10701070
use updated_crate::foo;
10711071
10721072
fn main() {
1073-
foo(vec![1, 2, 3]); // Error: `std::marker::Copy` is not implemented for `std::vec::Vec<u8>`
1073+
foo(vec![1, 2, 3]); // Error: `Copy` is not implemented for `Vec<u8>`
10741074
}
10751075
```
10761076

tests/testsuite/features.rs

+13-19
Original file line numberDiff line numberDiff line change
@@ -1993,14 +1993,14 @@ fn invalid_feature_names() {
19931993
"_foo" = []
19941994
"feat-name" = []
19951995
"feat_name" = []
1996+
"foo.bar" = []
19961997
19971998
# Invalid names.
19981999
"+foo" = []
19992000
"-foo" = []
20002001
".foo" = []
20012002
"foo/bar" = []
20022003
"foo:bar" = []
2003-
"foo.bar" = []
20042004
"foo?" = []
20052005
"?foo" = []
20062006
"ⒶⒷⒸ" = []
@@ -2028,28 +2028,25 @@ For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues
20282028
[WARNING] invalid character `?` in feature `?foo` in package foo v0.1.0 ([ROOT]/foo), the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)
20292029
This was previously accepted but is being phased out; it will become a hard error in a future release.
20302030
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2031-
[WARNING] invalid character `¼` in feature `a¼` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2032-
This was previously accepted but is being phased out; it will become a hard error in a future release.
2033-
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2034-
[WARNING] invalid character `.` in feature `foo.bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2031+
[WARNING] invalid character `¼` in feature `a¼` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20352032
This was previously accepted but is being phased out; it will become a hard error in a future release.
20362033
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2037-
[WARNING] invalid character `/` in feature `foo/bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2034+
[WARNING] invalid character `/` in feature `foo/bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20382035
This was previously accepted but is being phased out; it will become a hard error in a future release.
20392036
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2040-
[WARNING] invalid character `:` in feature `foo:bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2037+
[WARNING] invalid character `:` in feature `foo:bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20412038
This was previously accepted but is being phased out; it will become a hard error in a future release.
20422039
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2043-
[WARNING] invalid character `?` in feature `foo?` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2040+
[WARNING] invalid character `?` in feature `foo?` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20442041
This was previously accepted but is being phased out; it will become a hard error in a future release.
20452042
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
20462043
[WARNING] invalid character `Ⓐ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)
20472044
This was previously accepted but is being phased out; it will become a hard error in a future release.
20482045
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2049-
[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2046+
[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20502047
This was previously accepted but is being phased out; it will become a hard error in a future release.
20512048
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2052-
[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2049+
[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20532050
This was previously accepted but is being phased out; it will become a hard error in a future release.
20542051
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
20552052
[WARNING] invalid character `+` in feature `+foo` in package foo v0.1.0 ([ROOT]/foo), the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)
@@ -2064,28 +2061,25 @@ For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues
20642061
[WARNING] invalid character `?` in feature `?foo` in package foo v0.1.0 ([ROOT]/foo), the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)
20652062
This was previously accepted but is being phased out; it will become a hard error in a future release.
20662063
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2067-
[WARNING] invalid character `¼` in feature `a¼` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2068-
This was previously accepted but is being phased out; it will become a hard error in a future release.
2069-
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2070-
[WARNING] invalid character `.` in feature `foo.bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2064+
[WARNING] invalid character `¼` in feature `a¼` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20712065
This was previously accepted but is being phased out; it will become a hard error in a future release.
20722066
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2073-
[WARNING] invalid character `/` in feature `foo/bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2067+
[WARNING] invalid character `/` in feature `foo/bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20742068
This was previously accepted but is being phased out; it will become a hard error in a future release.
20752069
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2076-
[WARNING] invalid character `:` in feature `foo:bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2070+
[WARNING] invalid character `:` in feature `foo:bar` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20772071
This was previously accepted but is being phased out; it will become a hard error in a future release.
20782072
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2079-
[WARNING] invalid character `?` in feature `foo?` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2073+
[WARNING] invalid character `?` in feature `foo?` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20802074
This was previously accepted but is being phased out; it will become a hard error in a future release.
20812075
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
20822076
[WARNING] invalid character `Ⓐ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), the first character must be a Unicode XID start character or digit (most letters or `_` or `0` to `9`)
20832077
This was previously accepted but is being phased out; it will become a hard error in a future release.
20842078
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2085-
[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2079+
[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20862080
This was previously accepted but is being phased out; it will become a hard error in a future release.
20872081
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
2088-
[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters)
2082+
[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
20892083
This was previously accepted but is being phased out; it will become a hard error in a future release.
20902084
For more information, see issue #8813 <https://github.com/rust-lang/cargo/issues/8813>, and please leave a comment if this will be a problem for your project.
20912085
[CHECKING] foo v0.1.0 [..]

0 commit comments

Comments
 (0)