Skip to content

Commit b03a655

Browse files
committed
Prepare ignore/only conditions once in advance, without a macro
1 parent 49ccc43 commit b03a655

File tree

2 files changed

+208
-271
lines changed

2 files changed

+208
-271
lines changed

src/tools/compiletest/src/directives.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ mod needs;
3434
mod tests;
3535

3636
pub struct DirectivesCache {
37+
/// "Conditions" used by `ignore-*` and `only-*` directives, prepared in
38+
/// advance so that they don't have to be evaluated repeatedly.
39+
cfg_conditions: cfg::PreparedConditions,
3740
needs: CachedNeedsConditions,
3841
}
3942

4043
impl DirectivesCache {
4144
pub fn load(config: &Config) -> Self {
42-
Self { needs: CachedNeedsConditions::load(config) }
45+
Self {
46+
cfg_conditions: cfg::prepare_conditions(config),
47+
needs: CachedNeedsConditions::load(config),
48+
}
4349
}
4450
}
4551

@@ -1058,8 +1064,8 @@ pub(crate) fn make_test_description(
10581064
};
10591065
}
10601066

1061-
decision!(cfg::handle_ignore(config, ln));
1062-
decision!(cfg::handle_only(config, ln));
1067+
decision!(cfg::handle_ignore(&cache.cfg_conditions, ln));
1068+
decision!(cfg::handle_only(&cache.cfg_conditions, ln));
10631069
decision!(needs::handle_needs(&cache.needs, config, ln));
10641070
decision!(ignore_llvm(config, ln));
10651071
decision!(ignore_backends(config, ln));

0 commit comments

Comments
 (0)