@@ -291,12 +291,13 @@ pub fn resolve_with_previous<'cfg>(
291
291
292
292
let keep = |p : & PackageId | pre_patch_keep ( p) && !avoid_patch_ids. contains ( p) ;
293
293
294
+ let dev_deps = ws. require_optional_deps ( ) || has_dev_units == HasDevUnits :: Yes ;
294
295
// In the case where a previous instance of resolve is available, we
295
296
// want to lock as many packages as possible to the previous version
296
297
// without disturbing the graph structure.
297
298
if let Some ( r) = previous {
298
299
trace ! ( "previous: {:?}" , r) ;
299
- register_previous_locks ( ws, registry, r, & keep) ;
300
+ register_previous_locks ( ws, registry, r, & keep, dev_deps ) ;
300
301
}
301
302
// Everything in the previous lock file we want to keep is prioritized
302
303
// in dependency selection if it comes up, aka we want to have
@@ -320,7 +321,6 @@ pub fn resolve_with_previous<'cfg>(
320
321
registry. add_sources ( Some ( member. package_id ( ) . source_id ( ) ) ) ?;
321
322
}
322
323
323
- let dev_deps = ws. require_optional_deps ( ) || has_dev_units == HasDevUnits :: Yes ;
324
324
let summaries: Vec < ( Summary , ResolveOpts ) > = ws
325
325
. members_with_features ( specs, cli_features) ?
326
326
. into_iter ( )
@@ -455,6 +455,7 @@ fn register_previous_locks(
455
455
registry : & mut PackageRegistry < ' _ > ,
456
456
resolve : & Resolve ,
457
457
keep : & dyn Fn ( & PackageId ) -> bool ,
458
+ dev_deps : bool ,
458
459
) {
459
460
let path_pkg = |id : SourceId | {
460
461
if !id. is_path ( ) {
@@ -564,6 +565,11 @@ fn register_previous_locks(
564
565
continue ;
565
566
}
566
567
568
+ // If dev-dependencies aren't being resolved, skip them.
569
+ if !dep. is_transitive ( ) && !dev_deps {
570
+ continue ;
571
+ }
572
+
567
573
// If this is a path dependency, then try to push it onto our
568
574
// worklist.
569
575
if let Some ( pkg) = path_pkg ( dep. source_id ( ) ) {
0 commit comments