77use rustc_ast:: visit:: { self as ast_visit, Visitor , walk_list} ;
88use rustc_ast:: { self as ast, AttrVec , HasAttrs } ;
99use rustc_data_structures:: stack:: ensure_sufficient_stack;
10- use rustc_data_structures:: sync:: DynSend ;
11- use rustc_errors:: {
12- BufferedEarlyLint , DecorateDiagCompat , Diag , DiagCtxtHandle , Diagnostic , Level , LintBuffer ,
13- } ;
10+ use rustc_errors:: { BufferedEarlyLint , DecorateDiagCompat , LintBuffer } ;
1411use rustc_feature:: Features ;
1512use rustc_middle:: ty:: { RegisteredTools , TyCtxt } ;
1613use rustc_session:: Session ;
@@ -38,16 +35,6 @@ pub struct EarlyContextAndPass<'ecx, 'tcx, T: EarlyLintPass> {
3835
3936impl < ' ecx , ' tcx , T : EarlyLintPass > EarlyContextAndPass < ' ecx , ' tcx , T > {
4037 fn check_id ( & mut self , id : ast:: NodeId ) {
41- struct BoxDiag (
42- Box < dyn for < ' a > FnOnce ( DiagCtxtHandle < ' a > , Level ) -> Diag < ' a , ( ) > + DynSend + ' static > ,
43- ) ;
44-
45- impl < ' a > Diagnostic < ' a , ( ) > for BoxDiag {
46- fn into_diag ( self , dcx : DiagCtxtHandle < ' a > , level : Level ) -> Diag < ' a , ( ) > {
47- ( self . 0 ) ( dcx, level)
48- }
49- }
50-
5138 for early_lint in self . context . buffered . take ( id) {
5239 let BufferedEarlyLint { span, node_id : _, lint_id, diagnostic } = early_lint;
5340 match diagnostic {
@@ -63,7 +50,7 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
6350 ) ;
6451 }
6552 DecorateDiagCompat :: Dynamic ( d) => {
66- self . context . opt_span_diag_lint ( lint_id. lint , span, BoxDiag ( d ) ) ;
53+ self . context . opt_span_diag_lint ( lint_id. lint , span, d ) ;
6754 }
6855 }
6956 }
0 commit comments