Macro compile_warning

Source
macro_rules! compile_warning {
    ($text:expr) => { ... };
    ($ident:ident: $text:expr) => { ... };
}
Expand description

Emits a compile-time warning.

This works like the standard std::compile_error macro, but emits a warning instead of an error.

The error is actually a dead_code, since rust doesn’t support emitting real warnings now.

Note

The macro expands to something like:

#[warn(dead_code)]
const WARNING: &str = "<some warning>";

So the ident WARNING is reserved. If you want to override it, use the following syntax:

use rs_std_ext::compile_warning;

compile_warning!(MW: "warning");
// this expand to
// const MW: &str = "warning";