Crates.io | compilation-guard |
lib.rs | compilation-guard |
version | 0.1.1 |
source | src |
created_at | 2023-07-03 00:39:21.895667 |
updated_at | 2023-07-03 00:45:22.958388 |
description | Force compilation to fail when certain condition is met |
homepage | |
repository | |
max_upload_size | |
id | 906524 |
size | 15,612 |
Say, you have a feature that is behind several different feature guard, and you want to make sure that your user knows whne it has to compile.
This crate can help you with that.
e.g.
#![allow(unused_imports, dead_code)]
use compilation_guard::compilation_guard;
#[cfg_attr(all(unstable, feature = "enable-macro"), derive(VeryExpensiveMacro))]
#[cfg_attr(all(not(unstable), feature = "enable-macro"), compilation_guard("lol"))]
struct A;
fn main() {
}
If you don't enable the unstable flag, you get this.
error: custom attribute panicked
--> src/main.rs:5:58
|
5 | #[cfg_attr(all(not(unstable), feature = "enable-macro"), compilation_guard("lol"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: Compilation guard was triggered!
lol