@@ -479,21 +479,6 @@ pub fn to_real_manifest(
479479 ) ;
480480 } ;
481481
482- if let Some ( deps) = original_toml
483- . workspace
484- . as_ref ( )
485- . and_then ( |ws| ws. dependencies . as_ref ( ) )
486- {
487- for ( name, dep) in deps {
488- if dep. is_optional ( ) {
489- bail ! ( "{name} is optional, but workspace dependencies cannot be optional" , ) ;
490- }
491- if dep. is_public ( ) {
492- bail ! ( "{name} is public, but workspace dependencies cannot be public" , ) ;
493- }
494- }
495- }
496-
497482 // Parse features first so they will be available when parsing other parts of the TOML.
498483 let empty = Vec :: new ( ) ;
499484 let cargo_features = original_toml. cargo_features . as_ref ( ) . unwrap_or ( & empty) ;
@@ -1225,6 +1210,15 @@ fn to_workspace_config(
12251210 ( Some ( toml_config) , None ) => {
12261211 verify_lints ( toml_config. lints . as_ref ( ) , gctx, warnings) ?;
12271212 if let Some ( ws_deps) = & toml_config. dependencies {
1213+ for ( name, dep) in ws_deps {
1214+ if dep. is_optional ( ) {
1215+ bail ! ( "{name} is optional, but workspace dependencies cannot be optional" , ) ;
1216+ }
1217+ if dep. is_public ( ) {
1218+ bail ! ( "{name} is public, but workspace dependencies cannot be public" , ) ;
1219+ }
1220+ }
1221+
12281222 for ( name, dep) in ws_deps {
12291223 unused_dep_keys ( name, "workspace.dependencies" , dep. unused_keys ( ) , warnings) ;
12301224 }
@@ -1278,21 +1272,6 @@ fn to_virtual_manifest(
12781272
12791273 let mut resolved_toml = original_toml. clone ( ) ;
12801274
1281- if let Some ( deps) = original_toml
1282- . workspace
1283- . as_ref ( )
1284- . and_then ( |ws| ws. dependencies . as_ref ( ) )
1285- {
1286- for ( name, dep) in deps {
1287- if dep. is_optional ( ) {
1288- bail ! ( "{name} is optional, but workspace dependencies cannot be optional" , ) ;
1289- }
1290- if dep. is_public ( ) {
1291- bail ! ( "{name} is public, but workspace dependencies cannot be public" , ) ;
1292- }
1293- }
1294- }
1295-
12961275 for field in original_toml. requires_package ( ) {
12971276 bail ! ( "this virtual manifest specifies a `{field}` section, which is not allowed" ) ;
12981277 }
0 commit comments