diff options
| author | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-03-10 14:09:17 +0100 |
|---|---|---|
| committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-04-03 09:30:31 +0200 |
| commit | e085192729c3f276e52eeb7a7e7cfaa39cc5c09c (patch) | |
| tree | d0b855461c8efdfaab8603d192464313d236ab90 | |
| parent | bc991de2336df5e6c29d50fb448778c725f9d9cf (diff) | |
| download | rust-e085192729c3f276e52eeb7a7e7cfaa39cc5c09c.tar.gz rust-e085192729c3f276e52eeb7a7e7cfaa39cc5c09c.zip | |
allow some out of tree archs
| -rw-r--r-- | src/tools/compiletest/src/header/cfg.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index a14943c9466..dbc78dd521b 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -1,6 +1,8 @@ use crate::common::{CompareMode, Config, Debugger}; use std::collections::HashSet; +const EXTRA_ARCHS: &[&str] = &["asmjs", "spirv"]; + /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` /// or `normalize-stderr-32bit`. pub(super) fn parse_cfg_name_directive<'a>( @@ -99,7 +101,7 @@ pub(super) fn parse_cfg_name_directive<'a>( } condition! { name: &target_cfg.arch, - allowed_names: &target_cfgs.all_archs, + allowed_names: ContainsEither { a: &target_cfgs.all_archs, b: &EXTRA_ARCHS }, message: "when the architecture is {name}" } condition! { @@ -257,3 +259,14 @@ impl<T: CustomContains> CustomContains for ContainsPrefixed<T> { } } } + +struct ContainsEither<'a, A: CustomContains, B: CustomContains> { + a: &'a A, + b: &'a B, +} + +impl<A: CustomContains, B: CustomContains> CustomContains for ContainsEither<'_, A, B> { + fn custom_contains(&self, item: &str) -> bool { + self.a.custom_contains(item) || self.b.custom_contains(item) + } +} |
