@@ -10,6 +10,7 @@ lazy_static! {
1010 pub ( crate ) static ref MAIN_TOOLCHAIN : Toolchain = Toolchain {
1111 source: RustwideToolchain :: dist( "stable" ) ,
1212 rustflags: None ,
13+ cargoflags: None ,
1314 ci_try: false ,
1415 patches: Vec :: new( ) ,
1516 } ;
@@ -18,6 +19,7 @@ lazy_static! {
1819 pub ( crate ) static ref TEST_TOOLCHAIN : Toolchain = Toolchain {
1920 source: RustwideToolchain :: dist( "beta" ) ,
2021 rustflags: None ,
22+ cargoflags: None ,
2123 ci_try: false ,
2224 patches: Vec :: new( ) ,
2325 } ;
@@ -27,6 +29,7 @@ lazy_static! {
2729pub struct Toolchain {
2830 pub source : RustwideToolchain ,
2931 pub rustflags : Option < String > ,
32+ pub cargoflags : Option < String > ,
3033 pub ci_try : bool ,
3134 pub patches : Vec < CratePatch > ,
3235}
@@ -65,6 +68,10 @@ impl fmt::Display for Toolchain {
6568 write ! ( f, "+rustflags={}" , flag) ?;
6669 }
6770
71+ if let Some ( ref flag) = self . cargoflags {
72+ write ! ( f, "+cargoflags={}" , flag) ?;
73+ }
74+
6875 for patch in self . patches . iter ( ) {
6976 write ! ( f, "+patch={}" , patch) ?;
7077 }
@@ -114,6 +121,7 @@ impl FromStr for Toolchain {
114121 } ;
115122
116123 let mut rustflags = None ;
124+ let mut cargoflags = None ;
117125 let mut patches: Vec < CratePatch > = vec ! [ ] ;
118126 for part in parts {
119127 if let Some ( equal_idx) = part. find ( '=' ) {
@@ -126,6 +134,7 @@ impl FromStr for Toolchain {
126134
127135 match flag {
128136 "rustflags" => rustflags = Some ( value) ,
137+ "cargoflags" => cargoflags = Some ( value) ,
129138 "patch" => patches. push ( value. parse ( ) ?) ,
130139 unknown => return Err ( ToolchainParseError :: InvalidFlag ( unknown. to_string ( ) ) ) ,
131140 }
@@ -137,6 +146,7 @@ impl FromStr for Toolchain {
137146 Ok ( Toolchain {
138147 source,
139148 rustflags,
149+ cargoflags,
140150 ci_try,
141151 patches,
142152 } )
@@ -189,14 +199,25 @@ mod tests {
189199 test_from_str!( $str => Toolchain {
190200 source: $source,
191201 rustflags: None ,
202+ cargoflags: None ,
192203 ci_try: $ci_try,
193204 patches: Vec :: new( ) ,
194205 } ) ;
195206
196- // Test parsing with flags
207+ // Test parsing with rustflags
197208 test_from_str!( concat!( $str, "+rustflags=foo bar" ) => Toolchain {
198209 source: $source,
199210 rustflags: Some ( "foo bar" . to_string( ) ) ,
211+ cargoflags: None ,
212+ ci_try: $ci_try,
213+ patches: Vec :: new( ) ,
214+ } ) ;
215+
216+ // Test parsing with cargoflags
217+ test_from_str!( concat!( $str, "+cargoflags=foo bar" ) => Toolchain {
218+ source: $source,
219+ rustflags: None ,
220+ cargoflags: Some ( "foo bar" . to_string( ) ) ,
200221 ci_try: $ci_try,
201222 patches: Vec :: new( ) ,
202223 } ) ;
@@ -205,6 +226,7 @@ mod tests {
205226 test_from_str!( concat!( $str, "+patch=example=https://git.example.com/some/repo=master" ) => Toolchain {
206227 source: $source,
207228 rustflags: None ,
229+ cargoflags: None ,
208230 ci_try: $ci_try,
209231 patches: vec![ CratePatch {
210232 name: "example" . to_string( ) ,
@@ -217,6 +239,7 @@ mod tests {
217239 test_from_str!( concat!( $str, "+rustflags=foo bar+patch=example=https://git.example.com/some/repo=master" ) => Toolchain {
218240 source: $source,
219241 rustflags: Some ( "foo bar" . to_string( ) ) ,
242+ cargoflags: None ,
220243 ci_try: $ci_try,
221244 patches: vec![ CratePatch {
222245 name: "example" . to_string( ) ,
0 commit comments