Skip to content

Commit 4cda9b9

Browse files
committed
Add configured_unstable_options field on Config Struct
This new internal Vec is used to track all unstable options specified when running on the stable channel.
1 parent cf21bfc commit 4cda9b9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/config/config_type.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ macro_rules! create_config {
6464
// if a license_template_path has been specified, successfully read, parsed and compiled
6565
// into a regex, it will be stored here
6666
pub license_template: Option<Regex>,
67+
// Unstable Options specified on the stable channel
68+
configured_unstable_options: Option<Vec<String>>,
6769
// For each config item, we store a bool indicating whether it has
6870
// been accessed and the value, and a bool whether the option was
6971
// manually initialised, or taken from the default,
@@ -146,6 +148,7 @@ macro_rules! create_config {
146148
}
147149

148150
fn fill_from_parsed_config(mut self, parsed: PartialConfig, dir: &Path) -> Config {
151+
let mut unstable_options = vec![];
149152
$(
150153
if let Some(val) = parsed.$i {
151154
if self.$i.3 {
@@ -158,10 +161,21 @@ macro_rules! create_config {
158161
} else {
159162
eprintln!("Warning: can't set `{} = {:?}`, unstable features are only \
160163
available in nightly channel.", stringify!($i), val);
164+
// only set abort_on_unrecognised_options, and store all other
165+
// nightly only options
166+
if stringify!($i) != "abort_on_unrecognised_options" {
167+
unstable_options.push(format!("{} = {:?}", stringify!($i), val));
168+
} else {
169+
self.$i.1 = true;
170+
self.$i.2 = val;
171+
}
161172
}
162173
}
163174
}
164175
)+
176+
if unstable_options.len() > 0 {
177+
self.configured_unstable_options = Some(unstable_options);
178+
}
165179
self.set_heuristics();
166180
self.set_license_template();
167181
self.set_ignore(dir);
@@ -438,6 +452,7 @@ macro_rules! create_config {
438452
fn default() -> Config {
439453
Config {
440454
license_template: None,
455+
configured_unstable_options: None,
441456
$(
442457
$i: (Cell::new(false), false, $def, $stb),
443458
)+

0 commit comments

Comments
 (0)