From da9e815ed21ab642979f4c979c89ad4e60dfa097 Mon Sep 17 00:00:00 2001 From: Tbkhi Date: Mon, 11 Mar 2024 07:31:43 -0300 Subject: [PATCH] removing parens for functions --- src/rustc-driver.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/rustc-driver.md b/src/rustc-driver.md index ecd1292dc..0a300a98f 100644 --- a/src/rustc-driver.md +++ b/src/rustc-driver.md @@ -1,6 +1,6 @@ # `rustc_driver` and `rustc_interface` -The [`rustc_driver`] is essentially `rustc`'s `main()` function. It acts as +The [`rustc_driver`] is essentially `rustc`'s `main` function. It acts as the glue for running the various phases of the compiler in the correct order, using the interface defined in the [`rustc_interface`] crate. @@ -10,24 +10,25 @@ third parties to effectively use `rustc`'s internals as a library for analyzing a crate or for ad hoc emulating of the compiler (i.e. `rustdoc` compiling code and serving output). -More specifically the [`rustc_interface::run_compiler()`][i_rc] function is the +More specifically the [`rustc_interface::run_compiler`][i_rc] function is the main entrypoint for using [`nightly-rustc`] as a library. Initially -[`run_compiler()`][i_rc] takes a configuration variable for the compiler and a +[`run_compiler`][i_rc] takes a configuration variable for the compiler and a `closure` taking a yet unresolved [`Compiler`]. Operationally -[`run_compiler()`][i_rc] creates a `Compiler` from the configuration and passes +[`run_compiler`][i_rc] creates a `Compiler` from the configuration and passes it to the `closure`. Inside the `closure` you can use the `Compiler` to drive queries to compile a crate and get the results. Providing results about the internal state of the compiler what the [`rustc_driver`] does too. You can see a minimal example of how to use [`rustc_interface`] [here][example]. -You can see what queries are currently available in the [`Compiler`] rustdoc. -You can see an example of how to use the queries by looking at the `rustc_driver` implementation, -specifically [`rustc_driver::run_compiler()`][rd_rc] (not to be confused with -[`rustc_interface::run_compiler()`][i_rc]). Generally [`rustc_driver::run_compiler()`][i_rc] -takes a bunch of command-line args and some other configurations and -drives the compilation to completion. +You can see what queries are currently available in the [`Compiler`] rustdocs. +You can see an example of how to use the queries by looking at the +`rustc_driver` implementation, specifically +[`rustc_driver::run_compiler`][rd_rc] (not to be confused with +[`rustc_interface::run_compiler`][i_rc]). Generally +[`rustc_driver::run_compiler`][i_rc] takes a bunch of command-line args and +some other configurations and drives the compilation to completion. -Finally [`rustc_driver::run_compiler()`][rd_rc] also takes a [`Callbacks`][cb], +Finally [`rustc_driver::run_compiler`][rd_rc] also takes a [`Callbacks`][cb], which is a `trait` that allows for custom compiler configuration, as well as allowing custom code to run after different phases of the compilation.