@@ -2554,7 +2554,7 @@ fn unused_dep_keys(
25542554pub fn prepare_for_publish (
25552555 me : & Package ,
25562556 ws : & Workspace < ' _ > ,
2557- included : & [ PathBuf ] ,
2557+ included : Option < & [ PathBuf ] > ,
25582558) -> CargoResult < Package > {
25592559 let contents = me. manifest ( ) . contents ( ) ;
25602560 let document = me. manifest ( ) . document ( ) ;
@@ -2591,7 +2591,7 @@ fn prepare_toml_for_publish(
25912591 me : & manifest:: TomlManifest ,
25922592 ws : & Workspace < ' _ > ,
25932593 package_root : & Path ,
2594- included : & [ PathBuf ] ,
2594+ included : Option < & [ PathBuf ] > ,
25952595) -> CargoResult < manifest:: TomlManifest > {
25962596 let gctx = ws. gctx ( ) ;
25972597
@@ -2608,7 +2608,8 @@ 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 build = if included. contains ( & path) {
2611+ let included = included. map ( |i| i. contains ( & path) ) . unwrap_or ( true ) ;
2612+ let build = if included {
26122613 let path = path
26132614 . into_os_string ( )
26142615 . into_string ( )
@@ -2877,7 +2878,7 @@ fn prepare_toml_for_publish(
28772878
28782879fn prepare_targets_for_publish (
28792880 targets : Option < & Vec < manifest:: TomlTarget > > ,
2880- included : & [ PathBuf ] ,
2881+ included : Option < & [ PathBuf ] > ,
28812882 context : & str ,
28822883 gctx : & GlobalContext ,
28832884) -> CargoResult < Option < Vec < manifest:: TomlTarget > > > {
@@ -2902,19 +2903,21 @@ fn prepare_targets_for_publish(
29022903
29032904fn prepare_target_for_publish (
29042905 target : & manifest:: TomlTarget ,
2905- included : & [ PathBuf ] ,
2906+ included : Option < & [ PathBuf ] > ,
29062907 context : & str ,
29072908 gctx : & GlobalContext ,
29082909) -> CargoResult < Option < manifest:: TomlTarget > > {
29092910 let path = target. path . as_ref ( ) . expect ( "previously resolved" ) ;
29102911 let path = normalize_path ( & path. 0 ) ;
2911- if !included. contains ( & path) {
2912- let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
2913- gctx. shell ( ) . warn ( format ! (
2914- "ignoring {context} `{name}` as `{}` is not included in the published package" ,
2915- path. display( )
2916- ) ) ?;
2917- return Ok ( None ) ;
2912+ if let Some ( included) = included {
2913+ if !included. contains ( & path) {
2914+ let name = target. name . as_ref ( ) . expect ( "previously resolved" ) ;
2915+ gctx. shell ( ) . warn ( format ! (
2916+ "ignoring {context} `{name}` as `{}` is not included in the published package" ,
2917+ path. display( )
2918+ ) ) ?;
2919+ return Ok ( None ) ;
2920+ }
29182921 }
29192922
29202923 let mut target = target. clone ( ) ;
0 commit comments