File tree Expand file tree Collapse file tree 6 files changed +21
-1
lines changed Expand file tree Collapse file tree 6 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -4421,9 +4421,11 @@ dependencies = [
44214421 " rustc_ast" ,
44224422 " rustc_ast_pretty" ,
44234423 " rustc_data_structures" ,
4424+ " rustc_errors" ,
44244425 " rustc_hir" ,
44254426 " rustc_hir_pretty" ,
44264427 " rustc_lexer" ,
4428+ " rustc_macros" ,
44274429 " rustc_middle" ,
44284430 " rustc_session" ,
44294431 " rustc_span" ,
Original file line number Diff line number Diff line change 1+ save_analysis_could_not_open = Could not open `{ $file_name } `: `{ $err } `
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ fluent_messages! {
4343 passes => "../locales/en-US/passes.ftl" ,
4444 plugin_impl => "../locales/en-US/plugin_impl.ftl" ,
4545 privacy => "../locales/en-US/privacy.ftl" ,
46+ save_analysis => "../locales/en-US/save_analysis.ftl" ,
4647 typeck => "../locales/en-US/typeck.ftl" ,
4748}
4849
Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ rustc_middle = { path = "../rustc_middle" }
99rustc_ast = { path = " ../rustc_ast" }
1010rustc_ast_pretty = { path = " ../rustc_ast_pretty" }
1111rustc_data_structures = { path = " ../rustc_data_structures" }
12+ rustc_errors = { path = " ../rustc_errors" }
1213rustc_hir = { path = " ../rustc_hir" }
1314rustc_hir_pretty = { path = " ../rustc_hir_pretty" }
1415rustc_lexer = { path = " ../rustc_lexer" }
16+ rustc_macros = { path = " ../rustc_macros" }
1517serde_json = " 1"
1618rustc_session = { path = " ../rustc_session" }
1719rustc_span = { path = " ../rustc_span" }
Original file line number Diff line number Diff line change 1+ use rustc_macros:: SessionDiagnostic ;
2+
3+ use std:: path:: Path ;
4+
5+ #[ derive( SessionDiagnostic ) ]
6+ #[ diag( save_analysis:: could_not_open) ]
7+ pub ( crate ) struct CouldNotOpen < ' a > {
8+ pub file_name : & ' a Path ,
9+ pub err : std:: io:: Error ,
10+ }
Original file line number Diff line number Diff line change 33#![ feature( let_else) ]
44#![ recursion_limit = "256" ]
55#![ allow( rustc:: potential_query_instability) ]
6+ #![ feature( never_type) ]
7+ #![ deny( rustc:: untranslatable_diagnostic) ]
8+ #![ deny( rustc:: diagnostic_outside_of_impl) ]
69
710mod dump_visitor;
811mod dumper;
912#[ macro_use]
1013mod span_utils;
14+ mod errors;
1115mod sig;
1216
1317use rustc_ast as ast;
@@ -928,7 +932,7 @@ impl<'a> DumpHandler<'a> {
928932 info ! ( "Writing output to {}" , file_name. display( ) ) ;
929933
930934 let output_file = BufWriter :: new ( File :: create ( & file_name) . unwrap_or_else ( |e| {
931- sess. fatal ( & format ! ( "Could not open {}: {}" , file_name. display ( ) , e ) )
935+ sess. emit_fatal ( errors :: CouldNotOpen { file_name : file_name . as_path ( ) , err : e } )
932936 } ) ) ;
933937
934938 ( output_file, file_name)
You can’t perform that action at this time.
0 commit comments