diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-04-03 07:39:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-03 07:39:08 +0200 |
| commit | 85c557e76eac68b1f94504f56c492b653706ee2c (patch) | |
| tree | c5c61fb576d0404a41ad3dbcf6c3affd2153bc74 /src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs | |
| parent | b5d5b6cd41dcf3495f9936bb6ce14a1922b513c1 (diff) | |
| parent | ead4d4c9514962bbec4ca22e561bad70a76242f4 (diff) | |
| download | rust-85c557e76eac68b1f94504f56c492b653706ee2c.tar.gz rust-85c557e76eac68b1f94504f56c492b653706ee2c.zip | |
Rollup merge of #139283 - BoxyUwU:rdg-push, r=jieyouxu
Rustc dev guide subtree update r? ``@jieyouxu`` ``@Kobzol``
Diffstat (limited to 'src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs')
| -rw-r--r-- | src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs index 39b236e1783..2512ba3c3f9 100644 --- a/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs +++ b/src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs @@ -1,4 +1,4 @@ -// Tested with nightly-2025-02-13 +// Tested with nightly-2025-03-28 #![feature(rustc_private)] @@ -86,8 +86,10 @@ fn main() { rustc_interface::run_compiler(config, |compiler| { let krate = rustc_interface::passes::parse(&compiler.sess); rustc_interface::create_and_enter_global_ctxt(&compiler, krate, |tcx| { - // Run the analysis phase on the local crate to trigger the type error. - let _ = tcx.analysis(()); + // Iterate all the items defined and perform type checking. + tcx.par_hir_body_owners(|item_def_id| { + tcx.ensure_ok().typeck(item_def_id); + }); }); // If the compiler has encountered errors when this closure returns, it will abort (!) the program. // We avoid this by resetting the error count before returning |
