1use serde::de::DeserializeOwned;
2use serde_derive::Deserialize;
3use std::fmt;
4use std::fs;
5use std::path::Path;
6use std::path::PathBuf;
7use wasmtime_environ::prelude::*;
8
9pub mod limits {
19 pub const MEMORY_SIZE: usize = 805 << 16;
20 pub const MEMORIES: u32 = 450;
21 pub const TABLES: u32 = 200;
22 pub const MEMORIES_PER_MODULE: u32 = 9;
23 pub const TABLES_PER_MODULE: u32 = 5;
24 pub const COMPONENT_INSTANCES: u32 = 50;
25 pub const CORE_INSTANCES: u32 = 900;
26 pub const TABLE_ELEMENTS: usize = 1000;
27 pub const CORE_INSTANCE_SIZE: usize = 64 * 1024;
28 pub const TOTAL_STACKS: u32 = 10;
29}
30
31pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
34 let mut tests = Vec::new();
35
36 let spec_tests = root.join("tests/spec_testsuite");
37 add_tests(
38 &mut tests,
39 &spec_tests,
40 &FindConfig::Infer(spec_test_config),
41 )
42 .with_context(|| format!("failed to add tests from `{}`", spec_tests.display()))?;
43
44 let misc_tests = root.join("tests/misc_testsuite");
45 add_tests(&mut tests, &misc_tests, &FindConfig::InTest)
46 .with_context(|| format!("failed to add tests from `{}`", misc_tests.display()))?;
47
48 let cm_tests = root.join("tests/component-model/test");
49 add_tests(
50 &mut tests,
51 &cm_tests,
52 &FindConfig::Infer(component_test_config),
53 )
54 .with_context(|| format!("failed to add tests from `{}`", cm_tests.display()))?;
55
56 {
65 let skip_list = &["drop-subtask.wast", "async-calls-sync.wast"];
66 tests.retain(|test| {
67 test.path
68 .file_name()
69 .and_then(|name| name.to_str())
70 .map(|name| !skip_list.contains(&name))
71 .unwrap_or(true)
72 });
73 }
74
75 Ok(tests)
76}
77
78enum FindConfig {
79 InTest,
80 Infer(fn(&Path) -> TestConfig),
81}
82
83fn add_tests(tests: &mut Vec<WastTest>, path: &Path, config: &FindConfig) -> Result<()> {
84 for entry in path.read_dir().context("failed to read directory")? {
85 let entry = entry.context("failed to read directory entry")?;
86 let path = entry.path();
87 if entry
88 .file_type()
89 .context("failed to get file type")?
90 .is_dir()
91 {
92 add_tests(tests, &path, config).context("failed to read sub-directory")?;
93 continue;
94 }
95
96 if path.extension().and_then(|s| s.to_str()) != Some("wast") {
97 continue;
98 }
99
100 let contents =
101 fs::read_to_string(&path).with_context(|| format!("failed to read test: {path:?}"))?;
102 let config = match config {
103 FindConfig::InTest => parse_test_config(&contents, ";;!")
104 .with_context(|| format!("failed to parse test configuration: {path:?}"))?,
105 FindConfig::Infer(f) => f(&path),
106 };
107 tests.push(WastTest {
108 path,
109 contents,
110 config,
111 })
112 }
113 Ok(())
114}
115
116fn spec_test_config(test: &Path) -> TestConfig {
117 let mut ret = TestConfig::default();
118 ret.spec_test = Some(true);
119 match spec_proposal_from_path(test) {
120 Some("wide-arithmetic") => {
121 ret.wide_arithmetic = Some(true);
122 }
123 Some("threads") => {
124 ret.threads = Some(true);
125 ret.reference_types = Some(false);
126 }
127 Some("custom-page-sizes") => {
128 ret.custom_page_sizes = Some(true);
129 ret.multi_memory = Some(true);
130 ret.memory64 = Some(true);
131
132 if test.ends_with("memory_max.wast") || test.ends_with("memory_max_i64.wast") {
135 ret.hogs_memory = Some(true);
136 }
137 }
138 Some("custom-descriptors") => {
139 ret.custom_descriptors = Some(true);
140 }
141 Some(proposal) => panic!("unsupported proposal {proposal:?}"),
142 None => {
143 ret.reference_types = Some(true);
144 ret.simd = Some(true);
145 ret.simd = Some(true);
146 ret.relaxed_simd = Some(true);
147 ret.multi_memory = Some(true);
148 ret.gc = Some(true);
149 ret.reference_types = Some(true);
150 ret.memory64 = Some(true);
151 ret.tail_call = Some(true);
152 ret.extended_const = Some(true);
153 ret.exceptions = Some(true);
154
155 if test.parent().unwrap().ends_with("legacy") {
156 ret.legacy_exceptions = Some(true);
157 }
158
159 if test.ends_with("memory.wast")
168 || test.ends_with("table.wast")
169 || test.ends_with("memory64.wast")
170 || test.ends_with("table64.wast")
171 {
172 ret.hogs_memory = Some(true);
173 }
174 }
175 }
176
177 ret
178}
179
180fn component_test_config(test: &Path) -> TestConfig {
181 let mut ret = TestConfig::default();
182 ret.spec_test = Some(true);
183 ret.reference_types = Some(true);
184 ret.multi_memory = Some(true);
185
186 if let Some(parent) = test.parent() {
187 if parent.ends_with("async")
188 || ["trap-in-post-return.wast"]
189 .into_iter()
190 .any(|name| Some(name) == test.file_name().and_then(|s| s.to_str()))
191 {
192 ret.component_model_async = Some(true);
193 ret.component_model_async_stackful = Some(true);
194 ret.component_model_async_builtins = Some(true);
195 ret.component_model_threading = Some(true);
196 }
197 if parent.ends_with("wasm-tools") {
198 ret.memory64 = Some(true);
199 ret.threads = Some(true);
200 ret.exceptions = Some(true);
201 ret.gc = Some(true);
202 }
203 if parent.ends_with("wasmtime") {
204 ret.exceptions = Some(true);
205 ret.gc = Some(true);
206 }
207 }
208
209 ret
210}
211
212pub fn parse_test_config<T>(wat: &str, comment: &'static str) -> Result<T>
215where
216 T: DeserializeOwned,
217{
218 let config_lines: Vec<_> = wat
221 .lines()
222 .take_while(|l| l.starts_with(comment))
223 .map(|l| &l[comment.len()..])
224 .collect();
225 let config_text = config_lines.join("\n");
226
227 toml::from_str(&config_text).context("failed to parse the test configuration")
228}
229
230#[derive(Clone)]
232pub struct WastTest {
233 pub path: PathBuf,
234 pub contents: String,
235 pub config: TestConfig,
236}
237
238impl fmt::Debug for WastTest {
239 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
240 f.debug_struct("WastTest")
241 .field("path", &self.path)
242 .field("contents", &"...")
243 .field("config", &self.config)
244 .finish()
245 }
246}
247
248macro_rules! foreach_config_option {
249 ($m:ident) => {
250 $m! {
251 memory64
252 custom_page_sizes
253 multi_memory
254 threads
255 shared_everything_threads
256 gc
257 function_references
258 relaxed_simd
259 reference_types
260 tail_call
261 extended_const
262 wide_arithmetic
263 hogs_memory
264 nan_canonicalization
265 component_model_async
266 component_model_async_builtins
267 component_model_async_stackful
268 component_model_threading
269 component_model_error_context
270 component_model_gc
271 simd
272 gc_types
273 exceptions
274 legacy_exceptions
275 stack_switching
276 spec_test
277 custom_descriptors
278 }
279 };
280}
281
282macro_rules! define_test_config {
283 ($($option:ident)*) => {
284 #[derive(Debug, PartialEq, Default, Deserialize, Clone)]
287 #[serde(deny_unknown_fields)]
288 pub struct TestConfig {
289 $(pub $option: Option<bool>,)*
290 }
291
292 impl TestConfig {
293 $(
294 pub fn $option(&self) -> bool {
295 self.$option.unwrap_or(false)
296 }
297 )*
298 }
299 }
300}
301
302foreach_config_option!(define_test_config);
303
304impl TestConfig {
305 pub fn options_mut(&mut self) -> impl Iterator<Item = (&'static str, &mut Option<bool>)> {
307 macro_rules! mk {
308 ($($option:ident)*) => {
309 [
310 $((stringify!($option), &mut self.$option),)*
311 ].into_iter()
312 }
313 }
314 foreach_config_option!(mk)
315 }
316}
317
318#[derive(Debug)]
320pub struct WastConfig {
321 pub compiler: Compiler,
323 pub pooling: bool,
325 pub collector: Collector,
327}
328
329#[derive(PartialEq, Debug, Copy, Clone)]
331pub enum Compiler {
332 CraneliftNative,
339
340 Winch,
345
346 CraneliftPulley,
353}
354
355impl Compiler {
356 pub fn should_fail(&self, config: &TestConfig) -> bool {
367 match self {
368 Compiler::CraneliftNative => config.legacy_exceptions(),
369
370 Compiler::Winch => {
371 if config.gc()
372 || config.tail_call()
373 || config.function_references()
374 || config.gc()
375 || config.relaxed_simd()
376 || config.gc_types()
377 || config.exceptions()
378 || config.legacy_exceptions()
379 || config.stack_switching()
380 || config.legacy_exceptions()
381 || config.component_model_async()
382 {
383 return true;
384 }
385
386 if cfg!(target_arch = "aarch64") {
387 return config.wide_arithmetic()
388 || (config.simd() && !config.spec_test())
389 || config.threads();
390 }
391
392 !cfg!(target_arch = "x86_64")
393 }
394
395 Compiler::CraneliftPulley => {
396 config.threads() || config.legacy_exceptions() || config.stack_switching()
397 }
398 }
399 }
400
401 pub fn supports_host(&self) -> bool {
404 match self {
405 Compiler::CraneliftNative => {
406 cfg!(target_arch = "x86_64")
407 || cfg!(target_arch = "aarch64")
408 || cfg!(target_arch = "riscv64")
409 || cfg!(target_arch = "s390x")
410 }
411 Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"),
412 Compiler::CraneliftPulley => true,
413 }
414 }
415}
416
417#[derive(PartialEq, Debug, Copy, Clone)]
418pub enum Collector {
419 Auto,
420 Null,
421 DeferredReferenceCounting,
422}
423
424impl WastTest {
425 pub fn test_uses_gc_types(&self) -> bool {
428 self.config.gc() || self.config.function_references()
429 }
430
431 pub fn spec_proposal(&self) -> Option<&str> {
433 spec_proposal_from_path(&self.path)
434 }
435
436 pub fn should_fail(&self, config: &WastConfig) -> bool {
439 if !config.compiler.supports_host() {
440 return true;
441 }
442
443 if config.pooling {
445 let unsupported = [
446 "misc_testsuite/memory64/more-than-4gb.wast",
448 "misc_testsuite/memory-combos.wast",
450 "misc_testsuite/threads/atomics-end-of-memory.wast",
451 "misc_testsuite/threads/LB.wast",
452 "misc_testsuite/threads/LB_atomic.wast",
453 "misc_testsuite/threads/MP.wast",
454 "misc_testsuite/threads/MP_atomic.wast",
455 "misc_testsuite/threads/MP_wait.wast",
456 "misc_testsuite/threads/SB.wast",
457 "misc_testsuite/threads/SB_atomic.wast",
458 "misc_testsuite/threads/atomics_notify.wast",
459 "misc_testsuite/threads/atomics_wait_address.wast",
460 "misc_testsuite/threads/wait_notify.wast",
461 "spec_testsuite/proposals/threads/atomic.wast",
462 "spec_testsuite/proposals/threads/exports.wast",
463 "spec_testsuite/proposals/threads/memory.wast",
464 ];
465
466 if unsupported.iter().any(|part| self.path.ends_with(part)) {
467 return true;
468 }
469 }
470
471 if config.compiler.should_fail(&self.config) {
472 return true;
473 }
474
475 if config.compiler == Compiler::Winch {
477 let unsupported = [
479 "extended-const/elem.wast",
480 "extended-const/global.wast",
481 "misc_testsuite/component-model/modules.wast",
482 "misc_testsuite/externref-id-function.wast",
483 "misc_testsuite/externref-segment.wast",
484 "misc_testsuite/externref-segments.wast",
485 "misc_testsuite/externref-table-dropped-segment-issue-8281.wast",
486 "misc_testsuite/linking-errors.wast",
487 "misc_testsuite/many_table_gets_lead_to_gc.wast",
488 "misc_testsuite/mutable_externref_globals.wast",
489 "misc_testsuite/no-mixup-stack-maps.wast",
490 "misc_testsuite/no-panic.wast",
491 "misc_testsuite/simple_ref_is_null.wast",
492 "misc_testsuite/table_grow_with_funcref.wast",
493 "spec_testsuite/br_table.wast",
494 "spec_testsuite/global.wast",
495 "spec_testsuite/ref_func.wast",
496 "spec_testsuite/ref_is_null.wast",
497 "spec_testsuite/ref_null.wast",
498 "spec_testsuite/select.wast",
499 "spec_testsuite/table_fill.wast",
500 "spec_testsuite/table_get.wast",
501 "spec_testsuite/table_grow.wast",
502 "spec_testsuite/table_set.wast",
503 "spec_testsuite/table_size.wast",
504 "spec_testsuite/elem.wast",
505 "spec_testsuite/linking.wast",
506 ];
507
508 if unsupported.iter().any(|part| self.path.ends_with(part)) {
509 return true;
510 }
511
512 #[cfg(target_arch = "aarch64")]
513 {
514 let unsupported = [
515 "misc_testsuite/int-to-float-splat.wast",
516 "misc_testsuite/issue6562.wast",
517 "misc_testsuite/memory64/simd.wast",
518 "misc_testsuite/simd/almost-extmul.wast",
519 "misc_testsuite/simd/canonicalize-nan.wast",
520 "misc_testsuite/simd/cvt-from-uint.wast",
521 "misc_testsuite/simd/edge-of-memory.wast",
522 "misc_testsuite/simd/interesting-float-splat.wast",
523 "misc_testsuite/simd/issue4807.wast",
524 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
525 "misc_testsuite/simd/issue_3173_select_v128.wast",
526 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
527 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
528 "misc_testsuite/simd/replace-lane-preserve.wast",
529 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
530 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
531 "misc_testsuite/simd/unaligned-load.wast",
532 "misc_testsuite/simd/v128-select.wast",
533 "misc_testsuite/winch/issue-10331.wast",
534 "misc_testsuite/winch/issue-10357.wast",
535 "misc_testsuite/winch/issue-10460.wast",
536 "misc_testsuite/winch/replace_lane.wast",
537 "misc_testsuite/winch/simd_multivalue.wast",
538 "misc_testsuite/winch/v128_load_lane_invalid_address.wast",
539 "spec_testsuite/proposals/annotations/simd_lane.wast",
540 "spec_testsuite/proposals/multi-memory/simd_memory-multi.wast",
541 "spec_testsuite/simd_address.wast",
542 "spec_testsuite/simd_align.wast",
543 "spec_testsuite/simd_bit_shift.wast",
544 "spec_testsuite/simd_bitwise.wast",
545 "spec_testsuite/simd_boolean.wast",
546 "spec_testsuite/simd_const.wast",
547 "spec_testsuite/simd_conversions.wast",
548 "spec_testsuite/simd_f32x4.wast",
549 "spec_testsuite/simd_f32x4_arith.wast",
550 "spec_testsuite/simd_f32x4_cmp.wast",
551 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
552 "spec_testsuite/simd_f32x4_rounding.wast",
553 "spec_testsuite/simd_f64x2.wast",
554 "spec_testsuite/simd_f64x2_arith.wast",
555 "spec_testsuite/simd_f64x2_cmp.wast",
556 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
557 "spec_testsuite/simd_f64x2_rounding.wast",
558 "spec_testsuite/simd_i16x8_arith.wast",
559 "spec_testsuite/simd_i16x8_arith2.wast",
560 "spec_testsuite/simd_i16x8_cmp.wast",
561 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
562 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
563 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
564 "spec_testsuite/simd_i16x8_sat_arith.wast",
565 "spec_testsuite/simd_i32x4_arith.wast",
566 "spec_testsuite/simd_i32x4_arith2.wast",
567 "spec_testsuite/simd_i32x4_cmp.wast",
568 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
569 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
570 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
571 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
572 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
573 "spec_testsuite/simd_i64x2_arith.wast",
574 "spec_testsuite/simd_i64x2_arith2.wast",
575 "spec_testsuite/simd_i64x2_cmp.wast",
576 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
577 "spec_testsuite/simd_i8x16_arith.wast",
578 "spec_testsuite/simd_i8x16_arith2.wast",
579 "spec_testsuite/simd_i8x16_cmp.wast",
580 "spec_testsuite/simd_i8x16_sat_arith.wast",
581 "spec_testsuite/simd_int_to_int_extend.wast",
582 "spec_testsuite/simd_lane.wast",
583 "spec_testsuite/simd_load.wast",
584 "spec_testsuite/simd_load16_lane.wast",
585 "spec_testsuite/simd_load32_lane.wast",
586 "spec_testsuite/simd_load64_lane.wast",
587 "spec_testsuite/simd_load8_lane.wast",
588 "spec_testsuite/simd_load_extend.wast",
589 "spec_testsuite/simd_load_splat.wast",
590 "spec_testsuite/simd_load_zero.wast",
591 "spec_testsuite/simd_select.wast",
592 "spec_testsuite/simd_splat.wast",
593 "spec_testsuite/simd_store.wast",
594 "spec_testsuite/simd_store16_lane.wast",
595 "spec_testsuite/simd_store32_lane.wast",
596 "spec_testsuite/simd_store64_lane.wast",
597 "spec_testsuite/simd_store8_lane.wast",
598 ];
599
600 if unsupported.iter().any(|part| self.path.ends_with(part)) {
601 return true;
602 }
603 }
604
605 #[cfg(target_arch = "x86_64")]
606 {
607 let unsupported = [
608 "misc_testsuite/simd/canonicalize-nan.wast",
611 ];
612
613 if unsupported.iter().any(|part| self.path.ends_with(part)) {
614 return true;
615 }
616
617 #[cfg(target_arch = "x86_64")]
619 if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2"))
620 {
621 let unsupported = [
622 "annotations/simd_lane.wast",
623 "memory64/simd.wast",
624 "misc_testsuite/int-to-float-splat.wast",
625 "misc_testsuite/issue6562.wast",
626 "misc_testsuite/simd/almost-extmul.wast",
627 "misc_testsuite/simd/cvt-from-uint.wast",
628 "misc_testsuite/simd/edge-of-memory.wast",
629 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
630 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
631 "misc_testsuite/simd/replace-lane-preserve.wast",
632 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
633 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
634 "misc_testsuite/winch/issue-10331.wast",
635 "misc_testsuite/winch/replace_lane.wast",
636 "spec_testsuite/simd_align.wast",
637 "spec_testsuite/simd_boolean.wast",
638 "spec_testsuite/simd_conversions.wast",
639 "spec_testsuite/simd_f32x4.wast",
640 "spec_testsuite/simd_f32x4_arith.wast",
641 "spec_testsuite/simd_f32x4_cmp.wast",
642 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
643 "spec_testsuite/simd_f32x4_rounding.wast",
644 "spec_testsuite/simd_f64x2.wast",
645 "spec_testsuite/simd_f64x2_arith.wast",
646 "spec_testsuite/simd_f64x2_cmp.wast",
647 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
648 "spec_testsuite/simd_f64x2_rounding.wast",
649 "spec_testsuite/simd_i16x8_cmp.wast",
650 "spec_testsuite/simd_i32x4_cmp.wast",
651 "spec_testsuite/simd_i64x2_arith2.wast",
652 "spec_testsuite/simd_i64x2_cmp.wast",
653 "spec_testsuite/simd_i8x16_arith2.wast",
654 "spec_testsuite/simd_i8x16_cmp.wast",
655 "spec_testsuite/simd_int_to_int_extend.wast",
656 "spec_testsuite/simd_load.wast",
657 "spec_testsuite/simd_load_extend.wast",
658 "spec_testsuite/simd_load_splat.wast",
659 "spec_testsuite/simd_load_zero.wast",
660 "spec_testsuite/simd_splat.wast",
661 "spec_testsuite/simd_store16_lane.wast",
662 "spec_testsuite/simd_store32_lane.wast",
663 "spec_testsuite/simd_store64_lane.wast",
664 "spec_testsuite/simd_store8_lane.wast",
665 "spec_testsuite/simd_load16_lane.wast",
666 "spec_testsuite/simd_load32_lane.wast",
667 "spec_testsuite/simd_load64_lane.wast",
668 "spec_testsuite/simd_load8_lane.wast",
669 "spec_testsuite/simd_bitwise.wast",
670 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
671 "misc_testsuite/simd/unaligned-load.wast",
672 "multi-memory/simd_memory-multi.wast",
673 "misc_testsuite/simd/issue4807.wast",
674 "spec_testsuite/simd_const.wast",
675 "spec_testsuite/simd_i8x16_sat_arith.wast",
676 "spec_testsuite/simd_i64x2_arith.wast",
677 "spec_testsuite/simd_i16x8_arith.wast",
678 "spec_testsuite/simd_i16x8_arith2.wast",
679 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
680 "spec_testsuite/simd_i16x8_sat_arith.wast",
681 "spec_testsuite/simd_i32x4_arith.wast",
682 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
683 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
684 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
685 "spec_testsuite/simd_i8x16_arith.wast",
686 "spec_testsuite/simd_bit_shift.wast",
687 "spec_testsuite/simd_lane.wast",
688 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
689 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
690 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
691 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
692 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
693 "spec_testsuite/simd_i32x4_arith2.wast",
694 ];
695
696 if unsupported.iter().any(|part| self.path.ends_with(part)) {
697 return true;
698 }
699 }
700 }
701 }
702
703 if self.config.custom_descriptors() {
705 let happens_to_work =
706 ["spec_testsuite/proposals/custom-descriptors/binary-leb128.wast"];
707
708 if happens_to_work.iter().any(|part| self.path.ends_with(part)) {
709 return false;
710 }
711 return true;
712 }
713
714 false
715 }
716}
717
718fn spec_proposal_from_path(path: &Path) -> Option<&str> {
719 let mut iter = path.iter();
720 loop {
721 match iter.next()?.to_str()? {
722 "proposals" => break,
723 _ => {}
724 }
725 }
726 Some(iter.next()?.to_str()?)
727}