@@ -15,7 +15,7 @@ use std::fs::{self, DirEntry};
15
15
use std:: collections:: HashSet ;
16
16
17
17
use core:: { compiler, Edition , Target } ;
18
- use util:: errors:: CargoResult ;
18
+ use util:: errors:: { CargoResult , CargoResultExt } ;
19
19
use super :: { LibKind , PathValue , StringOrBool , TomlBenchTarget , TomlBinTarget , TomlExampleTarget ,
20
20
TomlLibTarget , TomlManifest , TomlTarget , TomlTestTarget } ;
21
21
@@ -183,7 +183,7 @@ fn clean_lib(
183
183
} ;
184
184
185
185
let mut target = Target :: lib_target ( & lib. name ( ) , crate_types, path) ;
186
- configure ( lib, & mut target) ;
186
+ configure ( lib, & mut target) ? ;
187
187
Ok ( Some ( target) )
188
188
}
189
189
@@ -263,7 +263,7 @@ fn clean_bins(
263
263
} ;
264
264
265
265
let mut target = Target :: bin_target ( & bin. name ( ) , path, bin. required_features . clone ( ) ) ;
266
- configure ( bin, & mut target) ;
266
+ configure ( bin, & mut target) ? ;
267
267
result. push ( target) ;
268
268
}
269
269
return Ok ( result) ;
@@ -324,7 +324,7 @@ fn clean_examples(
324
324
path,
325
325
toml. required_features . clone ( ) ,
326
326
) ;
327
- configure ( & toml, & mut target) ;
327
+ configure ( & toml, & mut target) ? ;
328
328
result. push ( target) ;
329
329
}
330
330
@@ -357,7 +357,7 @@ fn clean_tests(
357
357
let mut result = Vec :: new ( ) ;
358
358
for ( path, toml) in targets {
359
359
let mut target = Target :: test_target ( & toml. name ( ) , path, toml. required_features . clone ( ) ) ;
360
- configure ( & toml, & mut target) ;
360
+ configure ( & toml, & mut target) ? ;
361
361
result. push ( target) ;
362
362
}
363
363
Ok ( result)
@@ -410,7 +410,7 @@ fn clean_benches(
410
410
let mut result = Vec :: new ( ) ;
411
411
for ( path, toml) in targets {
412
412
let mut target = Target :: bench_target ( & toml. name ( ) , path, toml. required_features . clone ( ) ) ;
413
- configure ( & toml, & mut target) ;
413
+ configure ( & toml, & mut target) ? ;
414
414
result. push ( target) ;
415
415
}
416
416
@@ -682,7 +682,7 @@ fn validate_unique_names(targets: &[TomlTarget], target_kind: &str) -> CargoResu
682
682
Ok ( ( ) )
683
683
}
684
684
685
- fn configure ( toml : & TomlTarget , target : & mut Target ) {
685
+ fn configure ( toml : & TomlTarget , target : & mut Target ) -> CargoResult < ( ) > {
686
686
let t2 = target. clone ( ) ;
687
687
target
688
688
. set_tested ( toml. test . unwrap_or_else ( || t2. tested ( ) ) )
@@ -694,7 +694,13 @@ fn configure(toml: &TomlTarget, target: &mut Target) {
694
694
( None , None ) => t2. for_host ( ) ,
695
695
( Some ( true ) , _) | ( _, Some ( true ) ) => true ,
696
696
( Some ( false ) , _) | ( _, Some ( false ) ) => false ,
697
+ } )
698
+ . set_edition ( match toml. edition . clone ( ) {
699
+ None => t2. edition ( ) ,
700
+ // TODO: Check the edition feature gate
701
+ Some ( s) => s. parse ( ) . chain_err ( || "failed to parse the `edition` key" ) ?,
697
702
} ) ;
703
+ Ok ( ( ) )
698
704
}
699
705
700
706
fn target_path (
0 commit comments