File tree 2 files changed +19
-2
lines changed
src/bootstrap/src/core/config
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -618,7 +618,7 @@ pub(crate) struct TomlConfig {
618
618
#[ derive( Deserialize , Default ) ]
619
619
pub ( crate ) struct ChangeIdWrapper {
620
620
#[ serde( alias = "change-id" ) ]
621
- inner : Option < usize > ,
621
+ pub ( crate ) inner : Option < usize > ,
622
622
}
623
623
624
624
/// Describes how to handle conflicts in merging two [`TomlConfig`]
Original file line number Diff line number Diff line change 1
- use super :: { flags:: Flags , Config } ;
1
+ use super :: { flags:: Flags , ChangeIdWrapper , Config } ;
2
2
use crate :: core:: config:: { LldMode , TomlConfig } ;
3
3
4
4
use clap:: CommandFactory ;
@@ -237,3 +237,20 @@ fn rust_lld() {
237
237
assert ! ( matches!( parse( "rust.use-lld = true" ) . lld_mode, LldMode :: External ) ) ;
238
238
assert ! ( matches!( parse( "rust.use-lld = false" ) . lld_mode, LldMode :: Unused ) ) ;
239
239
}
240
+
241
+ #[ test]
242
+ #[ should_panic]
243
+ fn parse_config_with_unknown_field ( ) {
244
+ parse ( "unknown-key = 1" ) ;
245
+ }
246
+
247
+ #[ test]
248
+ fn parse_change_id_with_unknown_field ( ) {
249
+ let config = r#"
250
+ change-id = 3461
251
+ unknown-key = 1
252
+ "# ;
253
+
254
+ let change_id_wrapper: ChangeIdWrapper = toml:: from_str ( config) . unwrap ( ) ;
255
+ assert_eq ! ( change_id_wrapper. inner, Some ( 3461 ) ) ;
256
+ }
You can’t perform that action at this time.
0 commit comments