LintContext::lookup
LintContext::opt_span_lint
For more information about how rustc works, see the rustc dev guide.