@@ -6,8 +6,8 @@ use crate::core::dependency::DepKind;
66use crate :: core:: resolver:: Resolve ;
77use crate :: core:: resolver:: features:: { CliFeatures , FeaturesFor , ResolvedFeatures } ;
88use crate :: core:: { FeatureMap , FeatureValue , Package , PackageId , PackageIdSpec , Workspace } ;
9- use crate :: util:: CargoResult ;
109use crate :: util:: interning:: { INTERNED_DEFAULT , InternedString } ;
10+ use crate :: util:: { CargoResult , OptVersionReq } ;
1111use std:: collections:: { HashMap , HashSet } ;
1212
1313#[ derive( Debug , Copy , Clone ) ]
@@ -56,6 +56,7 @@ pub enum Node {
5656 /// Features that are enabled on this package.
5757 features : Vec < InternedString > ,
5858 kind : CompileKind ,
59+ version_req : OptVersionReq ,
5960 } ,
6061 Feature {
6162 /// Index of the package node this feature is for.
@@ -332,13 +333,15 @@ impl<'a> Graph<'a> {
332333 Node :: Package {
333334 package_id,
334335 features,
336+ version_req,
335337 ..
336338 } => {
337339 // Do not treat duplicates on the host or target as duplicates.
338340 Node :: Package {
339341 package_id : package_id. clone ( ) ,
340342 features : features. clone ( ) ,
341343 kind : CompileKind :: Host ,
344+ version_req : version_req. clone ( ) ,
342345 }
343346 }
344347 _ => unreachable ! ( ) ,
@@ -376,12 +379,14 @@ pub fn build<'a>(
376379 let member_id = member. package_id ( ) ;
377380 let features_for = FeaturesFor :: from_for_host ( member. proc_macro ( ) ) ;
378381 for kind in requested_kinds {
382+ let version_req = OptVersionReq :: Any ;
379383 let member_index = add_pkg (
380384 & mut graph,
381385 resolve,
382386 resolved_features,
383387 member_id,
384388 features_for,
389+ version_req,
385390 target_data,
386391 * kind,
387392 opts,
@@ -409,6 +414,7 @@ fn add_pkg(
409414 resolved_features : & ResolvedFeatures ,
410415 package_id : PackageId ,
411416 features_for : FeaturesFor ,
417+ version_req : OptVersionReq ,
412418 target_data : & RustcTargetData < ' _ > ,
413419 requested_kind : CompileKind ,
414420 opts : & TreeOptions ,
@@ -423,6 +429,7 @@ fn add_pkg(
423429 package_id,
424430 features : node_features,
425431 kind : node_kind,
432+ version_req : version_req,
426433 } ;
427434 if let Some ( idx) = graph. index . get ( & node) {
428435 return * idx;
@@ -513,12 +520,14 @@ fn add_pkg(
513520 }
514521 }
515522 } ;
523+ let dep_version_req = dep. version_req ( ) . clone ( ) ;
516524 let dep_index = add_pkg (
517525 graph,
518526 resolve,
519527 resolved_features,
520528 dep_id,
521529 dep_features_for,
530+ dep_version_req,
522531 target_data,
523532 requested_kind,
524533 opts,
0 commit comments