(&self, config: &mut Config)
| 1172 | } |
| 1173 | |
| 1174 | pub fn enable_wasm_features(&self, config: &mut Config) -> Result<()> { |
| 1175 | let all = self.wasm.all_proposals; |
| 1176 | |
| 1177 | if let Some(enable) = self.wasm.simd.or(all) { |
| 1178 | config.wasm_simd(enable); |
| 1179 | } |
| 1180 | if let Some(enable) = self.wasm.relaxed_simd.or(all) { |
| 1181 | config.wasm_relaxed_simd(enable); |
| 1182 | } |
| 1183 | if let Some(enable) = self.wasm.bulk_memory.or(all) { |
| 1184 | config.wasm_bulk_memory(enable); |
| 1185 | } |
| 1186 | if let Some(enable) = self.wasm.multi_value.or(all) { |
| 1187 | config.wasm_multi_value(enable); |
| 1188 | } |
| 1189 | if let Some(enable) = self.wasm.tail_call.or(all) { |
| 1190 | config.wasm_tail_call(enable); |
| 1191 | } |
| 1192 | if let Some(enable) = self.wasm.multi_memory.or(all) { |
| 1193 | config.wasm_multi_memory(enable); |
| 1194 | } |
| 1195 | if let Some(enable) = self.wasm.memory64.or(all) { |
| 1196 | config.wasm_memory64(enable); |
| 1197 | } |
| 1198 | if let Some(enable) = self.wasm.stack_switching { |
| 1199 | config.wasm_stack_switching(enable); |
| 1200 | } |
| 1201 | if let Some(enable) = self.wasm.custom_page_sizes.or(all) { |
| 1202 | config.wasm_custom_page_sizes(enable); |
| 1203 | } |
| 1204 | if let Some(enable) = self.wasm.wide_arithmetic.or(all) { |
| 1205 | config.wasm_wide_arithmetic(enable); |
| 1206 | } |
| 1207 | // Not included in `all_proposals`: off by default until fuzzed. |
| 1208 | if let Some(enable) = self.wasm.branch_hinting { |
| 1209 | config.wasm_branch_hinting(enable); |
| 1210 | } |
| 1211 | if let Some(enable) = self.wasm.extended_const.or(all) { |
| 1212 | config.wasm_extended_const(enable); |
| 1213 | } |
| 1214 | |
| 1215 | macro_rules! handle_conditionally_compiled { |
| 1216 | ($(($feature:tt, $field:tt, $method:tt))*) => ($( |
| 1217 | if let Some(enable) = self.wasm.$field.or(all) { |
| 1218 | #[cfg(feature = $feature)] |
| 1219 | config.$method(enable); |
| 1220 | #[cfg(not(feature = $feature))] |
| 1221 | if enable && all.is_none() { |
| 1222 | bail!("support for {} was disabled at compile-time", $feature); |
| 1223 | } |
| 1224 | } |
| 1225 | )*) |
| 1226 | } |
| 1227 | |
| 1228 | handle_conditionally_compiled! { |
| 1229 | ("component-model", component_model, wasm_component_model) |
| 1230 | ("component-model-async", component_model_async, wasm_component_model_async) |
| 1231 | ("component-model-async", component_model_more_async_builtins, wasm_component_model_more_async_builtins) |
no test coverage detected