diff options
| author | Tshepang Mbambo <tshepang@gmail.com> | 2025-03-29 23:10:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-29 23:10:13 +0200 |
| commit | 9448b79201adddf493ba36e1aaedee31ea17c293 (patch) | |
| tree | 89e70cd234b4013a17cbb054b9cb5753ad3ec120 /src/doc/rustc-dev-guide/examples/rustc-driver-example.rs | |
| parent | 70cbe19fe005166c4321b3fcfedd0010b7d69d9d (diff) | |
| parent | 9a2d1fdb141ec2db9be1802316c66722f7b678f8 (diff) | |
| download | rust-9448b79201adddf493ba36e1aaedee31ea17c293.tar.gz rust-9448b79201adddf493ba36e1aaedee31ea17c293.zip | |
Merge pull request #2289 from y1lan/fix_compiler_err_of_examples
Fix compile errors of all the examples
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 | 7 |
1 files changed, 3 insertions, 4 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 984bd3e37ae..35dd07dd136 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs @@ -1,4 +1,4 @@ -// Tested with nightly-2025-02-13 +// Tested with nightly-2025-03-08 #![feature(rustc_private)] @@ -71,9 +71,8 @@ impl rustc_driver::Callbacks for MyCallbacks { fn after_analysis(&mut self, _compiler: &Compiler, tcx: TyCtxt<'_>) -> Compilation { // Analyze the program and inspect the types of definitions. - for id in tcx.hir().items() { - let hir = tcx.hir(); - let item = hir.item(id); + for id in tcx.hir_free_items(){ + let item = &tcx.hir_item(id); match item.kind { rustc_hir::ItemKind::Static(_, _, _) | rustc_hir::ItemKind::Fn { .. } => { let name = item.ident; |
