Create new librustc_error_codes lib and move error codes declaration inside it
This commit is contained in:
parent
a2491ee4e6
commit
3816fce76c
9
src/librustc_error_codes/Cargo.toml
Normal file
9
src/librustc_error_codes/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "rustc_error_codes"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "rustc_error_codes"
|
||||
path = "lib.rs"
|
13613
src/librustc_error_codes/error_codes.rs
Normal file
13613
src/librustc_error_codes/error_codes.rs
Normal file
File diff suppressed because it is too large
Load Diff
26
src/librustc_error_codes/lib.rs
Normal file
26
src/librustc_error_codes/lib.rs
Normal file
@ -0,0 +1,26 @@
|
||||
//! This library is used to gather all error codes into one place. The goal
|
||||
//! being to make their maintenance easier.
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! register_diagnostics {
|
||||
($($ecode:ident: $message:expr,)*) => (
|
||||
$crate::register_diagnostics!{$($ecode:$message,)* ;}
|
||||
);
|
||||
|
||||
($($ecode:ident: $message:expr,)* ; $($code:ident,)*) => (
|
||||
pub static DIAGNOSTICS: &[(&str, &str)] = &[
|
||||
$( (stringify!($ecode), $message), )*
|
||||
];
|
||||
|
||||
$(
|
||||
pub const $ecode: &str = $message;
|
||||
)*
|
||||
$(
|
||||
pub const $code: () = ();
|
||||
)*
|
||||
)
|
||||
}
|
||||
|
||||
mod error_codes;
|
||||
|
||||
pub use error_codes::*;
|
Loading…
x
Reference in New Issue
Block a user