@@ -1046,7 +1046,7 @@ pub struct TomlWorkspaceField {
10461046#[ serde( rename_all = "kebab-case" ) ]
10471047pub struct TomlProject {
10481048 edition : Option < MaybeWorkspace < String > > ,
1049- rust_version : Option < String > ,
1049+ rust_version : Option < MaybeWorkspace < String > > ,
10501050 name : InternedString ,
10511051 #[ serde( deserialize_with = "version_trim_whitespace" ) ]
10521052 version : MaybeWorkspace < semver:: Version > ,
@@ -1111,6 +1111,8 @@ pub struct TomlWorkspace {
11111111 publish : Option < VecStringOrBool > ,
11121112 edition : Option < String > ,
11131113 badges : Option < BTreeMap < String , BTreeMap < String , String > > > ,
1114+ #[ serde( rename = "rust-version" ) ]
1115+ rust_version : Option < String > ,
11141116
11151117 // Note that this field must come last due to the way toml serialization
11161118 // works which requires tables to be emitted after all values.
@@ -1376,6 +1378,7 @@ impl TomlManifest {
13761378 config. publish . clone ( ) ,
13771379 config. edition . clone ( ) ,
13781380 config. badges . clone ( ) ,
1381+ config. rust_version . clone ( ) ,
13791382 package_root. to_path_buf ( ) ,
13801383 ) ;
13811384
@@ -1441,7 +1444,12 @@ impl TomlManifest {
14411444 }
14421445
14431446 let rust_version = if let Some ( rust_version) = & project. rust_version {
1444- let req = match semver:: VersionReq :: parse ( rust_version) {
1447+ let rust_version = rust_version
1448+ . clone ( )
1449+ . resolve ( & features, "rust_version" , || {
1450+ get_ws ( config, resolved_path. clone ( ) , workspace_config. clone ( ) ) ?. rust_version ( )
1451+ } ) ?;
1452+ let req = match semver:: VersionReq :: parse ( & rust_version) {
14451453 // Exclude semver operators like `^` and pre-release identifiers
14461454 Ok ( req) if rust_version. chars ( ) . all ( |c| c. is_ascii_digit ( ) || c == '.' ) => req,
14471455 _ => bail ! ( "`rust-version` must be a value like \" 1.32\" " ) ,
@@ -1843,6 +1851,7 @@ impl TomlManifest {
18431851 . categories
18441852 . as_ref ( )
18451853 . map ( |_| MaybeWorkspace :: Defined ( metadata. categories . clone ( ) ) ) ;
1854+ project. rust_version = rust_version. clone ( ) . map ( |rv| MaybeWorkspace :: Defined ( rv) ) ;
18461855
18471856 let profiles = me. profile . clone ( ) ;
18481857 if let Some ( profiles) = & profiles {
@@ -2064,6 +2073,7 @@ impl TomlManifest {
20642073 config. publish . clone ( ) ,
20652074 config. edition . clone ( ) ,
20662075 config. badges . clone ( ) ,
2076+ config. rust_version . clone ( ) ,
20672077 root. to_path_buf ( ) ,
20682078 ) ;
20692079 WorkspaceConfig :: Root ( WorkspaceRootConfig :: new (
0 commit comments