@@ -175,8 +175,6 @@ fn convert_toml(
175175 source_id : SourceId ,
176176 gctx : & GlobalContext ,
177177) -> CargoResult < ( EitherManifest , Vec < PathBuf > ) > {
178- let package_root = manifest_file. parent ( ) . unwrap ( ) ;
179-
180178 if let Some ( deps) = manifest
181179 . workspace
182180 . as_ref ( )
@@ -192,12 +190,10 @@ fn convert_toml(
192190 }
193191 }
194192 return if manifest. package ( ) . is_some ( ) {
195- let embedded = is_embedded ( manifest_file) ;
196- let ( manifest, paths) =
197- to_real_manifest ( manifest, embedded, source_id, package_root, gctx) ?;
193+ let ( manifest, paths) = to_real_manifest ( manifest, source_id, manifest_file, gctx) ?;
198194 Ok ( ( EitherManifest :: Real ( manifest) , paths) )
199195 } else {
200- let ( m, paths) = to_virtual_manifest ( manifest, source_id, package_root , gctx) ?;
196+ let ( m, paths) = to_virtual_manifest ( manifest, source_id, manifest_file , gctx) ?;
201197 Ok ( ( EitherManifest :: Virtual ( m) , paths) )
202198 } ;
203199}
@@ -479,9 +475,8 @@ pub fn prepare_for_publish(
479475#[ tracing:: instrument( skip_all) ]
480476pub fn to_real_manifest (
481477 me : manifest:: TomlManifest ,
482- embedded : bool ,
483478 source_id : SourceId ,
484- package_root : & Path ,
479+ manifest_file : & Path ,
485480 gctx : & GlobalContext ,
486481) -> CargoResult < ( Manifest , Vec < PathBuf > ) > {
487482 fn get_ws (
@@ -511,6 +506,8 @@ pub fn to_real_manifest(
511506 }
512507 }
513508
509+ let embedded = is_embedded ( manifest_file) ;
510+ let package_root = manifest_file. parent ( ) . unwrap ( ) ;
514511 if !package_root. is_dir ( ) {
515512 bail ! (
516513 "package root '{}' is not a directory" ,
@@ -1280,9 +1277,11 @@ pub fn to_real_manifest(
12801277fn to_virtual_manifest (
12811278 me : manifest:: TomlManifest ,
12821279 source_id : SourceId ,
1283- root : & Path ,
1280+ manifest_file : & Path ,
12841281 gctx : & GlobalContext ,
12851282) -> CargoResult < ( VirtualManifest , Vec < PathBuf > ) > {
1283+ let root = manifest_file. parent ( ) . unwrap ( ) ;
1284+
12861285 for field in me. requires_package ( ) {
12871286 bail ! ( "this virtual manifest specifies a `{field}` section, which is not allowed" ) ;
12881287 }
0 commit comments