@@ -178,6 +178,7 @@ pub struct Config {
178
178
package_cache_lock : RefCell < Option < ( Option < FileLock > , usize ) > > ,
179
179
/// Cached configuration parsed by Cargo
180
180
http_config : LazyCell < CargoHttpConfig > ,
181
+ future_incompat_config : LazyCell < CargoFutureIncompatConfig > ,
181
182
net_config : LazyCell < CargoNetConfig > ,
182
183
build_config : LazyCell < CargoBuildConfig > ,
183
184
target_cfgs : LazyCell < Vec < ( String , TargetCfgConfig ) > > ,
@@ -275,6 +276,7 @@ impl Config {
275
276
updated_sources : LazyCell :: new ( ) ,
276
277
package_cache_lock : RefCell :: new ( None ) ,
277
278
http_config : LazyCell :: new ( ) ,
279
+ future_incompat_config : LazyCell :: new ( ) ,
278
280
net_config : LazyCell :: new ( ) ,
279
281
build_config : LazyCell :: new ( ) ,
280
282
target_cfgs : LazyCell :: new ( ) ,
@@ -1436,6 +1438,11 @@ impl Config {
1436
1438
. try_borrow_with ( || self . get :: < CargoHttpConfig > ( "http" ) )
1437
1439
}
1438
1440
1441
+ pub fn future_incompat_config ( & self ) -> CargoResult < & CargoFutureIncompatConfig > {
1442
+ self . future_incompat_config
1443
+ . try_borrow_with ( || self . get :: < CargoFutureIncompatConfig > ( "future-incompat-report" ) )
1444
+ }
1445
+
1439
1446
pub fn net_config ( & self ) -> CargoResult < & CargoNetConfig > {
1440
1447
self . net_config
1441
1448
. try_borrow_with ( || self . get :: < CargoNetConfig > ( "net" ) )
@@ -2034,6 +2041,37 @@ pub struct CargoHttpConfig {
2034
2041
pub ssl_version : Option < SslVersionConfig > ,
2035
2042
}
2036
2043
2044
+ #[ derive( Debug , Default , Deserialize , PartialEq ) ]
2045
+ #[ serde( rename_all = "kebab-case" ) ]
2046
+ pub struct CargoFutureIncompatConfig {
2047
+ frequency : Option < CargoFutureIncompatFrequencyConfig > ,
2048
+ }
2049
+
2050
+ #[ derive( Debug , Deserialize , PartialEq ) ]
2051
+ #[ serde( rename_all = "kebab-case" ) ]
2052
+ pub enum CargoFutureIncompatFrequencyConfig {
2053
+ Always ,
2054
+ Never ,
2055
+ }
2056
+
2057
+ impl CargoFutureIncompatConfig {
2058
+ pub fn should_display_message ( & self ) -> bool {
2059
+ use CargoFutureIncompatFrequencyConfig :: * ;
2060
+
2061
+ let frequency = self . frequency . as_ref ( ) . unwrap_or ( & Always ) ;
2062
+ match frequency {
2063
+ Always => true ,
2064
+ Never => false ,
2065
+ }
2066
+ }
2067
+ }
2068
+
2069
+ impl Default for CargoFutureIncompatFrequencyConfig {
2070
+ fn default ( ) -> Self {
2071
+ Self :: Always
2072
+ }
2073
+ }
2074
+
2037
2075
/// Configuration for `ssl-version` in `http` section
2038
2076
/// There are two ways to configure:
2039
2077
///
0 commit comments