This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree 2 files changed +29
-3
lines changed
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -802,7 +802,10 @@ impl ActionHandler {
802
802
. and_then ( |value| Config :: deserialize ( value) ) ;
803
803
804
804
let new_config = match config {
805
- Ok ( value) => value,
805
+ Ok ( mut value) => {
806
+ value. normalise ( ) ;
807
+ value
808
+ }
806
809
Err ( err) => {
807
810
debug ! ( "Received unactionable config: {:?} (error: {:?})" , params. settings, err) ;
808
811
return ;
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ pub struct Config {
111
111
112
112
impl Default for Config {
113
113
fn default ( ) -> Config {
114
- Config {
114
+ let mut result = Config {
115
115
sysroot : None ,
116
116
target : None ,
117
117
rustflags : None ,
@@ -127,7 +127,9 @@ impl Default for Config {
127
127
clear_env_rust_log : true ,
128
128
build_on_save : false ,
129
129
use_crate_blacklist : true ,
130
- }
130
+ } ;
131
+ result. normalise ( ) ;
132
+ result
131
133
}
132
134
}
133
135
@@ -139,6 +141,27 @@ impl Config {
139
141
* self = new;
140
142
}
141
143
144
+ /// Ensures that unstable options are only allowed if `unstable_features` is
145
+ /// true and that is not allowed on stable release channels.
146
+ pub fn normalise ( & mut self ) {
147
+ let allow_unstable = option_env ! ( "CFG_RELEASE_CHANNEL" ) . map ( |c| c == "nightly" ) . unwrap_or ( true ) ;
148
+
149
+ if !allow_unstable {
150
+ if self . unstable_features {
151
+ eprintln ! ( "`unstable_features` setting can only be used on nightly channel" ) ;
152
+ }
153
+ self . unstable_features = false ;
154
+ }
155
+
156
+ if !self . unstable_features {
157
+ if self . workspace_mode {
158
+ eprintln ! ( "`workspace_mode` setting is unstable; ignored" ) ;
159
+ }
160
+ self . workspace_mode = false ;
161
+ self . analyze_package = None ;
162
+ }
163
+ }
164
+
142
165
pub fn needs_inference ( & self ) -> bool {
143
166
match ( & self . build_lib , & self . build_bin ) {
144
167
( & Inferrable :: None , _) |
You can’t perform that action at this time.
0 commit comments