about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
diff options
context:
space:
mode:
authorTshepang Mbambo <tshepang@gmail.com>2025-03-29 23:10:13 +0200
committerGitHub <noreply@github.com>2025-03-29 23:10:13 +0200
commit9448b79201adddf493ba36e1aaedee31ea17c293 (patch)
tree89e70cd234b4013a17cbb054b9cb5753ad3ec120 /src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
parent70cbe19fe005166c4321b3fcfedd0010b7d69d9d (diff)
parent9a2d1fdb141ec2db9be1802316c66722f7b678f8 (diff)
downloadrust-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-interface-example.rs')
-rw-r--r--src/doc/rustc-dev-guide/examples/rustc-interface-example.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
index 70f27c2a82a..11125caec70 100644
--- a/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
+++ b/src/doc/rustc-dev-guide/examples/rustc-interface-example.rs
@@ -1,4 +1,4 @@
-// Tested with nightly-2025-02-13
+// Tested with nightly-2025-03-08
 
 #![feature(rustc_private)]
 
@@ -64,9 +64,8 @@ fn main() {
         println!("{krate:?}");
         // Analyze the program and inspect the types of definitions.
         rustc_interface::create_and_enter_global_ctxt(&compiler, krate, |tcx| {
-            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;