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 {
889889 license : Option < String > ,
890890 license_file : Option < String > ,
891891 repository : Option < String > ,
892- metadata : Option < toml:: Value > ,
893892 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 > ,
894897}
895898
896899#[ derive( Debug , Deserialize , Serialize ) ]
@@ -899,8 +902,11 @@ pub struct TomlWorkspace {
899902 #[ serde( rename = "default-members" ) ]
900903 default_members : Option < Vec < String > > ,
901904 exclude : Option < Vec < String > > ,
902- metadata : Option < toml:: Value > ,
903905 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 > ,
904910}
905911
906912impl TomlProject {
Original file line number Diff line number Diff line change @@ -1954,3 +1954,25 @@ fn reproducible_output() {
19541954 assert_eq ! ( header. groupname( ) . unwrap( ) . unwrap( ) , "" ) ;
19551955 }
19561956}
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