@@ -524,29 +524,24 @@ pub struct EarlyContext<'a> {
524524 pub buffered : LintBuffer ,
525525}
526526
527- pub trait LintContext {
528- fn sess ( & self ) -> & Session ;
529-
527+ impl < ' c > EarlyContext < ' c > {
530528 /// Emit a lint at the appropriate level, with an optional associated span and an existing
531529 /// diagnostic.
532530 ///
533531 /// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
534532 #[ rustc_lint_diagnostics]
535- fn span_lint_with_diagnostics (
533+ pub fn span_lint_with_diagnostics (
536534 & self ,
537535 lint : & ' static Lint ,
538- span : Option < impl Into < MultiSpan > > ,
539- decorate : impl for <' a , ' b > FnOnce ( & ' b mut Diag < ' a , ( ) > ) ,
536+ span : MultiSpan ,
540537 diagnostic : BuiltinLintDiag ,
541538 ) {
542- // We first generate a blank diagnostic.
543- self . opt_span_lint ( lint, span, diagnostics:: builtin_message ( & diagnostic) , |db| {
544- // Now, set up surrounding context.
545- diagnostics:: builtin ( self . sess ( ) , diagnostic, db) ;
546- // Rewrap `db`, and pass control to the user.
547- decorate ( db)
548- } ) ;
539+ diagnostics:: emit_buffered_lint ( self , lint, span, diagnostic)
549540 }
541+ }
542+
543+ pub trait LintContext {
544+ fn sess ( & self ) -> & Session ;
550545
551546 // FIXME: These methods should not take an Into<MultiSpan> -- instead, callers should need to
552547 // set the span in their `decorate` function (preferably using set_span).
0 commit comments