A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html below:

declare_lint in rustc_lint_defs - Rust

macro_rules! declare_lint {
    ($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr) => { ... };
    ($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
     $(@eval_always = $eval_always:literal)?
     $(@feature_gate = $gate:ident;)?
     $(@future_incompatible = FutureIncompatibleInfo {
        reason: $reason:expr,
        $($field:ident : $val:expr),* $(,)*
     }; )?
     $(@edition $lint_edition:ident => $edition_level:ident;)?
     $($v:ident),*) => { ... };
}
Expand description

Declares a static item of type &'static Lint.

See https://rustc-dev-guide.rust-lang.org/diagnostics.html for documentation and guidelines on writing lints.

The macro call should start with a doc comment explaining the lint which will be embedded in the rustc user documentation book. It should be written in markdown and have a format that looks like this:

The {{produces}} tag will be automatically replaced with the output from the example by the build system. If the lint example is too complex to run as a simple example (for example, it needs an extern crate), mark the code block with ignore and manually replace the {{produces}} line with the expected output in a text code block.

If this is a rustdoc-only lint, then only include a brief introduction with a link with the text [rustdoc book] so that the validator knows that this is for rustdoc only (see BROKEN_INTRA_DOC_LINKS as an example).

Commands to view and test the documentation:

If you have already built the compiler, and you want to make changes to just the doc comments, then use the --keep-stage=0 flag with the above commands to avoid rebuilding the compiler.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4