Skip to content

Commit

Permalink
Move existing diagnostic struct to a new errors module
Browse files Browse the repository at this point in the history
  • Loading branch information
SkiFire13 committed Aug 22, 2022
1 parent ee8c31e commit e4403ae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
19 changes: 19 additions & 0 deletions compiler/rustc_interface/src/errors.rs
Original file line number Diff line number Diff line change
@@ -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,
}
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![allow(rustc::potential_query_instability)]

mod callbacks;
mod errors;
pub mod interface;
mod passes;
mod proc_macro_decls;
Expand Down
21 changes: 2 additions & 19 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::errors::{EmojiIdentifier, FerrisIdentifier};
use crate::interface::{Compiler, Result};
use crate::proc_macro_decls;
use crate::util;
Expand All @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e4403ae

Please sign in to comment.