@@ -118,8 +118,17 @@ fn invalid_characters() {
118118 . with_status ( 101 )
119119 . with_stderr (
120120 "\
121- [ERROR] invalid character `.` in crate name: `foo.rs`, [..]
122- If you need a crate name to not match the directory name, consider using --name flag.
121+ [ERROR] invalid character `.` in package name: `foo.rs`, [..]
122+ If you need a package name to not match the directory name, consider using --name flag.
123+ If you need a binary with the name \" foo.rs\" , use a valid package name, \
124+ and set the binary name to be different from the package. \
125+ This can be done by setting the binary filename to `src/bin/foo.rs.rs` \
126+ or change the name in Cargo.toml with:
127+
128+ [bin]
129+ name = \" foo.rs\"
130+ path = \" src/main.rs\"
131+
123132" ,
124133 )
125134 . run ( ) ;
@@ -131,8 +140,17 @@ fn reserved_name() {
131140 . with_status ( 101 )
132141 . with_stderr (
133142 "\
134- [ERROR] the name `test` cannot be used as a crate name, it conflicts [..]
135- If you need a crate name to not match the directory name, consider using --name flag.
143+ [ERROR] the name `test` cannot be used as a package name, it conflicts [..]
144+ If you need a package name to not match the directory name, consider using --name flag.
145+ If you need a binary with the name \" test\" , use a valid package name, \
146+ and set the binary name to be different from the package. \
147+ This can be done by setting the binary filename to `src/bin/test.rs` \
148+ or change the name in Cargo.toml with:
149+
150+ [bin]
151+ name = \" test\"
152+ path = \" src/main.rs\"
153+
136154" ,
137155 )
138156 . run ( ) ;
@@ -144,8 +162,8 @@ fn reserved_binary_name() {
144162 . with_status ( 101 )
145163 . with_stderr (
146164 "\
147- [ERROR] the name `incremental` cannot be used as a crate name, it conflicts [..]
148- If you need a crate name to not match the directory name, consider using --name flag.
165+ [ERROR] the name `incremental` cannot be used as a package name, it conflicts [..]
166+ If you need a package name to not match the directory name, consider using --name flag.
149167" ,
150168 )
151169 . run ( ) ;
@@ -168,8 +186,17 @@ fn keyword_name() {
168186 . with_status ( 101 )
169187 . with_stderr (
170188 "\
171- [ERROR] the name `pub` cannot be used as a crate name, it is a Rust keyword
172- If you need a crate name to not match the directory name, consider using --name flag.
189+ [ERROR] the name `pub` cannot be used as a package name, it is a Rust keyword
190+ If you need a package name to not match the directory name, consider using --name flag.
191+ If you need a binary with the name \" pub\" , use a valid package name, \
192+ and set the binary name to be different from the package. \
193+ This can be done by setting the binary filename to `src/bin/pub.rs` \
194+ or change the name in Cargo.toml with:
195+
196+ [bin]
197+ name = \" pub\"
198+ path = \" src/main.rs\"
199+
173200" ,
174201 )
175202 . run ( ) ;
@@ -183,6 +210,16 @@ fn std_name() {
183210 "\
184211 [WARNING] the name `core` is part of Rust's standard library
185212It is recommended to use a different name to avoid problems.
213+ If you need a package name to not match the directory name, consider using --name flag.
214+ If you need a binary with the name \" core\" , use a valid package name, \
215+ and set the binary name to be different from the package. \
216+ This can be done by setting the binary filename to `src/bin/core.rs` \
217+ or change the name in Cargo.toml with:
218+
219+ [bin]
220+ name = \" core\"
221+ path = \" src/main.rs\"
222+
186223[CREATED] binary (application) `core` package
187224" ,
188225 )
@@ -528,8 +565,19 @@ fn explicit_invalid_name_not_suggested() {
528565 cargo_process ( "new --name 10-invalid a" )
529566 . with_status ( 101 )
530567 . with_stderr (
531- "[ERROR] the name `10-invalid` cannot be used as a crate name, \
532- the name cannot start with a digit",
568+ "\
569+ [ERROR] the name `10-invalid` cannot be used as a package name, \
570+ the name cannot start with a digit\n \
571+ If you need a binary with the name \" 10-invalid\" , use a valid package name, \
572+ and set the binary name to be different from the package. \
573+ This can be done by setting the binary filename to `src/bin/10-invalid.rs` \
574+ or change the name in Cargo.toml with:
575+
576+ [bin]
577+ name = \" 10-invalid\"
578+ path = \" src/main.rs\"
579+
580+ " ,
533581 )
534582 . run ( ) ;
535583}
@@ -615,7 +663,7 @@ fn restricted_windows_name() {
615663 . with_stderr (
616664 "\
617665 [ERROR] cannot use name `nul`, it is a reserved Windows filename
618- If you need a crate name to not match the directory name, consider using --name flag.
666+ If you need a package name to not match the directory name, consider using --name flag.
619667" ,
620668 )
621669 . run ( ) ;
@@ -655,9 +703,18 @@ fn non_ascii_name_invalid() {
655703 . with_status ( 101 )
656704 . with_stderr (
657705 "\
658- [ERROR] invalid character `Ⓐ` in crate name: `ⒶⒷⒸ`, \
706+ [ERROR] invalid character `Ⓐ` in package name: `ⒶⒷⒸ`, \
659707 the first character must be a Unicode XID start character (most letters or `_`)
660- If you need a crate name to not match the directory name, consider using --name flag.
708+ If you need a package name to not match the directory name, consider using --name flag.
709+ If you need a binary with the name \" ⒶⒷⒸ\" , use a valid package name, \
710+ and set the binary name to be different from the package. \
711+ This can be done by setting the binary filename to `src/bin/ⒶⒷⒸ.rs` \
712+ or change the name in Cargo.toml with:
713+
714+ [bin]
715+ name = \" ⒶⒷⒸ\"
716+ path = \" src/main.rs\"
717+
661718" ,
662719 )
663720 . run ( ) ;
@@ -667,9 +724,18 @@ If you need a crate name to not match the directory name, consider using --name
667724 . with_status ( 101 )
668725 . with_stderr (
669726 "\
670- [ERROR] invalid character `¼` in crate name: `a¼`, \
727+ [ERROR] invalid character `¼` in package name: `a¼`, \
671728 characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
672- If you need a crate name to not match the directory name, consider using --name flag.
729+ If you need a package name to not match the directory name, consider using --name flag.
730+ If you need a binary with the name \" a¼\" , use a valid package name, \
731+ and set the binary name to be different from the package. \
732+ This can be done by setting the binary filename to `src/bin/a¼.rs` \
733+ or change the name in Cargo.toml with:
734+
735+ [bin]
736+ name = \" a¼\"
737+ path = \" src/main.rs\"
738+
673739" ,
674740 )
675741 . run ( ) ;
0 commit comments