@@ -2575,7 +2575,7 @@ fn unused_dep_keys(
25752575pub fn prepare_for_publish (
25762576 me : & Package ,
25772577 ws : & Workspace < ' _ > ,
2578- included : & [ PathBuf ] ,
2578+ included : Option < & [ PathBuf ] > ,
25792579) -> CargoResult < Package > {
25802580 let contents = me. manifest ( ) . contents ( ) ;
25812581 let document = me. manifest ( ) . document ( ) ;
@@ -2612,7 +2612,7 @@ fn prepare_toml_for_publish(
26122612 me : & manifest:: TomlManifest ,
26132613 ws : & Workspace < ' _ > ,
26142614 package_root : & Path ,
2615- included : & [ PathBuf ] ,
2615+ included : Option < & [ PathBuf ] > ,
26162616) -> CargoResult < manifest:: TomlManifest > {
26172617 let gctx = ws. gctx ( ) ;
26182618
@@ -2629,7 +2629,8 @@ fn prepare_toml_for_publish(
26292629 package. workspace = None ;
26302630 if let Some ( StringOrBool :: String ( path) ) = & package. build {
26312631 let path = paths:: normalize_path ( Path :: new ( path) ) ;
2632- let build = if included. contains ( & path) {
2632+ let included = included. map ( |i| i. contains ( & path) ) . unwrap_or ( true ) ;
2633+ let build = if included {
26332634 let path = path
26342635 . into_os_string ( )
26352636 . into_string ( )
@@ -2898,7 +2899,7 @@ fn prepare_toml_for_publish(
28982899
28992900fn prepare_targets_for_publish (
29002901 targets : Option < & Vec < manifest:: TomlTarget > > ,
2901- included : & [ PathBuf ] ,
2902+ included : Option < & [ PathBuf ] > ,
29022903 context : & str ,
29032904 gctx : & GlobalContext ,
29042905) -> CargoResult < Option < Vec < manifest:: TomlTarget > > > {
@@ -2923,19 +2924,21 @@ fn prepare_targets_for_publish(
29232924
29242925fn prepare_target_for_publish (
29252926 target : & manifest:: TomlTarget ,
2926- included : & [ PathBuf ] ,
2927+ included : Option < & [ PathBuf ] > ,
29272928 context : & str ,
29282929 gctx : & GlobalContext ,
29292930) -> CargoResult < Option < manifest:: TomlTarget > > {
29302931 let path = target. path . as_ref ( ) . expect ( "previously resolved" ) ;
29312932 let path = normalize_path ( & path. 0 ) ;
2932- if !included. contains ( & path) {
2933- let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
2934- gctx. shell ( ) . warn ( format ! (
2935- "ignoring {context} `{name}` as `{}` is not included in the published package" ,
2936- path. display( )
2937- ) ) ?;
2938- return Ok ( None ) ;
2933+ if let Some ( included) = included {
2934+ if !included. contains ( & path) {
2935+ let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
2936+ gctx. shell ( ) . warn ( format ! (
2937+ "ignoring {context} `{name}` as `{}` is not included in the published package" ,
2938+ path. display( )
2939+ ) ) ?;
2940+ return Ok ( None ) ;
2941+ }
29392942 }
29402943
29412944 let mut target = target. clone ( ) ;
0 commit comments