@@ -76,24 +76,28 @@ pub(super) fn to_targets(
7676 normalized_toml. bin . as_deref ( ) . unwrap_or_default ( ) ,
7777 package_root,
7878 edition,
79+ warnings,
7980 ) ?) ;
8081
8182 targets. extend ( to_example_targets (
8283 normalized_toml. example . as_deref ( ) . unwrap_or_default ( ) ,
8384 package_root,
8485 edition,
86+ warnings,
8587 ) ?) ;
8688
8789 targets. extend ( to_test_targets (
8890 normalized_toml. test . as_deref ( ) . unwrap_or_default ( ) ,
8991 package_root,
9092 edition,
93+ warnings,
9194 ) ?) ;
9295
9396 targets. extend ( to_bench_targets (
9497 normalized_toml. bench . as_deref ( ) . unwrap_or_default ( ) ,
9598 package_root,
9699 edition,
100+ warnings,
97101 ) ?) ;
98102
99103 // processing the custom build script
@@ -259,7 +263,7 @@ fn to_lib_target(
259263 } ;
260264
261265 let mut target = Target :: lib_target ( name_or_panic ( lib) , crate_types, path, edition) ;
262- configure ( lib, & mut target) ?;
266+ configure ( lib, & mut target, TARGET_KIND_HUMAN_LIB , warnings ) ?;
263267 target. set_name_inferred ( original_lib. map_or ( true , |v| v. name . is_none ( ) ) ) ;
264268 Ok ( Some ( target) )
265269}
@@ -348,6 +352,7 @@ fn to_bin_targets(
348352 bins : & [ TomlBinTarget ] ,
349353 package_root : & Path ,
350354 edition : Edition ,
355+ warnings : & mut Vec < String > ,
351356) -> CargoResult < Vec < Target > > {
352357 // This loop performs basic checks on each of the TomlTarget in `bins`.
353358 for bin in bins {
@@ -371,7 +376,7 @@ fn to_bin_targets(
371376 edition,
372377 ) ;
373378
374- configure ( bin, & mut target) ?;
379+ configure ( bin, & mut target, TARGET_KIND_HUMAN_BIN , warnings ) ?;
375380 result. push ( target) ;
376381 }
377382 Ok ( result)
@@ -430,6 +435,7 @@ fn to_example_targets(
430435 targets : & [ TomlExampleTarget ] ,
431436 package_root : & Path ,
432437 edition : Edition ,
438+ warnings : & mut Vec < String > ,
433439) -> CargoResult < Vec < Target > > {
434440 validate_unique_names ( & targets, TARGET_KIND_EXAMPLE ) ?;
435441
@@ -448,7 +454,7 @@ fn to_example_targets(
448454 toml. required_features . clone ( ) ,
449455 edition,
450456 ) ;
451- configure ( & toml, & mut target) ?;
457+ configure ( & toml, & mut target, TARGET_KIND_HUMAN_EXAMPLE , warnings ) ?;
452458 result. push ( target) ;
453459 }
454460
@@ -487,6 +493,7 @@ fn to_test_targets(
487493 targets : & [ TomlTestTarget ] ,
488494 package_root : & Path ,
489495 edition : Edition ,
496+ warnings : & mut Vec < String > ,
490497) -> CargoResult < Vec < Target > > {
491498 validate_unique_names ( & targets, TARGET_KIND_TEST ) ?;
492499
@@ -499,7 +506,7 @@ fn to_test_targets(
499506 toml. required_features . clone ( ) ,
500507 edition,
501508 ) ;
502- configure ( & toml, & mut target) ?;
509+ configure ( & toml, & mut target, TARGET_KIND_HUMAN_TEST , warnings ) ?;
503510 result. push ( target) ;
504511 }
505512 Ok ( result)
@@ -554,6 +561,7 @@ fn to_bench_targets(
554561 targets : & [ TomlBenchTarget ] ,
555562 package_root : & Path ,
556563 edition : Edition ,
564+ warnings : & mut Vec < String > ,
557565) -> CargoResult < Vec < Target > > {
558566 validate_unique_names ( & targets, TARGET_KIND_BENCH ) ?;
559567
@@ -566,7 +574,7 @@ fn to_bench_targets(
566574 toml. required_features . clone ( ) ,
567575 edition,
568576 ) ;
569- configure ( & toml, & mut target) ?;
577+ configure ( & toml, & mut target, TARGET_KIND_HUMAN_BENCH , warnings ) ?;
570578 result. push ( target) ;
571579 }
572580
@@ -892,7 +900,12 @@ fn validate_unique_names(targets: &[TomlTarget], target_kind: &str) -> CargoResu
892900 Ok ( ( ) )
893901}
894902
895- fn configure ( toml : & TomlTarget , target : & mut Target ) -> CargoResult < ( ) > {
903+ fn configure (
904+ toml : & TomlTarget ,
905+ target : & mut Target ,
906+ target_kind_human : & str ,
907+ warnings : & mut Vec < String > ,
908+ ) -> CargoResult < ( ) > {
896909 let t2 = target. clone ( ) ;
897910 target
898911 . set_tested ( toml. test . unwrap_or_else ( || t2. tested ( ) ) )
@@ -909,6 +922,10 @@ fn configure(toml: &TomlTarget, target: &mut Target) -> CargoResult<()> {
909922 . set_for_host ( toml. proc_macro ( ) . unwrap_or_else ( || t2. for_host ( ) ) ) ;
910923
911924 if let Some ( edition) = toml. edition . clone ( ) {
925+ let name = target. name ( ) ;
926+ warnings. push ( format ! (
927+ "`edition` is set on {target_kind_human} `{name}` which is deprecated"
928+ ) ) ;
912929 target. set_edition (
913930 edition
914931 . parse ( )
0 commit comments