about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
authorGiacomo Stevanato <giaco.stevanato@gmail.com>2022-08-20 18:33:02 +0200
committerGiacomo Stevanato <giaco.stevanato@gmail.com>2022-08-22 13:22:00 +0200
commitb411adec2aff3d57928e42017aa267fbed6e05f5 (patch)
tree565e72bdda71b2e87b7087a22705f9334782efe4 /compiler/rustc_interface/src/errors.rs
parente4403ae9ff9ca9912fe80a5401c57c48fb979e5f (diff)
downloadrust-b411adec2aff3d57928e42017aa267fbed6e05f5.tar.gz
rust-b411adec2aff3d57928e42017aa267fbed6e05f5.zip
Move rustc_interface diagnostics to struct SessionDiagnostic derives
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
-rw-r--r--compiler/rustc_interface/src/errors.rs68
1 files changed, 68 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs
index 62456d76d71..a72134e31f1 100644
--- a/compiler/rustc_interface/src/errors.rs
+++ b/compiler/rustc_interface/src/errors.rs
@@ -1,3 +1,4 @@
+use rustc_errors::DiagnosticArgFromDisplay;
 use rustc_macros::SessionDiagnostic;
 use rustc_span::{Span, Symbol};
 
@@ -17,3 +18,70 @@ pub struct EmojiIdentifier {
     pub spans: Vec<Span>,
     pub ident: Symbol,
 }
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::mixed_bin_crate)]
+pub struct MixedBinCrate;
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::mixed_proc_macro_crate)]
+pub struct MixedProcMacroCrate;
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::proc_macro_doc_without_arg)]
+pub struct ProcMacroDocWithoutArg;
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::error_writing_dependencies)]
+pub struct ErrorWritingDependencies<'a> {
+    pub path: DiagnosticArgFromDisplay<'a>,
+    pub error: DiagnosticArgFromDisplay<'a>,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::input_file_would_be_overwritten)]
+pub struct InputFileWouldBeOverWritten<'a> {
+    pub path: DiagnosticArgFromDisplay<'a>,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::generated_file_conflicts_with_directory)]
+pub struct GeneratedFileConflictsWithDirectory<'a> {
+    pub input_path: DiagnosticArgFromDisplay<'a>,
+    pub dir_path: DiagnosticArgFromDisplay<'a>,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::temps_dir_error)]
+pub struct TempsDirError;
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::out_dir_error)]
+pub struct OutDirError;
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::cant_emit_mir)]
+pub struct CantEmitMIR<'a> {
+    pub error: DiagnosticArgFromDisplay<'a>,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::rustc_error_fatal)]
+pub struct RustcErrorFatal {
+    #[primary_span]
+    pub span: Span,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::rustc_error_unexpected_annotation)]
+pub struct RustcErrorUnexpectedAnnotation {
+    #[primary_span]
+    pub span: Span,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::failed_writing_file)]
+pub struct FailedWritingFile<'a> {
+    pub path: DiagnosticArgFromDisplay<'a>,
+    pub error: DiagnosticArgFromDisplay<'a>,
+}