@@ -2554,12 +2554,12 @@ fn unused_dep_keys(
25542554pub fn prepare_for_publish (
25552555 me : & Package ,
25562556 ws : & Workspace < ' _ > ,
2557- included : Option < & [ PathBuf ] > ,
2557+ packaged_files : Option < & [ PathBuf ] > ,
25582558) -> CargoResult < Package > {
25592559 let contents = me. manifest ( ) . contents ( ) ;
25602560 let document = me. manifest ( ) . document ( ) ;
25612561 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 ) ?;
25632563 let resolved_toml = original_toml. clone ( ) ;
25642564 let features = me. manifest ( ) . unstable_features ( ) . clone ( ) ;
25652565 let workspace_config = me. manifest ( ) . workspace_config ( ) . clone ( ) ;
@@ -2591,7 +2591,7 @@ fn prepare_toml_for_publish(
25912591 me : & manifest:: TomlManifest ,
25922592 ws : & Workspace < ' _ > ,
25932593 package_root : & Path ,
2594- included : Option < & [ PathBuf ] > ,
2594+ packaged_files : Option < & [ PathBuf ] > ,
25952595) -> CargoResult < manifest:: TomlManifest > {
25962596 let gctx = ws. gctx ( ) ;
25972597
@@ -2608,7 +2608,7 @@ fn prepare_toml_for_publish(
26082608 package. workspace = None ;
26092609 if let Some ( StringOrBool :: String ( path) ) = & package. build {
26102610 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 ) ;
26122612 let build = if included {
26132613 let path = path
26142614 . into_os_string ( )
@@ -2713,14 +2713,16 @@ fn prepare_toml_for_publish(
27132713 }
27142714
27152715 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 ( ) ) ?
27172717 } else {
27182718 None
27192719 } ;
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 ( ) ) ?;
27242726
27252727 let all = |_d : & manifest:: TomlDependency | true ;
27262728 let mut manifest = manifest:: TomlManifest {
@@ -2878,7 +2880,7 @@ fn prepare_toml_for_publish(
28782880
28792881fn prepare_targets_for_publish (
28802882 targets : Option < & Vec < manifest:: TomlTarget > > ,
2881- included : Option < & [ PathBuf ] > ,
2883+ packaged_files : Option < & [ PathBuf ] > ,
28822884 context : & str ,
28832885 gctx : & GlobalContext ,
28842886) -> CargoResult < Option < Vec < manifest:: TomlTarget > > > {
@@ -2888,7 +2890,8 @@ fn prepare_targets_for_publish(
28882890
28892891 let mut prepared = Vec :: with_capacity ( targets. len ( ) ) ;
28902892 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 {
28922895 continue ;
28932896 } ;
28942897 prepared. push ( target) ;
@@ -2903,14 +2906,14 @@ fn prepare_targets_for_publish(
29032906
29042907fn prepare_target_for_publish (
29052908 target : & manifest:: TomlTarget ,
2906- included : Option < & [ PathBuf ] > ,
2909+ packaged_files : Option < & [ PathBuf ] > ,
29072910 context : & str ,
29082911 gctx : & GlobalContext ,
29092912) -> CargoResult < Option < manifest:: TomlTarget > > {
29102913 let path = target. path . as_ref ( ) . expect ( "previously resolved" ) ;
29112914 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) {
29142917 let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
29152918 gctx. shell ( ) . warn ( format ! (
29162919 "ignoring {context} `{name}` as `{}` is not included in the published package" ,
0 commit comments