mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Update examples for diagnostics changes
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
This commit is contained in:
@@ -4,14 +4,12 @@
|
||||
|
||||
extern crate rustc_driver;
|
||||
extern crate rustc_error_codes;
|
||||
extern crate rustc_errors;
|
||||
extern crate rustc_hash;
|
||||
extern crate rustc_hir;
|
||||
extern crate rustc_interface;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
|
||||
use rustc_errors::registry;
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_session::config;
|
||||
|
||||
@@ -30,12 +28,11 @@ fn main() {
|
||||
println!("{HELLO}");
|
||||
}
|
||||
"#
|
||||
.into(),
|
||||
.into(),
|
||||
},
|
||||
output_dir: None, // Option<PathBuf>
|
||||
output_file: None, // Option<PathBuf>
|
||||
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
|
||||
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_owned(),
|
||||
output_dir: None, // Option<PathBuf>
|
||||
output_file: None, // Option<PathBuf>
|
||||
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
|
||||
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
|
||||
// This is a callback from the driver that is called when [`ParseSess`] is created.
|
||||
psess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>
|
||||
@@ -50,8 +47,6 @@ fn main() {
|
||||
//
|
||||
// The second parameter is local providers and the third parameter is external providers.
|
||||
override_queries: None, // Option<fn(&Session, &mut ty::query::Providers<'_>, &mut ty::query::Providers<'_>)>
|
||||
// Registry of diagnostics codes.
|
||||
registry: registry::Registry::new(rustc_errors::codes::DIAGNOSTICS),
|
||||
make_codegen_backend: None,
|
||||
expanded_args: Vec::new(),
|
||||
ice_file: None,
|
||||
@@ -77,4 +72,4 @@ fn main() {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use rustc_errors::emitter::Emitter;
|
||||
use rustc_errors::registry::{self, Registry};
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::translation::Translate;
|
||||
use rustc_errors::{DiagInner, FluentBundle};
|
||||
use rustc_session::config;
|
||||
@@ -59,14 +59,13 @@ fn main() {
|
||||
let x: &str = 1;
|
||||
}
|
||||
"
|
||||
.into(),
|
||||
.into(),
|
||||
},
|
||||
crate_cfg: Vec::new(),
|
||||
crate_check_cfg: Vec::new(),
|
||||
output_dir: None,
|
||||
output_file: None,
|
||||
file_loader: None,
|
||||
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_owned(),
|
||||
lint_caps: rustc_hash::FxHashMap::default(),
|
||||
psess_created: Some(Box::new(|parse_sess| {
|
||||
parse_sess.dcx().set_emitter(Box::new(DebugEmitter {
|
||||
@@ -76,7 +75,6 @@ fn main() {
|
||||
})),
|
||||
register_lints: None,
|
||||
override_queries: None,
|
||||
registry: registry::Registry::new(rustc_errors::codes::DIAGNOSTICS),
|
||||
make_codegen_backend: None,
|
||||
expanded_args: Vec::new(),
|
||||
ice_file: None,
|
||||
@@ -99,4 +97,4 @@ fn main() {
|
||||
buffer.lock().unwrap().iter().for_each(|diagnostic| {
|
||||
println!("{diagnostic:#?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user