diff options
Diffstat (limited to 'src/doc/rustc-dev-guide/examples/rustc-driver-example.rs')
| -rw-r--r-- | src/doc/rustc-dev-guide/examples/rustc-driver-example.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs index f01072b7bea..51af6f5aab2 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs @@ -3,6 +3,8 @@ // NOTE: For the example to compile, you will need to first run the following: // rustup component add rustc-dev +// version: 1.53.0-nightly (9b0edb7fd 2021-03-27) + extern crate rustc_error_codes; extern crate rustc_errors; extern crate rustc_hash; @@ -46,8 +48,9 @@ fn main() { diagnostic_output: rustc_session::DiagnosticOutput::Default, // Set to capture stderr output during compiler execution stderr: None, // Option<Arc<Mutex<Vec<u8>>>> - crate_name: None, // Option<String> lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level> + // This is a callback from the driver that is called when [`ParseSess`] is created. + parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>> // This is a callback from the driver that is called when we're registering lints; // it is called during plugin registration when we have the LintStore in a non-shared state. // @@ -61,6 +64,7 @@ fn main() { override_queries: None, // Option<fn(&Session, &mut ty::query::Providers<'_>, &mut ty::query::Providers<'_>)> // Registry of diagnostics codes. registry: registry::Registry::new(&rustc_error_codes::DIAGNOSTICS), + make_codegen_backend: None, }; rustc_interface::run_compiler(config, |compiler| { compiler.enter(|queries| { @@ -73,7 +77,7 @@ fn main() { match item.kind { rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn(_, _, _) => { let name = item.ident; - let ty = tcx.type_of(tcx.hir().local_def_id(item.hir_id)); + let ty = tcx.type_of(tcx.hir().local_def_id(item.hir_id())); println!("{:?}:\t{:?}", name, ty) } _ => (), |
