errors: generate typed identifiers in each crate
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
f9216b7564
commit
d1fcf61117
151 changed files with 1721 additions and 1440 deletions
|
@ -222,6 +222,7 @@ pub struct Config {
|
|||
pub output_dir: Option<PathBuf>,
|
||||
pub output_file: Option<PathBuf>,
|
||||
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
|
||||
pub locale_resources: &'static [&'static str],
|
||||
|
||||
pub lint_caps: FxHashMap<lint::LintId, lint::Level>,
|
||||
|
||||
|
@ -267,6 +268,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
|||
config.opts,
|
||||
config.crate_cfg,
|
||||
config.crate_check_cfg,
|
||||
config.locale_resources,
|
||||
config.file_loader,
|
||||
CompilerIO {
|
||||
input: config.input,
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
|
||||
use rustc_macros::fluent_messages;
|
||||
|
||||
mod callbacks;
|
||||
mod errors;
|
||||
pub mod interface;
|
||||
|
@ -27,3 +30,5 @@ pub use queries::Queries;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
fluent_messages! { "../locales/en-US.ftl" }
|
||||
|
|
|
@ -50,7 +50,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, CfgSpecs) {
|
|||
output_file: None,
|
||||
temps_dir,
|
||||
};
|
||||
let sess = build_session(sessopts, io, None, registry, Default::default(), None, None);
|
||||
let sess = build_session(sessopts, io, None, registry, &[], Default::default(), None, None);
|
||||
(sess, cfg)
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ pub fn create_session(
|
|||
sopts: config::Options,
|
||||
cfg: FxHashSet<(String, Option<String>)>,
|
||||
check_cfg: CheckCfg,
|
||||
locale_resources: &'static [&'static str],
|
||||
file_loader: Option<Box<dyn FileLoader + Send + Sync + 'static>>,
|
||||
io: CompilerIO,
|
||||
lint_caps: FxHashMap<lint::LintId, lint::Level>,
|
||||
|
@ -94,6 +95,7 @@ pub fn create_session(
|
|||
io,
|
||||
bundle,
|
||||
descriptions,
|
||||
locale_resources,
|
||||
lint_caps,
|
||||
file_loader,
|
||||
target_override,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue