@@ -62,6 +62,7 @@ use cargo_util::ProcessBuilder;
6262use crossbeam_utils:: thread:: Scope ;
6363use jobserver:: { Acquired , Client , HelperThread } ;
6464use log:: { debug, info, trace} ;
65+ use semver:: Version ;
6566
6667use super :: context:: OutputFile ;
6768use super :: job:: {
@@ -74,9 +75,8 @@ use crate::core::compiler::future_incompat::{
7475 FutureBreakageItem , FutureIncompatReportPackage , OnDiskReports ,
7576} ;
7677use crate :: core:: resolver:: ResolveBehavior ;
77- use crate :: core:: { FeatureValue , PackageId , Shell , TargetKind } ;
78+ use crate :: core:: { PackageId , Shell , TargetKind } ;
7879use crate :: util:: diagnostic_server:: { self , DiagnosticPrinter } ;
79- use crate :: util:: interning:: InternedString ;
8080use crate :: util:: machine_message:: { self , Message as _} ;
8181use crate :: util:: CargoResult ;
8282use crate :: util:: { self , internal, profile} ;
@@ -1249,55 +1249,27 @@ impl<'cfg> DrainState<'cfg> {
12491249
12501250 fn back_compat_notice ( & self , cx : & Context < ' _ , ' _ > , unit : & Unit ) -> CargoResult < ( ) > {
12511251 if unit. pkg . name ( ) != "diesel"
1252- || unit. pkg . version ( ) . major != 1
1252+ || unit. pkg . version ( ) >= & Version :: new ( 1 , 4 , 8 )
12531253 || cx. bcx . ws . resolve_behavior ( ) == ResolveBehavior :: V1
12541254 || !unit. pkg . package_id ( ) . source_id ( ) . is_registry ( )
12551255 || !unit. features . is_empty ( )
12561256 {
12571257 return Ok ( ( ) ) ;
12581258 }
1259- let other_diesel = match cx
1259+ if ! cx
12601260 . bcx
12611261 . unit_graph
12621262 . keys ( )
1263- . find ( |unit| unit. pkg . name ( ) == "diesel" && !unit. features . is_empty ( ) )
1263+ . any ( |unit| unit. pkg . name ( ) == "diesel" && !unit. features . is_empty ( ) )
12641264 {
1265- Some ( u) => u,
1266- // Unlikely due to features.
1267- None => return Ok ( ( ) ) ,
1268- } ;
1269- let mut features_suggestion: BTreeSet < _ > = other_diesel. features . iter ( ) . collect ( ) ;
1270- let fmap = other_diesel. pkg . summary ( ) . features ( ) ;
1271- // Remove any unnecessary features.
1272- for feature in & other_diesel. features {
1273- if let Some ( feats) = fmap. get ( feature) {
1274- for feat in feats {
1275- if let FeatureValue :: Feature ( f) = feat {
1276- features_suggestion. remove ( & f) ;
1277- }
1278- }
1279- }
1265+ return Ok ( ( ) ) ;
12801266 }
1281- features_suggestion. remove ( & InternedString :: new ( "default" ) ) ;
1282- let features_suggestion = toml:: to_string ( & features_suggestion) . unwrap ( ) ;
1283-
1284- cx. bcx . config . shell ( ) . note ( & format ! (
1267+ cx. bcx . config . shell ( ) . note (
12851268 "\
12861269 This error may be due to an interaction between diesel and Cargo's new
1287- feature resolver. Some workarounds you may want to consider:
1288- - Add a build-dependency in Cargo.toml on diesel to force Cargo to add the appropriate
1289- features. This may look something like this:
1290-
1291- [build-dependencies]
1292- diesel = {{ version = \" {}\" , features = {} }}
1293-
1294- - Try using the previous resolver by setting `resolver = \" 1\" ` in `Cargo.toml`
1295- (see <https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions>
1296- for more information).
1270+ feature resolver. Try updating to diesel 1.4.8 to fix this error.
12971271" ,
1298- unit. pkg. version( ) ,
1299- features_suggestion
1300- ) ) ?;
1272+ ) ?;
13011273 Ok ( ( ) )
13021274 }
13031275}
0 commit comments