summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/config_proc_macro/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/config_proc_macro/src/lib.rs')
-rw-r--r--src/tools/rustfmt/config_proc_macro/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/rustfmt/config_proc_macro/src/lib.rs b/src/tools/rustfmt/config_proc_macro/src/lib.rs
index e772c53f4..0c54c132c 100644
--- a/src/tools/rustfmt/config_proc_macro/src/lib.rs
+++ b/src/tools/rustfmt/config_proc_macro/src/lib.rs
@@ -69,3 +69,16 @@ pub fn stable_only_test(_args: TokenStream, input: TokenStream) -> TokenStream {
TokenStream::from_str("").unwrap()
}
}
+
+/// Used to conditionally output the TokenStream for tests that should be run as part of rustfmts
+/// test suite, but should be ignored when running in the rust-lang/rust test suite.
+#[proc_macro_attribute]
+pub fn rustfmt_only_ci_test(_args: TokenStream, input: TokenStream) -> TokenStream {
+ if option_env!("RUSTFMT_CI").is_some() {
+ input
+ } else {
+ let mut token_stream = TokenStream::from_str("#[ignore]").unwrap();
+ token_stream.extend(input);
+ token_stream
+ }
+}