Skip to content

Commit e4403ae

Browse files
committed
Move existing diagnostic struct to a new errors module
1 parent ee8c31e commit e4403ae

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use rustc_macros::SessionDiagnostic;
2+
use rustc_span::{Span, Symbol};
3+
4+
#[derive(SessionDiagnostic)]
5+
#[diag(interface::ferris_identifier)]
6+
pub struct FerrisIdentifier {
7+
#[primary_span]
8+
pub spans: Vec<Span>,
9+
#[suggestion(code = "ferris", applicability = "maybe-incorrect")]
10+
pub first_span: Span,
11+
}
12+
13+
#[derive(SessionDiagnostic)]
14+
#[diag(interface::emoji_identifier)]
15+
pub struct EmojiIdentifier {
16+
#[primary_span]
17+
pub spans: Vec<Span>,
18+
pub ident: Symbol,
19+
}

compiler/rustc_interface/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![allow(rustc::potential_query_instability)]
88

99
mod callbacks;
10+
mod errors;
1011
pub mod interface;
1112
mod passes;
1213
mod proc_macro_decls;

compiler/rustc_interface/src/passes.rs

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::errors::{EmojiIdentifier, FerrisIdentifier};
12
use crate::interface::{Compiler, Result};
23
use crate::proc_macro_decls;
34
use crate::util;
@@ -13,7 +14,6 @@ use rustc_expand::base::{ExtCtxt, LintStoreExpand, ResolverExpand};
1314
use rustc_hir::def_id::StableCrateId;
1415
use rustc_hir::definitions::Definitions;
1516
use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore};
16-
use rustc_macros::SessionDiagnostic;
1717
use rustc_metadata::creader::CStore;
1818
use rustc_middle::arena::Arena;
1919
use rustc_middle::dep_graph::DepGraph;
@@ -31,7 +31,7 @@ use rustc_session::output::filename_for_input;
3131
use rustc_session::search_paths::PathKind;
3232
use rustc_session::{Limit, Session};
3333
use rustc_span::symbol::{sym, Symbol};
34-
use rustc_span::{FileName, Span};
34+
use rustc_span::FileName;
3535
use rustc_trait_selection::traits;
3636
use rustc_typeck as typeck;
3737
use tracing::{info, warn};
@@ -264,23 +264,6 @@ impl LintStoreExpand for LintStoreExpandImpl<'_> {
264264
}
265265
}
266266

267-
#[derive(SessionDiagnostic)]
268-
#[diag(interface::ferris_identifier)]
269-
struct FerrisIdentifier {
270-
#[primary_span]
271-
spans: Vec<Span>,
272-
#[suggestion(code = "ferris", applicability = "maybe-incorrect")]
273-
first_span: Span,
274-
}
275-
276-
#[derive(SessionDiagnostic)]
277-
#[diag(interface::emoji_identifier)]
278-
struct EmojiIdentifier {
279-
#[primary_span]
280-
spans: Vec<Span>,
281-
ident: Symbol,
282-
}
283-
284267
/// Runs the "early phases" of the compiler: initial `cfg` processing, loading compiler plugins,
285268
/// syntax expansion, secondary `cfg` expansion, synthesis of a test
286269
/// harness if one is to be provided, injection of a dependency on the

0 commit comments

Comments
 (0)