@@ -64,6 +64,7 @@ pub(super) fn to_targets(
64
64
resolved_toml. bin . as_deref ( ) . unwrap_or_default ( ) ,
65
65
package_root,
66
66
edition,
67
+ warnings,
67
68
errors,
68
69
) ?) ;
69
70
@@ -308,6 +309,7 @@ fn to_bin_targets(
308
309
bins : & [ TomlBinTarget ] ,
309
310
package_root : & Path ,
310
311
edition : Edition ,
312
+ warnings : & mut Vec < String > ,
311
313
errors : & mut Vec < String > ,
312
314
) -> CargoResult < Vec < Target > > {
313
315
// This loop performs basic checks on each of the TomlTarget in `bins`.
@@ -318,17 +320,7 @@ fn to_bin_targets(
318
320
features. require ( Feature :: different_binary_name ( ) ) ?;
319
321
}
320
322
321
- if let Some ( crate_types) = bin. crate_types ( ) {
322
- if !crate_types. is_empty ( ) {
323
- let name = name_or_panic ( bin) ;
324
- errors. push ( format ! (
325
- "the target `{}` is a binary and can't have any \
326
- crate-types set (currently \" {}\" )",
327
- name,
328
- crate_types. join( ", " )
329
- ) ) ;
330
- }
331
- }
323
+ validate_bin_crate_types ( bin, warnings, errors) ?;
332
324
333
325
if bin. proc_macro ( ) == Some ( true ) {
334
326
let name = name_or_panic ( bin) ;
@@ -1093,6 +1085,25 @@ fn validate_proc_macro(
1093
1085
)
1094
1086
}
1095
1087
1088
+ fn validate_bin_crate_types (
1089
+ target : & TomlTarget ,
1090
+ _warnings : & mut Vec < String > ,
1091
+ errors : & mut Vec < String > ,
1092
+ ) -> CargoResult < ( ) > {
1093
+ if let Some ( crate_types) = target. crate_types ( ) {
1094
+ if !crate_types. is_empty ( ) {
1095
+ let name = name_or_panic ( target) ;
1096
+ errors. push ( format ! (
1097
+ "the target `{}` is a binary and can't have any \
1098
+ crate-types set (currently \" {}\" )",
1099
+ name,
1100
+ crate_types. join( ", " )
1101
+ ) ) ;
1102
+ }
1103
+ }
1104
+ Ok ( ( ) )
1105
+ }
1106
+
1096
1107
fn validate_crate_types (
1097
1108
target : & TomlTarget ,
1098
1109
kind : & str ,
0 commit comments