File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -431,6 +431,9 @@ impl fmt::Display for FeatureValue {
431431pub type FeatureMap = BTreeMap < InternedString , Vec < FeatureValue > > ;
432432
433433fn validate_feature_name ( pkg_id : PackageId , name : & str ) -> CargoResult < ( ) > {
434+ if name. is_empty ( ) {
435+ bail ! ( "feature name cannot be empty" ) ;
436+ }
434437 let mut chars = name. chars ( ) ;
435438 if let Some ( ch) = chars. next ( ) {
436439 if !( unicode_xid:: UnicodeXID :: is_xid_start ( ch) || ch == '_' || ch. is_digit ( 10 ) ) {
@@ -488,5 +491,6 @@ mod tests {
488491 assert ! ( validate_feature_name( pkg_id, "?foo" ) . is_err( ) ) ;
489492 assert ! ( validate_feature_name( pkg_id, "ⒶⒷⒸ" ) . is_err( ) ) ;
490493 assert ! ( validate_feature_name( pkg_id, "a¼" ) . is_err( ) ) ;
494+ assert ! ( validate_feature_name( pkg_id, "" ) . is_err( ) ) ;
491495 }
492496}
You can’t perform that action at this time.
0 commit comments