mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
5d9dfbd08f
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
44 lines
1.3 KiB
TOML
44 lines
1.3 KiB
TOML
[package]
|
|
name = "rustc_errors"
|
|
version = "0.0.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
# tidy-alphabetical-start
|
|
annotate-snippets = "0.10"
|
|
derive_setters = "0.1.6"
|
|
rustc_ast = { path = "../rustc_ast" }
|
|
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
|
rustc_error_codes = { path = "../rustc_error_codes" }
|
|
rustc_error_messages = { path = "../rustc_error_messages" }
|
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
|
rustc_hir = { path = "../rustc_hir" }
|
|
rustc_index = { path = "../rustc_index" }
|
|
rustc_lint_defs = { path = "../rustc_lint_defs" }
|
|
rustc_macros = { path = "../rustc_macros" }
|
|
rustc_serialize = { path = "../rustc_serialize" }
|
|
rustc_span = { path = "../rustc_span" }
|
|
rustc_target = { path = "../rustc_target" }
|
|
rustc_type_ir = { path = "../rustc_type_ir" }
|
|
serde = { version = "1.0.125", features = [ "derive" ] }
|
|
serde_json = "1.0.59"
|
|
termcolor = "1.2.0"
|
|
termize = "0.1.1"
|
|
tracing = "0.1"
|
|
unicode-width = "0.1.4"
|
|
# tidy-alphabetical-end
|
|
|
|
[target.'cfg(windows)'.dependencies.windows]
|
|
version = "0.48.0"
|
|
features = [
|
|
"Win32_Foundation",
|
|
"Win32_Security",
|
|
"Win32_System_Threading",
|
|
]
|
|
|
|
[features]
|
|
# tidy-alphabetical-start
|
|
rustc_use_parallel_compiler = ['rustc_error_messages/rustc_use_parallel_compiler']
|
|
# tidy-alphabetical-end
|