@@ -10,6 +10,7 @@ lazy_static! {
10
10
pub ( crate ) static ref MAIN_TOOLCHAIN : Toolchain = Toolchain {
11
11
source: RustwideToolchain :: dist( "stable" ) ,
12
12
rustflags: None ,
13
+ cargoflags: None ,
13
14
ci_try: false ,
14
15
patches: Vec :: new( ) ,
15
16
} ;
@@ -18,6 +19,7 @@ lazy_static! {
18
19
pub ( crate ) static ref TEST_TOOLCHAIN : Toolchain = Toolchain {
19
20
source: RustwideToolchain :: dist( "beta" ) ,
20
21
rustflags: None ,
22
+ cargoflags: None ,
21
23
ci_try: false ,
22
24
patches: Vec :: new( ) ,
23
25
} ;
@@ -27,6 +29,7 @@ lazy_static! {
27
29
pub struct Toolchain {
28
30
pub source : RustwideToolchain ,
29
31
pub rustflags : Option < String > ,
32
+ pub cargoflags : Option < String > ,
30
33
pub ci_try : bool ,
31
34
pub patches : Vec < CratePatch > ,
32
35
}
@@ -65,6 +68,10 @@ impl fmt::Display for Toolchain {
65
68
write ! ( f, "+rustflags={}" , flag) ?;
66
69
}
67
70
71
+ if let Some ( ref flag) = self . cargoflags {
72
+ write ! ( f, "+cargoflags={}" , flag) ?;
73
+ }
74
+
68
75
for patch in self . patches . iter ( ) {
69
76
write ! ( f, "+patch={}" , patch) ?;
70
77
}
@@ -114,6 +121,7 @@ impl FromStr for Toolchain {
114
121
} ;
115
122
116
123
let mut rustflags = None ;
124
+ let mut cargoflags = None ;
117
125
let mut patches: Vec < CratePatch > = vec ! [ ] ;
118
126
for part in parts {
119
127
if let Some ( equal_idx) = part. find ( '=' ) {
@@ -126,6 +134,7 @@ impl FromStr for Toolchain {
126
134
127
135
match flag {
128
136
"rustflags" => rustflags = Some ( value) ,
137
+ "cargoflags" => cargoflags = Some ( value) ,
129
138
"patch" => patches. push ( value. parse ( ) ?) ,
130
139
unknown => return Err ( ToolchainParseError :: InvalidFlag ( unknown. to_string ( ) ) ) ,
131
140
}
@@ -137,6 +146,7 @@ impl FromStr for Toolchain {
137
146
Ok ( Toolchain {
138
147
source,
139
148
rustflags,
149
+ cargoflags,
140
150
ci_try,
141
151
patches,
142
152
} )
@@ -189,14 +199,25 @@ mod tests {
189
199
test_from_str!( $str => Toolchain {
190
200
source: $source,
191
201
rustflags: None ,
202
+ cargoflags: None ,
192
203
ci_try: $ci_try,
193
204
patches: Vec :: new( ) ,
194
205
} ) ;
195
206
196
- // Test parsing with flags
207
+ // Test parsing with rustflags
197
208
test_from_str!( concat!( $str, "+rustflags=foo bar" ) => Toolchain {
198
209
source: $source,
199
210
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( ) ) ,
200
221
ci_try: $ci_try,
201
222
patches: Vec :: new( ) ,
202
223
} ) ;
@@ -205,6 +226,7 @@ mod tests {
205
226
test_from_str!( concat!( $str, "+patch=example=https://git.example.com/some/repo=master" ) => Toolchain {
206
227
source: $source,
207
228
rustflags: None ,
229
+ cargoflags: None ,
208
230
ci_try: $ci_try,
209
231
patches: vec![ CratePatch {
210
232
name: "example" . to_string( ) ,
@@ -217,6 +239,7 @@ mod tests {
217
239
test_from_str!( concat!( $str, "+rustflags=foo bar+patch=example=https://git.example.com/some/repo=master" ) => Toolchain {
218
240
source: $source,
219
241
rustflags: Some ( "foo bar" . to_string( ) ) ,
242
+ cargoflags: None ,
220
243
ci_try: $ci_try,
221
244
patches: vec![ CratePatch {
222
245
name: "example" . to_string( ) ,
0 commit comments