Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail builds #5

Merged
merged 8 commits into from May 17, 2023
13 changes: 12 additions & 1 deletion src/lib.rs
Expand Up @@ -52,7 +52,18 @@ pub fn todo_by(item: TokenStream) -> TokenStream {
} else {
format!("TODO by {date_str} has passed")
};
return quote! { compile_error!(#error_message); }.into();

// This works to trigger an error message, but has the negative side effect of
// causing tests to fail that reach an expiration.
return quote! {
#[cfg(any(test, trybuild))]
compile_error!(#error_message);

#[cfg(not(any(test, trybuild)))]
#[must_use = #error_message]
const t: () = ();
}
.into();
}

TokenStream::new()
Expand Down