From 05d0992fa576122af7f39ce0f1084f5c5628d637 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 2 Dec 2020 07:56:44 -0800 Subject: [PATCH 1/2] Add period to allowed feature name characters. --- src/cargo/core/summary.rs | 6 +++--- tests/testsuite/features.rs | 32 +++++++++++++------------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/cargo/core/summary.rs b/src/cargo/core/summary.rs index eb7a80e041a..073d4b59496 100644 --- a/src/cargo/core/summary.rs +++ b/src/cargo/core/summary.rs @@ -460,11 +460,11 @@ fn validate_feature_name(config: &Config, pkg_id: PackageId, name: &str) -> Carg } } for ch in chars { - if !(unicode_xid::UnicodeXID::is_xid_continue(ch) || ch == '-' || ch == '+') { + if !(unicode_xid::UnicodeXID::is_xid_continue(ch) || ch == '-' || ch == '+' || ch == '.') { config.shell().warn(&format!( "invalid character `{}` in feature `{}` in package {}, \ - characters must be Unicode XID characters or `+` \ - (numbers, `+`, `-`, `_`, or most letters)\n\ + characters must be Unicode XID characters, `+`, or `.` \ + (numbers, `+`, `-`, `_`, `.`, or most letters)\n\ {}", ch, name, pkg_id, FUTURE ))?; diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 9c8713450fb..6bd49e80109 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -1993,6 +1993,7 @@ fn invalid_feature_names() { "_foo" = [] "feat-name" = [] "feat_name" = [] + "foo.bar" = [] # Invalid names. "+foo" = [] @@ -2000,7 +2001,6 @@ fn invalid_feature_names() { ".foo" = [] "foo/bar" = [] "foo:bar" = [] - "foo.bar" = [] "foo?" = [] "?foo" = [] "ⒶⒷⒸ" = [] @@ -2028,28 +2028,25 @@ For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) -This was previously accepted but is being phased out; it will become a hard error in a future release. -For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. [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`) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters) +[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters) +[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. [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 , and please leave a comment if this will be a problem for your project. -[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) -This was previously accepted but is being phased out; it will become a hard error in a future release. -For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[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) +[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) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. [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`) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters) +[WARNING] invalid character `Ⓑ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. -[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters or `+` (numbers, `+`, `-`, `_`, or most letters) +[WARNING] invalid character `Ⓒ` in feature `ⒶⒷⒸ` in package foo v0.1.0 ([ROOT]/foo), characters must be Unicode XID characters, `+`, or `.` (numbers, `+`, `-`, `_`, `.`, or most letters) This was previously accepted but is being phased out; it will become a hard error in a future release. For more information, see issue #8813 , and please leave a comment if this will be a problem for your project. [CHECKING] foo v0.1.0 [..] From 7bd820d02f6e79a7319854c4f027178ba438c623 Mon Sep 17 00:00:00 2001 From: bors Date: Wed, 2 Dec 2020 14:39:12 +0000 Subject: [PATCH 2/2] Auto merge of #8930 - ehuss:fix-semver-msg, r=Eh2406 Fix semver documentation tests. GitHub just updated the VM image to include the latest stable rust (1.48), which included some minor changes to diagnostic outputs. This updates the semver chapter tests which validates that the correct error is displayed for the 1.48 release. These diagnostics were changed via https://github.com/rust-lang/rust/pull/76524 and https://github.com/rust-lang/rust/pull/73996. --- src/doc/src/reference/semver.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/src/reference/semver.md b/src/doc/src/reference/semver.md index d4a8b7979c2..f081321838e 100644 --- a/src/doc/src/reference/semver.md +++ b/src/doc/src/reference/semver.md @@ -224,7 +224,7 @@ pub struct Foo { /////////////////////////////////////////////////////////// // Example usage that will break. fn main() { - let x = updated_crate::Foo { f1: 123 }; // Error: missing field `f2` + let x = updated_crate::Foo { f1: 123 }; // Error: cannot construct `Foo` } ``` @@ -738,7 +738,7 @@ pub struct Foo { use updated_crate::Foo; fn main() { - let s = Foo { f1: 1.23 }; // Error: the trait bound `{float}: std::cmp::Eq` is not satisfied + let s = Foo { f1: 1.23 }; // Error: the trait bound `{float}: Eq` is not satisfied } ``` @@ -1070,7 +1070,7 @@ pub fn foo>(x: T) {} use updated_crate::foo; fn main() { - foo(vec![1, 2, 3]); // Error: `std::marker::Copy` is not implemented for `std::vec::Vec` + foo(vec![1, 2, 3]); // Error: `Copy` is not implemented for `Vec` } ```