diff options
| author | bors <bors@rust-lang.org> | 2025-04-03 15:31:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-03 15:31:20 +0000 |
| commit | 82eb03ec6220ee435e0e07fdaf3f0a68a79aab17 (patch) | |
| tree | 6e19884edcff792c9a85b8da77749a3f63597524 /src/doc/rustc-dev-guide/examples/rustc-interface-example.rs | |
| parent | 946aea0b3d9f43e57953ce5094d8e4a2a244ce71 (diff) | |
| parent | 29c0fe747ae83d2519aaf9c9713e8716f7a3511b (diff) | |
| download | rust-82eb03ec6220ee435e0e07fdaf3f0a68a79aab17.tar.gz rust-82eb03ec6220ee435e0e07fdaf3f0a68a79aab17.zip | |
Auto merge of #139301 - matthiaskrgr:rollup-sa6ali8, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #139080 (Experimental feature gate for `super let`) - #139145 (slice: Remove some uses of unsafe in first/last chunk methods) - #139149 (unstable book: document import_trait_associated_functions) - #139273 (Apply requested API changes to `cell_update`) - #139282 (rustdoc: make settings checkboxes always square) - #139283 (Rustc dev guide subtree update) - #139294 (Fix the `f16`/`f128` feature gates on integer literals) r? `@ghost` `@rustbot` modify labels: rollup
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.rs | 13 |
1 files changed, 6 insertions, 7 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..360f70c8e86 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-28 #![feature(rustc_private)] @@ -64,14 +64,13 @@ 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; + rustc_hir::ItemKind::Static(ident, ..) + | rustc_hir::ItemKind::Fn { ident, .. } => { let ty = tcx.type_of(item.hir_id().owner.def_id); - println!("{name:?}:\t{ty:?}") + println!("{ident:?}:\t{ty:?}") } _ => (), } |
