1
Fork 0

Rollup merge of #138701 - tvladyslav:serializable_default_codegen_backend, r=workingjubilee

Make default_codegen_backend serializable

This PR makes default_codegen_backend serializable.
This commit is contained in:
Takayuki Maeda 2025-03-25 15:36:33 +09:00 committed by GitHub
commit e9a528c9b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,6 +103,12 @@ impl Target {
base.$key_name = Some(s);
}
} );
($key_name:ident, Option<StaticCow<str>>) => ( {
let name = (stringify!($key_name)).replace("_", "-");
if let Some(s) = obj.remove(&name).and_then(|b| Some(b.as_str()?.to_string())) {
base.$key_name = Some(s.into());
}
} );
($key_name:ident, BinaryFormat) => ( {
let name = (stringify!($key_name)).replace("_", "-");
obj.remove(&name).and_then(|f| f.as_str().and_then(|s| {
@ -623,6 +629,7 @@ impl Target {
key!(stack_probes, StackProbeType)?;
key!(min_global_align, Option<u64>);
key!(default_codegen_units, Option<u64>);
key!(default_codegen_backend, Option<StaticCow<str>>);
key!(trap_unreachable, bool);
key!(requires_lto, bool);
key!(singlethread, bool);
@ -801,6 +808,7 @@ impl ToJson for Target {
target_option_val!(stack_probes);
target_option_val!(min_global_align);
target_option_val!(default_codegen_units);
target_option_val!(default_codegen_backend);
target_option_val!(trap_unreachable);
target_option_val!(requires_lto);
target_option_val!(singlethread);