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.
78 lines
2.9 KiB
TOML
78 lines
2.9 KiB
TOML
[package]
|
|
name = "rustc_driver_impl"
|
|
version = "0.0.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
# tidy-alphabetical-start
|
|
rustc_ast = { path = "../rustc_ast" }
|
|
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
|
|
rustc_ast_passes = { path = "../rustc_ast_passes" }
|
|
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
|
rustc_attr = { path = "../rustc_attr" }
|
|
rustc_borrowck = { path = "../rustc_borrowck" }
|
|
rustc_builtin_macros = { path = "../rustc_builtin_macros" }
|
|
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
|
|
rustc_const_eval = { path = "../rustc_const_eval" }
|
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
|
rustc_errors = { path = "../rustc_errors" }
|
|
rustc_expand = { path = "../rustc_expand" }
|
|
rustc_feature = { path = "../rustc_feature" }
|
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
|
rustc_hir = { path = "../rustc_hir" }
|
|
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
|
|
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
|
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
|
|
rustc_incremental = { path = "../rustc_incremental" }
|
|
rustc_infer = { path = "../rustc_infer" }
|
|
rustc_interface = { path = "../rustc_interface" }
|
|
rustc_lint = { path = "../rustc_lint" }
|
|
rustc_log = { path = "../rustc_log" }
|
|
rustc_macros = { path = "../rustc_macros" }
|
|
rustc_metadata = { path = "../rustc_metadata" }
|
|
rustc_middle = { path = "../rustc_middle" }
|
|
rustc_mir_build = { path = "../rustc_mir_build" }
|
|
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
|
|
rustc_mir_transform = { path = "../rustc_mir_transform" }
|
|
rustc_monomorphize = { path = "../rustc_monomorphize" }
|
|
rustc_parse = { path = "../rustc_parse" }
|
|
rustc_passes = { path = "../rustc_passes" }
|
|
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
|
|
rustc_privacy = { path = "../rustc_privacy" }
|
|
rustc_query_system = { path = "../rustc_query_system" }
|
|
rustc_resolve = { path = "../rustc_resolve" }
|
|
rustc_session = { path = "../rustc_session" }
|
|
rustc_smir ={ path = "../rustc_smir" }
|
|
rustc_span = { path = "../rustc_span" }
|
|
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
|
|
rustc_target = { path = "../rustc_target" }
|
|
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
|
rustc_ty_utils = { path = "../rustc_ty_utils" }
|
|
serde_json = "1.0.59"
|
|
shlex = "1.0"
|
|
time = { version = "0.3", default-features = false, features = ["alloc", "formatting"] }
|
|
tracing = { version = "0.1.35" }
|
|
# tidy-alphabetical-end
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
# tidy-alphabetical-start
|
|
libc = "0.2"
|
|
# tidy-alphabetical-end
|
|
|
|
[target.'cfg(windows)'.dependencies.windows]
|
|
version = "0.48.0"
|
|
features = [
|
|
"Win32_System_Diagnostics_Debug",
|
|
]
|
|
|
|
[features]
|
|
# tidy-alphabetical-start
|
|
llvm = ['rustc_interface/llvm']
|
|
max_level_info = ['rustc_log/max_level_info']
|
|
rustc_use_parallel_compiler = [
|
|
'rustc_data_structures/rustc_use_parallel_compiler',
|
|
'rustc_interface/rustc_use_parallel_compiler',
|
|
'rustc_middle/rustc_use_parallel_compiler'
|
|
]
|
|
# tidy-alphabetical-end
|