Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e085192

Browse files
committed
allow some out of tree archs
1 parent bc991de commit e085192

File tree

1 file changed

+14
-1
lines changed
  • src/tools/compiletest/src/header

1 file changed

+14
-1
lines changed

src/tools/compiletest/src/header/cfg.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use crate::common::{CompareMode, Config, Debugger};
22
use std::collections::HashSet;
33

4+
const EXTRA_ARCHS: &[&str] = &["asmjs", "spirv"];
5+
46
/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
57
/// or `normalize-stderr-32bit`.
68
pub(super) fn parse_cfg_name_directive<'a>(
@@ -99,7 +101,7 @@ pub(super) fn parse_cfg_name_directive<'a>(
99101
}
100102
condition! {
101103
name: &target_cfg.arch,
102-
allowed_names: &target_cfgs.all_archs,
104+
allowed_names: ContainsEither { a: &target_cfgs.all_archs, b: &EXTRA_ARCHS },
103105
message: "when the architecture is {name}"
104106
}
105107
condition! {
@@ -257,3 +259,14 @@ impl<T: CustomContains> CustomContains for ContainsPrefixed<T> {
257259
}
258260
}
259261
}
262+
263+
struct ContainsEither<'a, A: CustomContains, B: CustomContains> {
264+
a: &'a A,
265+
b: &'a B,
266+
}
267+
268+
impl<A: CustomContains, B: CustomContains> CustomContains for ContainsEither<'_, A, B> {
269+
fn custom_contains(&self, item: &str) -> bool {
270+
self.a.custom_contains(item) || self.b.custom_contains(item)
271+
}
272+
}

0 commit comments

Comments
 (0)