File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -568,8 +568,15 @@ impl<'de> de::Deserialize<'de> for VecStringOrBool {
568
568
}
569
569
}
570
570
571
+ /// Represents the `package`/`project` sections of a `Cargo.toml`.
572
+ ///
573
+ /// Note that the order of the fields matters, since this is the order they
574
+ /// are serialized to a TOML file. For example, you cannot have values after
575
+ /// the field `metadata`, since it is a table and values cannot appear after
576
+ /// tables.
571
577
#[ derive( Deserialize , Serialize , Clone , Debug ) ]
572
578
pub struct TomlProject {
579
+ edition : Option < String > ,
573
580
name : String ,
574
581
version : semver:: Version ,
575
582
authors : Option < Vec < String > > ,
@@ -604,7 +611,6 @@ pub struct TomlProject {
604
611
license_file : Option < String > ,
605
612
repository : Option < String > ,
606
613
metadata : Option < toml:: Value > ,
607
- edition : Option < String > ,
608
614
}
609
615
610
616
#[ derive( Debug , Deserialize , Serialize ) ]
Original file line number Diff line number Diff line change @@ -965,6 +965,32 @@ fn test_edition() {
965
965
) ;
966
966
}
967
967
968
+ #[ test]
969
+ fn edition_with_metadata ( ) {
970
+ if !is_nightly ( ) { // --edition is nightly-only
971
+ return ;
972
+ }
973
+
974
+ let p = project ( )
975
+ . file ( "Cargo.toml" , r#"
976
+ cargo-features = ["edition"]
977
+ [package]
978
+ name = "foo"
979
+ version = "0.0.1"
980
+ authors = []
981
+ edition = "2018"
982
+ [package.metadata.docs.rs]
983
+ features = ["foobar"]
984
+ "# )
985
+ . file ( "src/lib.rs" , "" )
986
+ . build ( ) ;
987
+
988
+ assert_that (
989
+ p. cargo ( "package" ) . masquerade_as_nightly_cargo ( ) ,
990
+ execs ( ) ,
991
+ ) ;
992
+ }
993
+
968
994
#[ test]
969
995
fn test_edition_missing ( ) {
970
996
// no edition = 2015
You can’t perform that action at this time.
0 commit comments