@@ -2554,12 +2554,12 @@ fn unused_dep_keys(
2554
2554
pub fn prepare_for_publish (
2555
2555
me : & Package ,
2556
2556
ws : & Workspace < ' _ > ,
2557
- included : Option < & [ PathBuf ] > ,
2557
+ packaged_files : Option < & [ PathBuf ] > ,
2558
2558
) -> CargoResult < Package > {
2559
2559
let contents = me. manifest ( ) . contents ( ) ;
2560
2560
let document = me. manifest ( ) . document ( ) ;
2561
2561
let original_toml =
2562
- prepare_toml_for_publish ( me. manifest ( ) . resolved_toml ( ) , ws, me. root ( ) , included ) ?;
2562
+ prepare_toml_for_publish ( me. manifest ( ) . resolved_toml ( ) , ws, me. root ( ) , packaged_files ) ?;
2563
2563
let resolved_toml = original_toml. clone ( ) ;
2564
2564
let features = me. manifest ( ) . unstable_features ( ) . clone ( ) ;
2565
2565
let workspace_config = me. manifest ( ) . workspace_config ( ) . clone ( ) ;
@@ -2591,7 +2591,7 @@ fn prepare_toml_for_publish(
2591
2591
me : & manifest:: TomlManifest ,
2592
2592
ws : & Workspace < ' _ > ,
2593
2593
package_root : & Path ,
2594
- included : Option < & [ PathBuf ] > ,
2594
+ packaged_files : Option < & [ PathBuf ] > ,
2595
2595
) -> CargoResult < manifest:: TomlManifest > {
2596
2596
let gctx = ws. gctx ( ) ;
2597
2597
@@ -2608,7 +2608,7 @@ fn prepare_toml_for_publish(
2608
2608
package. workspace = None ;
2609
2609
if let Some ( StringOrBool :: String ( path) ) = & package. build {
2610
2610
let path = paths:: normalize_path ( Path :: new ( path) ) ;
2611
- let included = included . map ( |i| i. contains ( & path) ) . unwrap_or ( true ) ;
2611
+ let included = packaged_files . map ( |i| i. contains ( & path) ) . unwrap_or ( true ) ;
2612
2612
let build = if included {
2613
2613
let path = path
2614
2614
. into_os_string ( )
@@ -2713,14 +2713,16 @@ fn prepare_toml_for_publish(
2713
2713
}
2714
2714
2715
2715
let lib = if let Some ( target) = & me. lib {
2716
- prepare_target_for_publish ( target, included , "library" , ws. gctx ( ) ) ?
2716
+ prepare_target_for_publish ( target, packaged_files , "library" , ws. gctx ( ) ) ?
2717
2717
} else {
2718
2718
None
2719
2719
} ;
2720
- let bin = prepare_targets_for_publish ( me. bin . as_ref ( ) , included, "binary" , ws. gctx ( ) ) ?;
2721
- let example = prepare_targets_for_publish ( me. example . as_ref ( ) , included, "example" , ws. gctx ( ) ) ?;
2722
- let test = prepare_targets_for_publish ( me. test . as_ref ( ) , included, "test" , ws. gctx ( ) ) ?;
2723
- let bench = prepare_targets_for_publish ( me. bench . as_ref ( ) , included, "benchmark" , ws. gctx ( ) ) ?;
2720
+ let bin = prepare_targets_for_publish ( me. bin . as_ref ( ) , packaged_files, "binary" , ws. gctx ( ) ) ?;
2721
+ let example =
2722
+ prepare_targets_for_publish ( me. example . as_ref ( ) , packaged_files, "example" , ws. gctx ( ) ) ?;
2723
+ let test = prepare_targets_for_publish ( me. test . as_ref ( ) , packaged_files, "test" , ws. gctx ( ) ) ?;
2724
+ let bench =
2725
+ prepare_targets_for_publish ( me. bench . as_ref ( ) , packaged_files, "benchmark" , ws. gctx ( ) ) ?;
2724
2726
2725
2727
let all = |_d : & manifest:: TomlDependency | true ;
2726
2728
let mut manifest = manifest:: TomlManifest {
@@ -2878,7 +2880,7 @@ fn prepare_toml_for_publish(
2878
2880
2879
2881
fn prepare_targets_for_publish (
2880
2882
targets : Option < & Vec < manifest:: TomlTarget > > ,
2881
- included : Option < & [ PathBuf ] > ,
2883
+ packaged_files : Option < & [ PathBuf ] > ,
2882
2884
context : & str ,
2883
2885
gctx : & GlobalContext ,
2884
2886
) -> CargoResult < Option < Vec < manifest:: TomlTarget > > > {
@@ -2888,7 +2890,8 @@ fn prepare_targets_for_publish(
2888
2890
2889
2891
let mut prepared = Vec :: with_capacity ( targets. len ( ) ) ;
2890
2892
for target in targets {
2891
- let Some ( target) = prepare_target_for_publish ( target, included, context, gctx) ? else {
2893
+ let Some ( target) = prepare_target_for_publish ( target, packaged_files, context, gctx) ?
2894
+ else {
2892
2895
continue ;
2893
2896
} ;
2894
2897
prepared. push ( target) ;
@@ -2903,14 +2906,14 @@ fn prepare_targets_for_publish(
2903
2906
2904
2907
fn prepare_target_for_publish (
2905
2908
target : & manifest:: TomlTarget ,
2906
- included : Option < & [ PathBuf ] > ,
2909
+ packaged_files : Option < & [ PathBuf ] > ,
2907
2910
context : & str ,
2908
2911
gctx : & GlobalContext ,
2909
2912
) -> CargoResult < Option < manifest:: TomlTarget > > {
2910
2913
let path = target. path . as_ref ( ) . expect ( "previously resolved" ) ;
2911
2914
let path = normalize_path ( & path. 0 ) ;
2912
- if let Some ( included ) = included {
2913
- if !included . contains ( & path) {
2915
+ if let Some ( packaged_files ) = packaged_files {
2916
+ if !packaged_files . contains ( & path) {
2914
2917
let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
2915
2918
gctx. shell ( ) . warn ( format ! (
2916
2919
"ignoring {context} `{name}` as `{}` is not included in the published package" ,
0 commit comments