You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #12291 - ehuss:feature-name-error, r=weihanglo
Convert valid feature name warning to an error.
This converts the feature name validation check from a warning to an error. This was added in #8814 in Rust 1.49 released in 2020-12-31 (about 2.5 years ago) with a warning that it will become a hard error in the future.
These extended characters aren't allowed on crates.io, so this should only impact users of other registries, or people who don't publish to a registry. The warning message requested anyone impacted by it to let us know. We got one report, and added support for . as result. Since there weren't any other reports, I think it should be pretty safe to move forward.
The diff here is a little large because it removes the pass-through of `config` since it isn't needed anymore.
Additionally, the tests were restructured since testing every edge case in an integration test has a lot of overhead. Instead, there is now a unit test which runs much faster, with the integration test just verifying that it fires and checks the two forms of error messages.
Closes#8813
// Unfortunately the warnings are duplicated due to the Summary being
1974
-
// loaded twice (once in the Workspace, and once in PackageRegistry) and
1975
-
// Cargo does not have a de-duplication system. This should probably be
1976
-
// OK, since I'm not expecting this to affect anyone.
1977
1958
p.cargo("check")
1978
-
.with_stderr("\
1979
-
[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`)
1980
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1981
-
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.
1982
-
[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`)
1983
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1984
-
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.
1985
-
[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`)
1986
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1987
-
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.
1988
-
[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`)
1989
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1990
-
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.
1991
-
[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)
1992
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1993
-
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.
1994
-
[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)
1995
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1996
-
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.
1997
-
[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)
1998
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
1999
-
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.
2000
-
[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`)
2001
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
2002
-
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.
2003
-
[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
2004
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
2005
-
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.
2006
-
[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters)
2007
-
This was previously accepted but is being phased out; it will become a hard error in a future release.
2008
-
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.
2009
-
[CHECKING] foo v0.1.0 [..]
2010
-
[FINISHED] [..]
2011
-
")
1959
+
.with_status(101)
1960
+
.with_stderr(
1961
+
"\
1962
+
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
1963
+
1964
+
Caused by:
1965
+
invalid character `+` in feature `+foo` in package foo v0.1.0 ([ROOT]/foo), \
1966
+
the first character must be a Unicode XID start character or digit \
1967
+
(most letters or `_` or `0` to `9`)
1968
+
",
1969
+
)
1970
+
.run();
1971
+
1972
+
p.change_file(
1973
+
"Cargo.toml",
1974
+
r#"
1975
+
[package]
1976
+
name = "foo"
1977
+
version = "0.1.0"
1978
+
1979
+
[features]
1980
+
# Invalid continue character.
1981
+
"a&b" = []
1982
+
"#,
1983
+
);
1984
+
1985
+
p.cargo("check")
1986
+
.with_status(101)
1987
+
.with_stderr(
1988
+
"\
1989
+
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
1990
+
1991
+
Caused by:
1992
+
invalid character `&` in feature `a&b` in package foo v0.1.0 ([ROOT]/foo), \
1993
+
characters must be Unicode XID characters, `+`, or `.` \
0 commit comments