File tree 6 files changed +21
-1
lines changed
6 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -4421,9 +4421,11 @@ dependencies = [
4421
4421
" rustc_ast" ,
4422
4422
" rustc_ast_pretty" ,
4423
4423
" rustc_data_structures" ,
4424
+ " rustc_errors" ,
4424
4425
" rustc_hir" ,
4425
4426
" rustc_hir_pretty" ,
4426
4427
" rustc_lexer" ,
4428
+ " rustc_macros" ,
4427
4429
" rustc_middle" ,
4428
4430
" rustc_session" ,
4429
4431
" 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! {
43
43
passes => "../locales/en-US/passes.ftl" ,
44
44
plugin_impl => "../locales/en-US/plugin_impl.ftl" ,
45
45
privacy => "../locales/en-US/privacy.ftl" ,
46
+ save_analysis => "../locales/en-US/save_analysis.ftl" ,
46
47
typeck => "../locales/en-US/typeck.ftl" ,
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ rustc_middle = { path = "../rustc_middle" }
9
9
rustc_ast = { path = " ../rustc_ast" }
10
10
rustc_ast_pretty = { path = " ../rustc_ast_pretty" }
11
11
rustc_data_structures = { path = " ../rustc_data_structures" }
12
+ rustc_errors = { path = " ../rustc_errors" }
12
13
rustc_hir = { path = " ../rustc_hir" }
13
14
rustc_hir_pretty = { path = " ../rustc_hir_pretty" }
14
15
rustc_lexer = { path = " ../rustc_lexer" }
16
+ rustc_macros = { path = " ../rustc_macros" }
15
17
serde_json = " 1"
16
18
rustc_session = { path = " ../rustc_session" }
17
19
rustc_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 3
3
#![ feature( let_else) ]
4
4
#![ recursion_limit = "256" ]
5
5
#![ allow( rustc:: potential_query_instability) ]
6
+ #![ feature( never_type) ]
7
+ #![ deny( rustc:: untranslatable_diagnostic) ]
8
+ #![ deny( rustc:: diagnostic_outside_of_impl) ]
6
9
7
10
mod dump_visitor;
8
11
mod dumper;
9
12
#[ macro_use]
10
13
mod span_utils;
14
+ mod errors;
11
15
mod sig;
12
16
13
17
use rustc_ast as ast;
@@ -928,7 +932,7 @@ impl<'a> DumpHandler<'a> {
928
932
info ! ( "Writing output to {}" , file_name. display( ) ) ;
929
933
930
934
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 } )
932
936
} ) ) ;
933
937
934
938
( output_file, file_name)
You can’t perform that action at this time.
0 commit comments