mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
save_analysis: Migrate diagnostics
This commit is contained in:
parent
a1bea1551b
commit
9b95eef6ea
@ -4421,9 +4421,11 @@ dependencies = [
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
"rustc_hir",
|
||||
"rustc_hir_pretty",
|
||||
"rustc_lexer",
|
||||
"rustc_macros",
|
||||
"rustc_middle",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
|
@ -0,0 +1 @@
|
||||
save_analysis_could_not_open = Could not open `{$file_name}`: `{$err}`
|
@ -43,6 +43,7 @@ fluent_messages! {
|
||||
passes => "../locales/en-US/passes.ftl",
|
||||
plugin_impl => "../locales/en-US/plugin_impl.ftl",
|
||||
privacy => "../locales/en-US/privacy.ftl",
|
||||
save_analysis => "../locales/en-US/save_analysis.ftl",
|
||||
typeck => "../locales/en-US/typeck.ftl",
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,11 @@ rustc_middle = { path = "../rustc_middle" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_errors = { path = "../rustc_errors" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
||||
rustc_lexer = { path = "../rustc_lexer" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
serde_json = "1"
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
|
10
compiler/rustc_save_analysis/src/errors.rs
Normal file
10
compiler/rustc_save_analysis/src/errors.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use rustc_macros::SessionDiagnostic;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[diag(save_analysis::could_not_open)]
|
||||
pub(crate) struct CouldNotOpen<'a> {
|
||||
pub file_name: &'a Path,
|
||||
pub err: std::io::Error,
|
||||
}
|
@ -3,11 +3,15 @@
|
||||
#![feature(let_else)]
|
||||
#![recursion_limit = "256"]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![feature(never_type)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
||||
mod dump_visitor;
|
||||
mod dumper;
|
||||
#[macro_use]
|
||||
mod span_utils;
|
||||
mod errors;
|
||||
mod sig;
|
||||
|
||||
use rustc_ast as ast;
|
||||
@ -928,7 +932,7 @@ impl<'a> DumpHandler<'a> {
|
||||
info!("Writing output to {}", file_name.display());
|
||||
|
||||
let output_file = BufWriter::new(File::create(&file_name).unwrap_or_else(|e| {
|
||||
sess.fatal(&format!("Could not open {}: {}", file_name.display(), e))
|
||||
sess.emit_fatal(errors::CouldNotOpen { file_name: file_name.as_path(), err: e })
|
||||
}));
|
||||
|
||||
(output_file, file_name)
|
||||
|
Loading…
Reference in New Issue
Block a user