File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -889,8 +889,11 @@ pub struct TomlProject {
889
889
license : Option < String > ,
890
890
license_file : Option < String > ,
891
891
repository : Option < String > ,
892
- metadata : Option < toml:: Value > ,
893
892
resolver : Option < String > ,
893
+
894
+ // Note that this field must come last due to the way toml serialization
895
+ // works which requires tables to be emitted after all values.
896
+ metadata : Option < toml:: Value > ,
894
897
}
895
898
896
899
#[ derive( Debug , Deserialize , Serialize ) ]
@@ -899,8 +902,11 @@ pub struct TomlWorkspace {
899
902
#[ serde( rename = "default-members" ) ]
900
903
default_members : Option < Vec < String > > ,
901
904
exclude : Option < Vec < String > > ,
902
- metadata : Option < toml:: Value > ,
903
905
resolver : Option < String > ,
906
+
907
+ // Note that this field must come last due to the way toml serialization
908
+ // works which requires tables to be emitted after all values.
909
+ metadata : Option < toml:: Value > ,
904
910
}
905
911
906
912
impl TomlProject {
Original file line number Diff line number Diff line change @@ -1954,3 +1954,25 @@ fn reproducible_output() {
1954
1954
assert_eq ! ( header. groupname( ) . unwrap( ) . unwrap( ) , "" ) ;
1955
1955
}
1956
1956
}
1957
+
1958
+ #[ cargo_test]
1959
+ fn package_with_resolver_and_metadata ( ) {
1960
+ let p = project ( )
1961
+ . file (
1962
+ "Cargo.toml" ,
1963
+ r#"
1964
+ [package]
1965
+ name = "foo"
1966
+ version = "0.0.1"
1967
+ authors = []
1968
+ resolver = '2'
1969
+
1970
+ [package.metadata.docs.rs]
1971
+ all-features = true
1972
+ "# ,
1973
+ )
1974
+ . file ( "src/lib.rs" , "" )
1975
+ . build ( ) ;
1976
+
1977
+ p. cargo ( "package" ) . run ( ) ;
1978
+ }
You can’t perform that action at this time.
0 commit comments