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 {
59 let skip_list = &[
60 ];
62 tests.retain(|test| {
63 test.path
64 .file_name()
65 .and_then(|name| name.to_str())
66 .map(|name| !skip_list.contains(&name))
67 .unwrap_or(true)
68 });
69 }
70
71 Ok(tests)
72}
73
74enum FindConfig {
75 InTest,
76 Infer(fn(&Path) -> TestConfig),
77}
78
79fn add_tests(tests: &mut Vec<WastTest>, path: &Path, config: &FindConfig) -> Result<()> {
80 for entry in path.read_dir().context("failed to read directory")? {
81 let entry = entry.context("failed to read directory entry")?;
82 let path = entry.path();
83 if entry
84 .file_type()
85 .context("failed to get file type")?
86 .is_dir()
87 {
88 add_tests(tests, &path, config).context("failed to read sub-directory")?;
89 continue;
90 }
91
92 if path.extension().and_then(|s| s.to_str()) != Some("wast") {
93 continue;
94 }
95
96 let contents =
97 fs::read_to_string(&path).with_context(|| format!("failed to read test: {path:?}"))?;
98 let config = match config {
99 FindConfig::InTest => parse_test_config(&contents, ";;!")
100 .with_context(|| format!("failed to parse test configuration: {path:?}"))?,
101 FindConfig::Infer(f) => f(&path),
102 };
103 tests.push(WastTest {
104 path,
105 contents,
106 config,
107 })
108 }
109 Ok(())
110}
111
112fn spec_test_config(test: &Path) -> TestConfig {
113 let mut ret = TestConfig::default();
114 ret.spec_test = Some(true);
115 match spec_proposal_from_path(test) {
116 Some("wide-arithmetic") => {
117 ret.wide_arithmetic = Some(true);
118 }
119 Some("threads") => {
120 ret.threads = Some(true);
121 ret.reference_types = Some(false);
122 }
123 Some("custom-page-sizes") => {
124 ret.custom_page_sizes = Some(true);
125 ret.multi_memory = Some(true);
126 ret.memory64 = Some(true);
127
128 if test.ends_with("memory_max.wast") || test.ends_with("memory_max_i64.wast") {
131 ret.hogs_memory = Some(true);
132 }
133 }
134 Some("custom-descriptors") => {
135 ret.custom_descriptors = Some(true);
136 }
137 Some(proposal) => panic!("unsupported proposal {proposal:?}"),
138 None => {
139 ret.reference_types = Some(true);
140 ret.simd = Some(true);
141 ret.simd = Some(true);
142 ret.relaxed_simd = Some(true);
143 ret.multi_memory = Some(true);
144 ret.gc = Some(true);
145 ret.reference_types = Some(true);
146 ret.memory64 = Some(true);
147 ret.tail_call = Some(true);
148 ret.extended_const = Some(true);
149 ret.exceptions = Some(true);
150
151 if test.parent().unwrap().ends_with("legacy") {
152 ret.legacy_exceptions = Some(true);
153 }
154
155 if test.ends_with("memory.wast")
164 || test.ends_with("table.wast")
165 || test.ends_with("memory64.wast")
166 || test.ends_with("table64.wast")
167 {
168 ret.hogs_memory = Some(true);
169 }
170 }
171 }
172
173 ret
174}
175
176fn component_test_config(test: &Path) -> TestConfig {
177 let mut ret = TestConfig::default();
178 ret.spec_test = Some(true);
179 ret.reference_types = Some(true);
180 ret.multi_memory = Some(true);
181
182 if let Some(parent) = test.parent() {
183 if parent.ends_with("async")
184 || [
185 "trap-in-post-return.wast",
186 "resources.wast",
187 "multiple-resources.wast",
188 ]
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 component_model_map
272 component_model_fixed_length_lists
273 simd
274 gc_types
275 exceptions
276 legacy_exceptions
277 stack_switching
278 spec_test
279 custom_descriptors
280 }
281 };
282}
283
284macro_rules! define_test_config {
285 ($($option:ident)*) => {
286 #[derive(Debug, PartialEq, Default, Deserialize, Clone)]
289 #[serde(deny_unknown_fields)]
290 pub struct TestConfig {
291 $(pub $option: Option<bool>,)*
292 }
293
294 impl TestConfig {
295 $(
296 pub fn $option(&self) -> bool {
297 self.$option.unwrap_or(false)
298 }
299 )*
300 }
301 }
302}
303
304foreach_config_option!(define_test_config);
305
306impl TestConfig {
307 pub fn options_mut(&mut self) -> impl Iterator<Item = (&'static str, &mut Option<bool>)> {
309 macro_rules! mk {
310 ($($option:ident)*) => {
311 [
312 $((stringify!($option), &mut self.$option),)*
313 ].into_iter()
314 }
315 }
316 foreach_config_option!(mk)
317 }
318}
319
320#[derive(Debug)]
322pub struct WastConfig {
323 pub compiler: Compiler,
325 pub pooling: bool,
327 pub collector: Collector,
329}
330
331#[derive(PartialEq, Debug, Copy, Clone)]
333pub enum Compiler {
334 CraneliftNative,
341
342 Winch,
347
348 CraneliftPulley,
355}
356
357impl Compiler {
358 pub fn should_fail(&self, config: &TestConfig) -> bool {
369 match self {
370 Compiler::CraneliftNative => config.legacy_exceptions(),
371
372 Compiler::Winch => {
373 if config.gc()
374 || config.tail_call()
375 || config.function_references()
376 || config.gc()
377 || config.relaxed_simd()
378 || config.gc_types()
379 || config.exceptions()
380 || config.legacy_exceptions()
381 || config.stack_switching()
382 || config.legacy_exceptions()
383 || config.component_model_async()
384 {
385 return true;
386 }
387
388 if cfg!(target_arch = "aarch64") {
389 return config.wide_arithmetic()
390 || (config.simd() && !config.spec_test())
391 || config.threads();
392 }
393
394 !cfg!(target_arch = "x86_64")
395 }
396
397 Compiler::CraneliftPulley => {
398 config.threads() || config.legacy_exceptions() || config.stack_switching()
399 }
400 }
401 }
402
403 pub fn supports_host(&self) -> bool {
406 match self {
407 Compiler::CraneliftNative => {
408 cfg!(target_arch = "x86_64")
409 || cfg!(target_arch = "aarch64")
410 || cfg!(target_arch = "riscv64")
411 || cfg!(target_arch = "s390x")
412 }
413 Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"),
414 Compiler::CraneliftPulley => true,
415 }
416 }
417}
418
419#[derive(PartialEq, Debug, Copy, Clone)]
420pub enum Collector {
421 Auto,
422 Null,
423 DeferredReferenceCounting,
424}
425
426impl WastTest {
427 pub fn test_uses_gc_types(&self) -> bool {
430 self.config.gc() || self.config.function_references()
431 }
432
433 pub fn spec_proposal(&self) -> Option<&str> {
435 spec_proposal_from_path(&self.path)
436 }
437
438 pub fn should_fail(&self, config: &WastConfig) -> bool {
441 if !config.compiler.supports_host() {
442 return true;
443 }
444
445 let unsupported = [
449 "test/async/same-component-stream-future.wast",
450 "test/async/trap-if-block-and-sync.wast",
451 ];
452 if unsupported.iter().any(|part| self.path.ends_with(part)) {
453 return true;
454 }
455
456 if config.pooling {
458 let unsupported = [
459 "misc_testsuite/memory64/more-than-4gb.wast",
461 "misc_testsuite/memory-combos.wast",
463 "misc_testsuite/threads/atomics-end-of-memory.wast",
464 "misc_testsuite/threads/LB.wast",
465 "misc_testsuite/threads/LB_atomic.wast",
466 "misc_testsuite/threads/MP.wast",
467 "misc_testsuite/threads/MP_atomic.wast",
468 "misc_testsuite/threads/MP_wait.wast",
469 "misc_testsuite/threads/SB.wast",
470 "misc_testsuite/threads/SB_atomic.wast",
471 "misc_testsuite/threads/atomics_notify.wast",
472 "misc_testsuite/threads/atomics_wait_address.wast",
473 "misc_testsuite/threads/wait_notify.wast",
474 "spec_testsuite/proposals/threads/atomic.wast",
475 "spec_testsuite/proposals/threads/exports.wast",
476 "spec_testsuite/proposals/threads/memory.wast",
477 ];
478
479 if unsupported.iter().any(|part| self.path.ends_with(part)) {
480 return true;
481 }
482 }
483
484 if config.compiler.should_fail(&self.config) {
485 return true;
486 }
487
488 if config.compiler == Compiler::Winch {
490 let unsupported = [
492 "extended-const/elem.wast",
493 "extended-const/global.wast",
494 "misc_testsuite/component-model/modules.wast",
495 "misc_testsuite/externref-id-function.wast",
496 "misc_testsuite/externref-segment.wast",
497 "misc_testsuite/externref-segments.wast",
498 "misc_testsuite/externref-table-dropped-segment-issue-8281.wast",
499 "misc_testsuite/linking-errors.wast",
500 "misc_testsuite/many_table_gets_lead_to_gc.wast",
501 "misc_testsuite/mutable_externref_globals.wast",
502 "misc_testsuite/no-mixup-stack-maps.wast",
503 "misc_testsuite/no-panic.wast",
504 "misc_testsuite/simple_ref_is_null.wast",
505 "misc_testsuite/table_grow_with_funcref.wast",
506 "spec_testsuite/br_table.wast",
507 "spec_testsuite/global.wast",
508 "spec_testsuite/ref_func.wast",
509 "spec_testsuite/ref_is_null.wast",
510 "spec_testsuite/ref_null.wast",
511 "spec_testsuite/select.wast",
512 "spec_testsuite/table_fill.wast",
513 "spec_testsuite/table_get.wast",
514 "spec_testsuite/table_grow.wast",
515 "spec_testsuite/table_set.wast",
516 "spec_testsuite/table_size.wast",
517 "spec_testsuite/elem.wast",
518 "spec_testsuite/linking.wast",
519 ];
520
521 if unsupported.iter().any(|part| self.path.ends_with(part)) {
522 return true;
523 }
524
525 #[cfg(target_arch = "aarch64")]
526 {
527 let unsupported = [
528 "misc_testsuite/int-to-float-splat.wast",
529 "misc_testsuite/issue6562.wast",
530 "misc_testsuite/memory64/simd.wast",
531 "misc_testsuite/simd/almost-extmul.wast",
532 "misc_testsuite/simd/canonicalize-nan.wast",
533 "misc_testsuite/simd/cvt-from-uint.wast",
534 "misc_testsuite/simd/edge-of-memory.wast",
535 "misc_testsuite/simd/interesting-float-splat.wast",
536 "misc_testsuite/simd/issue4807.wast",
537 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
538 "misc_testsuite/simd/issue_3173_select_v128.wast",
539 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
540 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
541 "misc_testsuite/simd/replace-lane-preserve.wast",
542 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
543 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
544 "misc_testsuite/simd/unaligned-load.wast",
545 "misc_testsuite/simd/v128-select.wast",
546 "misc_testsuite/winch/issue-10331.wast",
547 "misc_testsuite/winch/issue-10357.wast",
548 "misc_testsuite/winch/issue-10460.wast",
549 "misc_testsuite/winch/replace_lane.wast",
550 "misc_testsuite/winch/simd_multivalue.wast",
551 "misc_testsuite/winch/v128_load_lane_invalid_address.wast",
552 "spec_testsuite/proposals/annotations/simd_lane.wast",
553 "spec_testsuite/proposals/multi-memory/simd_memory-multi.wast",
554 "spec_testsuite/simd_address.wast",
555 "spec_testsuite/simd_align.wast",
556 "spec_testsuite/simd_bit_shift.wast",
557 "spec_testsuite/simd_bitwise.wast",
558 "spec_testsuite/simd_boolean.wast",
559 "spec_testsuite/simd_const.wast",
560 "spec_testsuite/simd_conversions.wast",
561 "spec_testsuite/simd_f32x4.wast",
562 "spec_testsuite/simd_f32x4_arith.wast",
563 "spec_testsuite/simd_f32x4_cmp.wast",
564 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
565 "spec_testsuite/simd_f32x4_rounding.wast",
566 "spec_testsuite/simd_f64x2.wast",
567 "spec_testsuite/simd_f64x2_arith.wast",
568 "spec_testsuite/simd_f64x2_cmp.wast",
569 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
570 "spec_testsuite/simd_f64x2_rounding.wast",
571 "spec_testsuite/simd_i16x8_arith.wast",
572 "spec_testsuite/simd_i16x8_arith2.wast",
573 "spec_testsuite/simd_i16x8_cmp.wast",
574 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
575 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
576 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
577 "spec_testsuite/simd_i16x8_sat_arith.wast",
578 "spec_testsuite/simd_i32x4_arith.wast",
579 "spec_testsuite/simd_i32x4_arith2.wast",
580 "spec_testsuite/simd_i32x4_cmp.wast",
581 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
582 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
583 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
584 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
585 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
586 "spec_testsuite/simd_i64x2_arith.wast",
587 "spec_testsuite/simd_i64x2_arith2.wast",
588 "spec_testsuite/simd_i64x2_cmp.wast",
589 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
590 "spec_testsuite/simd_i8x16_arith.wast",
591 "spec_testsuite/simd_i8x16_arith2.wast",
592 "spec_testsuite/simd_i8x16_cmp.wast",
593 "spec_testsuite/simd_i8x16_sat_arith.wast",
594 "spec_testsuite/simd_int_to_int_extend.wast",
595 "spec_testsuite/simd_lane.wast",
596 "spec_testsuite/simd_load.wast",
597 "spec_testsuite/simd_load16_lane.wast",
598 "spec_testsuite/simd_load32_lane.wast",
599 "spec_testsuite/simd_load64_lane.wast",
600 "spec_testsuite/simd_load8_lane.wast",
601 "spec_testsuite/simd_load_extend.wast",
602 "spec_testsuite/simd_load_splat.wast",
603 "spec_testsuite/simd_load_zero.wast",
604 "spec_testsuite/simd_select.wast",
605 "spec_testsuite/simd_splat.wast",
606 "spec_testsuite/simd_store.wast",
607 "spec_testsuite/simd_store16_lane.wast",
608 "spec_testsuite/simd_store32_lane.wast",
609 "spec_testsuite/simd_store64_lane.wast",
610 "spec_testsuite/simd_store8_lane.wast",
611 ];
612
613 if unsupported.iter().any(|part| self.path.ends_with(part)) {
614 return true;
615 }
616 }
617
618 #[cfg(target_arch = "x86_64")]
619 {
620 let unsupported = [
621 "misc_testsuite/simd/canonicalize-nan.wast",
624 ];
625
626 if unsupported.iter().any(|part| self.path.ends_with(part)) {
627 return true;
628 }
629
630 #[cfg(target_arch = "x86_64")]
632 if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2"))
633 {
634 let unsupported = [
635 "annotations/simd_lane.wast",
636 "memory64/simd.wast",
637 "misc_testsuite/int-to-float-splat.wast",
638 "misc_testsuite/issue6562.wast",
639 "misc_testsuite/simd/almost-extmul.wast",
640 "misc_testsuite/simd/cvt-from-uint.wast",
641 "misc_testsuite/simd/edge-of-memory.wast",
642 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
643 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
644 "misc_testsuite/simd/replace-lane-preserve.wast",
645 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
646 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
647 "misc_testsuite/winch/issue-10331.wast",
648 "misc_testsuite/winch/replace_lane.wast",
649 "spec_testsuite/simd_align.wast",
650 "spec_testsuite/simd_boolean.wast",
651 "spec_testsuite/simd_conversions.wast",
652 "spec_testsuite/simd_f32x4.wast",
653 "spec_testsuite/simd_f32x4_arith.wast",
654 "spec_testsuite/simd_f32x4_cmp.wast",
655 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
656 "spec_testsuite/simd_f32x4_rounding.wast",
657 "spec_testsuite/simd_f64x2.wast",
658 "spec_testsuite/simd_f64x2_arith.wast",
659 "spec_testsuite/simd_f64x2_cmp.wast",
660 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
661 "spec_testsuite/simd_f64x2_rounding.wast",
662 "spec_testsuite/simd_i16x8_cmp.wast",
663 "spec_testsuite/simd_i32x4_cmp.wast",
664 "spec_testsuite/simd_i64x2_arith2.wast",
665 "spec_testsuite/simd_i64x2_cmp.wast",
666 "spec_testsuite/simd_i8x16_arith2.wast",
667 "spec_testsuite/simd_i8x16_cmp.wast",
668 "spec_testsuite/simd_int_to_int_extend.wast",
669 "spec_testsuite/simd_load.wast",
670 "spec_testsuite/simd_load_extend.wast",
671 "spec_testsuite/simd_load_splat.wast",
672 "spec_testsuite/simd_load_zero.wast",
673 "spec_testsuite/simd_splat.wast",
674 "spec_testsuite/simd_store16_lane.wast",
675 "spec_testsuite/simd_store32_lane.wast",
676 "spec_testsuite/simd_store64_lane.wast",
677 "spec_testsuite/simd_store8_lane.wast",
678 "spec_testsuite/simd_load16_lane.wast",
679 "spec_testsuite/simd_load32_lane.wast",
680 "spec_testsuite/simd_load64_lane.wast",
681 "spec_testsuite/simd_load8_lane.wast",
682 "spec_testsuite/simd_bitwise.wast",
683 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
684 "misc_testsuite/simd/unaligned-load.wast",
685 "multi-memory/simd_memory-multi.wast",
686 "misc_testsuite/simd/issue4807.wast",
687 "spec_testsuite/simd_const.wast",
688 "spec_testsuite/simd_i8x16_sat_arith.wast",
689 "spec_testsuite/simd_i64x2_arith.wast",
690 "spec_testsuite/simd_i16x8_arith.wast",
691 "spec_testsuite/simd_i16x8_arith2.wast",
692 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
693 "spec_testsuite/simd_i16x8_sat_arith.wast",
694 "spec_testsuite/simd_i32x4_arith.wast",
695 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
696 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
697 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
698 "spec_testsuite/simd_i8x16_arith.wast",
699 "spec_testsuite/simd_bit_shift.wast",
700 "spec_testsuite/simd_lane.wast",
701 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
702 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
703 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
704 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
705 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
706 "spec_testsuite/simd_i32x4_arith2.wast",
707 ];
708
709 if unsupported.iter().any(|part| self.path.ends_with(part)) {
710 return true;
711 }
712 }
713 }
714 }
715
716 if self.config.custom_descriptors() {
718 let happens_to_work =
719 ["spec_testsuite/proposals/custom-descriptors/binary-leb128.wast"];
720
721 if happens_to_work.iter().any(|part| self.path.ends_with(part)) {
722 return false;
723 }
724 return true;
725 }
726
727 false
728 }
729}
730
731fn spec_proposal_from_path(path: &Path) -> Option<&str> {
732 let mut iter = path.iter();
733 loop {
734 match iter.next()?.to_str()? {
735 "proposals" => break,
736 _ => {}
737 }
738 }
739 Some(iter.next()?.to_str()?)
740}