@@ -118,8 +118,17 @@ fn invalid_characters() {
118
118
. with_status ( 101 )
119
119
. with_stderr (
120
120
"\
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
+
123
132
" ,
124
133
)
125
134
. run ( ) ;
@@ -131,8 +140,17 @@ fn reserved_name() {
131
140
. with_status ( 101 )
132
141
. with_stderr (
133
142
"\
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
+
136
154
" ,
137
155
)
138
156
. run ( ) ;
@@ -144,8 +162,8 @@ fn reserved_binary_name() {
144
162
. with_status ( 101 )
145
163
. with_stderr (
146
164
"\
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.
149
167
" ,
150
168
)
151
169
. run ( ) ;
@@ -168,8 +186,17 @@ fn keyword_name() {
168
186
. with_status ( 101 )
169
187
. with_stderr (
170
188
"\
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
+
173
200
" ,
174
201
)
175
202
. run ( ) ;
@@ -183,6 +210,16 @@ fn std_name() {
183
210
"\
184
211
[WARNING] the name `core` is part of Rust's standard library
185
212
It 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
+
186
223
[CREATED] binary (application) `core` package
187
224
" ,
188
225
)
@@ -528,8 +565,19 @@ fn explicit_invalid_name_not_suggested() {
528
565
cargo_process ( "new --name 10-invalid a" )
529
566
. with_status ( 101 )
530
567
. 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
+ " ,
533
581
)
534
582
. run ( ) ;
535
583
}
@@ -615,7 +663,7 @@ fn restricted_windows_name() {
615
663
. with_stderr (
616
664
"\
617
665
[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.
619
667
" ,
620
668
)
621
669
. run ( ) ;
@@ -655,9 +703,18 @@ fn non_ascii_name_invalid() {
655
703
. with_status ( 101 )
656
704
. with_stderr (
657
705
"\
658
- [ERROR] invalid character `Ⓐ` in crate name: `ⒶⒷⒸ`, \
706
+ [ERROR] invalid character `Ⓐ` in package name: `ⒶⒷⒸ`, \
659
707
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
+
661
718
" ,
662
719
)
663
720
. run ( ) ;
@@ -667,9 +724,18 @@ If you need a crate name to not match the directory name, consider using --name
667
724
. with_status ( 101 )
668
725
. with_stderr (
669
726
"\
670
- [ERROR] invalid character `¼` in crate name: `a¼`, \
727
+ [ERROR] invalid character `¼` in package name: `a¼`, \
671
728
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
+
673
739
" ,
674
740
)
675
741
. run ( ) ;
0 commit comments