File tree 3 files changed +49
-2
lines changed 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -185,7 +185,8 @@ impl Encodable for Target {
185
185
}
186
186
187
187
impl Manifest {
188
- pub fn new ( summary : Summary , targets : Vec < Target > ,
188
+ pub fn new ( summary : Summary ,
189
+ targets : Vec < Target > ,
189
190
exclude : Vec < String > ,
190
191
include : Vec < String > ,
191
192
links : Option < String > ,
Original file line number Diff line number Diff line change @@ -359,7 +359,19 @@ impl<'cfg> Source for RegistrySource<'cfg> {
359
359
} ) ) ;
360
360
let mut src = PathSource :: new ( & path, & self . source_id , self . config ) ;
361
361
try!( src. update ( ) ) ;
362
- src. download ( package)
362
+ let pkg = try!( src. download ( package) ) ;
363
+
364
+ // Unfortunately the index and the actual Cargo.toml in the index can
365
+ // differ due to historical Cargo bugs. To paper over these we trash the
366
+ // *summary* loaded from the Cargo.toml we just downloaded with the one
367
+ // we loaded from the index.
368
+ let summaries = try!( self . index . summaries ( package. name ( ) ) ) ;
369
+ let summary = summaries. iter ( ) . map ( |s| & s. 0 ) . find ( |s| {
370
+ s. package_id ( ) == package
371
+ } ) . expect ( "summary not found" ) ;
372
+ let mut manifest = pkg. manifest ( ) . clone ( ) ;
373
+ manifest. set_summary ( summary. clone ( ) ) ;
374
+ Ok ( Package :: new ( manifest, pkg. manifest_path ( ) ) )
363
375
}
364
376
365
377
fn fingerprint ( & self , pkg : & Package ) -> CargoResult < String > {
Original file line number Diff line number Diff line change @@ -1340,3 +1340,37 @@ this warning.
1340
1340
[FINISHED] [..]
1341
1341
" ) ) ;
1342
1342
}
1343
+
1344
+ #[ test]
1345
+ fn toml_lies_but_index_is_truth ( ) {
1346
+ Package :: new ( "foo" , "0.2.0" ) . publish ( ) ;
1347
+ Package :: new ( "bar" , "0.3.0" )
1348
+ . dep ( "foo" , "0.2.0" )
1349
+ . file ( "Cargo.toml" , r#"
1350
+ [project]
1351
+ name = "bar"
1352
+ version = "0.3.0"
1353
+ authors = []
1354
+
1355
+ [dependencies]
1356
+ foo = "0.1.0"
1357
+ "# )
1358
+ . file ( "src/lib.rs" , "extern crate foo;" )
1359
+ . publish ( ) ;
1360
+
1361
+ let p = project ( "foo" )
1362
+ . file ( "Cargo.toml" , r#"
1363
+ [project]
1364
+ name = "bar"
1365
+ version = "0.5.0"
1366
+ authors = []
1367
+
1368
+ [dependencies]
1369
+ bar = "0.3"
1370
+ "# )
1371
+ . file ( "src/main.rs" , "fn main() {}" ) ;
1372
+ p. build ( ) ;
1373
+
1374
+ assert_that ( p. cargo ( "build" ) . arg ( "-v" ) ,
1375
+ execs ( ) . with_status ( 0 ) ) ;
1376
+ }
You can’t perform that action at this time.
0 commit comments