This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-17
lines changed
rustc_macros/src/diagnostics Expand file tree Collapse file tree 2 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -764,19 +764,7 @@ pub struct LintBuffer {
764764
765765impl LintBuffer {
766766 pub fn add_early_lint ( & mut self , early_lint : BufferedEarlyLint ) {
767- let arr = self . map . entry ( early_lint. node_id ) . or_default ( ) ;
768- arr. push ( early_lint) ;
769- }
770-
771- pub fn add_lint (
772- & mut self ,
773- lint : & ' static Lint ,
774- node_id : NodeId ,
775- span : MultiSpan ,
776- diagnostic : BuiltinLintDiag ,
777- ) {
778- let lint_id = LintId :: of ( lint) ;
779- self . add_early_lint ( BufferedEarlyLint { lint_id, node_id, span, diagnostic } ) ;
767+ self . map . entry ( early_lint. node_id ) . or_default ( ) . push ( early_lint) ;
780768 }
781769
782770 pub fn take ( & mut self , id : NodeId ) -> Vec < BufferedEarlyLint > {
@@ -787,11 +775,16 @@ impl LintBuffer {
787775 pub fn buffer_lint (
788776 & mut self ,
789777 lint : & ' static Lint ,
790- id : NodeId ,
791- sp : impl Into < MultiSpan > ,
778+ node_id : NodeId ,
779+ span : impl Into < MultiSpan > ,
792780 diagnostic : BuiltinLintDiag ,
793781 ) {
794- self . add_lint ( lint, id, sp. into ( ) , diagnostic)
782+ self . add_early_lint ( BufferedEarlyLint {
783+ lint_id : LintId :: of ( lint) ,
784+ node_id,
785+ span : span. into ( ) ,
786+ diagnostic,
787+ } ) ;
795788 }
796789}
797790
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ pub fn diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
9191/// Then, later, to emit the error:
9292///
9393/// ```ignore (rust)
94- /// cx.span_lint (INVALID_ATOMIC_ORDERING, fail_order_arg_span, AtomicOrderingInvalidLint {
94+ /// cx.emit_span_lint (INVALID_ATOMIC_ORDERING, fail_order_arg_span, AtomicOrderingInvalidLint {
9595/// method,
9696/// success_ordering,
9797/// fail_ordering,
You can’t perform that action at this time.
0 commit comments