File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
24
24
* ` Config::output_conflict_handling ` does not contain the bless command message anymore, it is instead available separately as ` Config::bless_command `
25
25
* Updating ` cargo_metadata ` to ` 0.18 `
26
26
* Updated ` spanned ` to ` 0.1.5 ` , giving more precise spans for more iterator operations
27
+ * ` Config::cfgs ` is now ` Config::program::cfg_flag `
27
28
28
29
### Removed
29
30
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ pub struct CommandBuilder {
20
20
/// Environment variables passed to the binary that is executed.
21
21
/// The environment variable is removed if the second tuple field is `None`
22
22
pub envs : Vec < ( OsString , Option < OsString > ) > ,
23
+ /// A flag to add in order to make the command print the cfgs it supports
24
+ pub cfg_flag : Option < OsString > ,
23
25
}
24
26
25
27
impl CommandBuilder {
@@ -31,6 +33,7 @@ impl CommandBuilder {
31
33
out_dir_flag : Some ( "--target-dir" . into ( ) ) ,
32
34
input_file_flag : Some ( "--manifest-path" . into ( ) ) ,
33
35
envs : vec ! [ ] ,
36
+ cfg_flag : None ,
34
37
}
35
38
}
36
39
@@ -45,14 +48,7 @@ impl CommandBuilder {
45
48
out_dir_flag : Some ( "--out-dir" . into ( ) ) ,
46
49
input_file_flag : None ,
47
50
envs : vec ! [ ] ,
48
- }
49
- }
50
-
51
- /// Same as [`CommandBuilder::rustc`], but with arguments for obtaining the cfgs.
52
- pub fn cfgs ( ) -> Self {
53
- Self {
54
- args : vec ! [ "--print" . into( ) , "cfg" . into( ) ] ,
55
- ..Self :: rustc ( )
51
+ cfg_flag : Some ( "--print=cfg" . into ( ) ) ,
56
52
}
57
53
}
58
54
@@ -65,6 +61,7 @@ impl CommandBuilder {
65
61
out_dir_flag : None ,
66
62
input_file_flag : None ,
67
63
envs : vec ! [ ] ,
64
+ cfg_flag : None ,
68
65
}
69
66
}
70
67
Original file line number Diff line number Diff line change @@ -27,8 +27,6 @@ pub struct Config {
27
27
pub root_dir : PathBuf ,
28
28
/// The binary to actually execute.
29
29
pub program : CommandBuilder ,
30
- /// The command to run to obtain the cfgs that the output is supposed to
31
- pub cfgs : CommandBuilder ,
32
30
/// What to do in case the stdout/stderr output differs from the expected one.
33
31
pub output_conflict_handling : OutputConflictHandling ,
34
32
/// The recommended command to bless failing tests.
@@ -85,7 +83,6 @@ impl Config {
85
83
target : None ,
86
84
root_dir : root_dir. into ( ) ,
87
85
program : CommandBuilder :: rustc ( ) ,
88
- cfgs : CommandBuilder :: cfgs ( ) ,
89
86
output_conflict_handling : OutputConflictHandling :: Bless ,
90
87
bless_command : None ,
91
88
dependencies_crate_manifest_path : None ,
Original file line number Diff line number Diff line change @@ -24,7 +24,11 @@ pub struct Dependencies {
24
24
}
25
25
26
26
fn cfgs ( config : & Config ) -> Result < Vec < Cfg > > {
27
- let mut cmd = config. cfgs . build ( & config. out_dir ) ;
27
+ let Some ( cfg) = & config. program . cfg_flag else {
28
+ return Ok ( vec ! [ ] ) ;
29
+ } ;
30
+ let mut cmd = config. program . build ( & config. out_dir ) ;
31
+ cmd. arg ( cfg) ;
28
32
cmd. arg ( "--target" ) . arg ( config. target . as_ref ( ) . unwrap ( ) ) ;
29
33
let output = cmd. output ( ) ?;
30
34
let stdout = String :: from_utf8 ( output. stdout ) ?;
You can’t perform that action at this time.
0 commit comments