@@ -527,29 +527,24 @@ pub struct EarlyContext<'a> {
527527 pub buffered : LintBuffer ,
528528}
529529
530- pub trait LintContext {
531- fn sess ( & self ) -> & Session ;
532-
530+ impl EarlyContext < ' _ > {
533531 /// Emit a lint at the appropriate level, with an optional associated span and an existing
534532 /// diagnostic.
535533 ///
536534 /// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
537535 #[ rustc_lint_diagnostics]
538- fn span_lint_with_diagnostics (
536+ pub fn span_lint_with_diagnostics (
539537 & self ,
540538 lint : & ' static Lint ,
541- span : Option < impl Into < MultiSpan > > ,
542- decorate : impl for <' a , ' b > FnOnce ( & ' b mut Diag < ' a , ( ) > ) ,
539+ span : MultiSpan ,
543540 diagnostic : BuiltinLintDiag ,
544541 ) {
545- // We first generate a blank diagnostic.
546- self . opt_span_lint ( lint, span, diagnostics:: builtin_message ( & diagnostic) , |db| {
547- // Now, set up surrounding context.
548- diagnostics:: builtin ( self . sess ( ) , diagnostic, db) ;
549- // Rewrap `db`, and pass control to the user.
550- decorate ( db)
551- } ) ;
542+ diagnostics:: emit_buffered_lint ( self , lint, span, diagnostic)
552543 }
544+ }
545+
546+ pub trait LintContext {
547+ fn sess ( & self ) -> & Session ;
553548
554549 // FIXME: These methods should not take an Into<MultiSpan> -- instead, callers should need to
555550 // set the span in their `decorate` function (preferably using set_span).
0 commit comments