pub fn span_lint<T: LintContext>(
    cx: &T,
    lint: &'static Lint,
    sp: impl Into<MultiSpan>,
    msg: &str
)
Expand description

Emit a basic lint message with a msg and a span.

This is the most primitive of our lint emission methods and can be a good way to get a new lint started.

Usually it’s nicer to provide more context for lint messages. Be sure the output is understandable when you use this method.

Example

error: usage of mem::forget on Drop type
  --> $DIR/mem_forget.rs:17:5
   |
17 |     std::mem::forget(seven);
   |     ^^^^^^^^^^^^^^^^^^^^^^^