Skip to content

Commit

Permalink
fix(rust-irgen): use .extended_property for querying extended prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
chorman0773 committed Nov 19, 2024
1 parent 331cf1a commit ba65395
Showing 1 changed file with 8 additions and 40 deletions.
48 changes: 8 additions & 40 deletions frontend/rust/src/irgen/xir_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,32 +608,16 @@ impl<'a> FunctionTyVisitor for XirFunctionTyVisitor<'a> {
AbiTag::Rust | AbiTag::RustIntrinsic | AbiTag::LCRust(_) => {
if self
.properties
.custom_properties
.iter()
.map(|&Pair(a, b)| (a, b))
.find_map(|(key, value)| {
if key == "lcrust:abi-v0/simd-adjustment-required" {
value.parse::<bool>().ok()
} else {
None
}
})
.extended_property::<bool>("lcrust:abi-v0/simd-adjustment-required")
.unwrap()
.unwrap_or(true)
{
self.param_adjustment = XirParamAdjustment::RustSimd
};
if let Some(tag) = self
.properties
.custom_properties
.iter()
.map(|&Pair(a, b)| (a, b))
.find_map(|(key, value)| {
if key == "lcrust:abi-v0/rustcall-tag" {
return Some(value);
} else {
None
}
})
.extended_property::<&str>("lcrust:abi-v0/rustcall-tag")
.into_ok()
{
self.fnty.tag = tag.into();
} else {
Expand All @@ -644,31 +628,15 @@ impl<'a> FunctionTyVisitor for XirFunctionTyVisitor<'a> {
self.param_adjustment = XirParamAdjustment::RustCallDetuple {
requires_simd_adjustment: self
.properties
.custom_properties
.iter()
.map(|&Pair(a, b)| (a, b))
.find_map(|(key, value)| {
if key == "lcrust:abi-v0/simd-adjustment-required" {
value.parse::<bool>().ok()
} else {
None
}
})
.extended_property::<bool>("lcrust:abi-v0/simd-adjustment-required")
.unwrap()
.unwrap_or(true),
};

if let Some(tag) = self
.properties
.custom_properties
.iter()
.map(|&Pair(a, b)| (a, b))
.find_map(|(key, value)| {
if key == "lcrust:abi-v0/rustcall-tag" {
return Some(value);
} else {
None
}
})
.extended_property::<&str>("lcrust:abi-v0/rustcall-tag")
.into_ok()
{
self.fnty.tag = tag.into();
} else {
Expand Down

0 comments on commit ba65395

Please sign in to comment.