1+ // #![deny(rustc::diagnostic_outside_of_impl)]
2+ // #![deny(rustc::untranslatable_diagnostic)]
3+ //
14use crate :: context:: { CheckLintNameResult , LintStore } ;
25use crate :: late:: unerased_lint_store;
36use rustc_ast as ast;
@@ -23,6 +26,8 @@ use rustc_span::symbol::{sym, Symbol};
2326use rustc_span:: { Span , DUMMY_SP } ;
2427use tracing:: debug;
2528
29+ use crate :: errors:: UnknownTool ;
30+
2631fn lint_levels ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> LintLevelMap {
2732 let store = unerased_lint_store ( tcx) ;
2833 let levels =
@@ -485,22 +490,12 @@ impl<'s> LintLevelsBuilder<'s> {
485490 }
486491
487492 & CheckLintNameResult :: NoTool => {
488- let mut err = struct_span_err ! (
489- sess,
490- tool_ident. map_or( DUMMY_SP , |ident| ident. span) ,
491- E0710 ,
492- "unknown tool name `{}` found in scoped lint: `{}::{}`" ,
493- tool_name. unwrap( ) ,
494- tool_name. unwrap( ) ,
495- pprust:: path_to_string( & meta_item. path) ,
496- ) ;
497- if sess. is_nightly_build ( ) {
498- err. help ( & format ! (
499- "add `#![register_tool({})]` to the crate root" ,
500- tool_name. unwrap( )
501- ) ) ;
502- }
503- err. emit ( ) ;
493+ sess. emit_err ( UnknownTool {
494+ span : tool_ident. map ( |ident| ident. span ) ,
495+ tool_name : tool_name. unwrap ( ) . to_string ( ) ,
496+ lint_name : pprust:: path_to_string ( & meta_item. path ) ,
497+ is_nightly_build : sess. is_nightly_build ( ) . then_some ( ( ) ) ,
498+ } ) ;
504499 continue ;
505500 }
506501
0 commit comments