macro_rules! compile_warning {
($expr:expr) => { ... };
}Expand description
compile_warning macro is a brother of std::compile_error,
which emits a compile-time warning with a provided message.
This implemented through an existing dead_code warning, thus the
output for the following example:
compile_warning!("Sample user-defined warning!");may look as follows:
warning: constant item is never used: `WARNING`
--> src/lib.rs:7:9
|
7 | const WARNING: &str = $expr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
11 | compile_warning!("Sample user-defined warning!");
| ------------------------------------------------- in this macro invocationOnce proc_macro_diagnostics feature is stabilized, this macro will be replaced
with a proper proc-macro-based implementation.
This macro is intended to be used in the development process, as an alternative to the
unimplemented macro which doesn’t cause code to panic.