This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/bootstrap/src/core/config Expand file tree Collapse file tree 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 {
618618#[ derive( Deserialize , Default ) ]
619619pub ( crate ) struct ChangeIdWrapper {
620620 #[ serde( alias = "change-id" ) ]
621- inner : Option < usize > ,
621+ pub ( crate ) inner : Option < usize > ,
622622}
623623
624624/// 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 } ;
22use crate :: core:: config:: { LldMode , TomlConfig } ;
33
44use clap:: CommandFactory ;
@@ -237,3 +237,20 @@ fn rust_lld() {
237237 assert ! ( matches!( parse( "rust.use-lld = true" ) . lld_mode, LldMode :: External ) ) ;
238238 assert ! ( matches!( parse( "rust.use-lld = false" ) . lld_mode, LldMode :: Unused ) ) ;
239239}
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