about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorGiacomo Stevanato <giaco.stevanato@gmail.com>2022-08-20 18:30:49 +0200
committerGiacomo Stevanato <giaco.stevanato@gmail.com>2022-08-22 13:17:36 +0200
commite4403ae9ff9ca9912fe80a5401c57c48fb979e5f (patch)
treee39d6b13706d86e71568bfa7095d263d3023c0d1 /compiler
parentee8c31e64d229cac4eba6d8f03bb70e16f34a14b (diff)
downloadrust-e4403ae9ff9ca9912fe80a5401c57c48fb979e5f.tar.gz
rust-e4403ae9ff9ca9912fe80a5401c57c48fb979e5f.zip
Move existing diagnostic struct to a new errors module
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_interface/src/errors.rs19
-rw-r--r--compiler/rustc_interface/src/lib.rs1
-rw-r--r--compiler/rustc_interface/src/passes.rs21
3 files changed, 22 insertions, 19 deletions
diff --git a/compiler/rustc_interface/src/errors.rs b/compiler/rustc_interface/src/errors.rs
new file mode 100644
index 00000000000..62456d76d71
--- /dev/null
+++ b/compiler/rustc_interface/src/errors.rs
@@ -0,0 +1,19 @@
+use rustc_macros::SessionDiagnostic;
+use rustc_span::{Span, Symbol};
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::ferris_identifier)]
+pub struct FerrisIdentifier {
+    #[primary_span]
+    pub spans: Vec<Span>,
+    #[suggestion(code = "ferris", applicability = "maybe-incorrect")]
+    pub first_span: Span,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(interface::emoji_identifier)]
+pub struct EmojiIdentifier {
+    #[primary_span]
+    pub spans: Vec<Span>,
+    pub ident: Symbol,
+}
diff --git a/compiler/rustc_interface/src/lib.rs b/compiler/rustc_interface/src/lib.rs
index d443057eb79..5ff1a952aef 100644
--- a/compiler/rustc_interface/src/lib.rs
+++ b/compiler/rustc_interface/src/lib.rs
@@ -7,6 +7,7 @@
 #![allow(rustc::potential_query_instability)]
 
 mod callbacks;
+mod errors;
 pub mod interface;
 mod passes;
 mod proc_macro_decls;
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 014cf88389e..759f9e0f0c9 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -1,3 +1,4 @@
+use crate::errors::{EmojiIdentifier, FerrisIdentifier};
 use crate::interface::{Compiler, Result};
 use crate::proc_macro_decls;
 use crate::util;
@@ -13,7 +14,6 @@ use rustc_expand::base::{ExtCtxt, LintStoreExpand, ResolverExpand};
 use rustc_hir::def_id::StableCrateId;
 use rustc_hir::definitions::Definitions;
 use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore};
-use rustc_macros::SessionDiagnostic;
 use rustc_metadata::creader::CStore;
 use rustc_middle::arena::Arena;
 use rustc_middle::dep_graph::DepGraph;
@@ -31,7 +31,7 @@ use rustc_session::output::filename_for_input;
 use rustc_session::search_paths::PathKind;
 use rustc_session::{Limit, Session};
 use rustc_span::symbol::{sym, Symbol};
-use rustc_span::{FileName, Span};
+use rustc_span::FileName;
 use rustc_trait_selection::traits;
 use rustc_typeck as typeck;
 use tracing::{info, warn};
@@ -264,23 +264,6 @@ impl LintStoreExpand for LintStoreExpandImpl<'_> {
     }
 }
 
-#[derive(SessionDiagnostic)]
-#[diag(interface::ferris_identifier)]
-struct FerrisIdentifier {
-    #[primary_span]
-    spans: Vec<Span>,
-    #[suggestion(code = "ferris", applicability = "maybe-incorrect")]
-    first_span: Span,
-}
-
-#[derive(SessionDiagnostic)]
-#[diag(interface::emoji_identifier)]
-struct EmojiIdentifier {
-    #[primary_span]
-    spans: Vec<Span>,
-    ident: Symbol,
-}
-
 /// Runs the "early phases" of the compiler: initial `cfg` processing, loading compiler plugins,
 /// syntax expansion, secondary `cfg` expansion, synthesis of a test
 /// harness if one is to be provided, injection of a dependency on the