macro_rules! export_lint_pass {
    ($pass_ty:ident) => { ... };
    ($pass_ty:ident, $pass_init:expr) => { ... };
}
Expand description

This macro marks the given struct as the main LintPass for the lint crate. For structs implementing Default it’s enough to only pass in the type. Otherwise, a second argument is required to initialize an instance.

Struct initialized with default()

#[derive(Default)]
struct LintPassWithDefault;
marker_api::export_lint_pass!(LintPassWithDefault);

Struct with custom initialization:

struct LintPassCustomValue {
    // ...
};
marker_api::export_lint_pass!(LintPassCustomValue, LintPassCustomValue::new(/* ... */));

This macro will create some hidden items prefixed with two underscores. These are unstable and can change in the future.

Driver information
  • Rustc’s driver will always call lint pass instance with the same thread
  • Rustc’s driver will create a new instance for every crate that is being checked