Skip to content

Commit 09ed54f

Browse files
georgewfrasermark-i-m
authored andcommitted
run_compiler is exported by rustc_interface
1 parent 506d2d3 commit 09ed54f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

examples/rustc-driver-example.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rustc::session;
1212
use rustc::session::config;
1313
use rustc_errors::registry;
1414
use rustc_hash::{FxHashMap, FxHashSet};
15-
use rustc_interface::interface;
1615
use rustc_span::source_map;
1716
use std::path;
1817
use std::process;
@@ -28,7 +27,7 @@ fn main() {
2827
let filename = "main.rs";
2928
let contents = "static HELLO: &str = \"Hello, world!\"; fn main() { println!(\"{}\", HELLO); }";
3029
let errors = registry::Registry::new(&rustc_error_codes::DIAGNOSTICS);
31-
let config = interface::Config {
30+
let config = rustc_interface::Config {
3231
// Command line options
3332
opts: config::Options {
3433
maybe_sysroot: Some(path::PathBuf::from(sysroot)),
@@ -80,7 +79,7 @@ fn main() {
8079
// Registry of diagnostics codes.
8180
registry: errors,
8281
};
83-
interface::run_compiler(config, |compiler| {
82+
rustc_interface::run_compiler(config, |compiler| {
8483
compiler.enter(|queries| {
8584
// Parse the program and print the syntax tree.
8685
let parse = queries.parse().unwrap().take();

src/rustc-driver.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ for running code at particular times during the compilation process, allowing
99
third parties to effectively use `rustc`'s internals as a library for
1010
analysing a crate or emulating the compiler in-process (e.g. the RLS or rustdoc).
1111

12-
For those using `rustc` as a library, the [`rustc_interface::interface::run_compiler()`][i_rc]
12+
For those using `rustc` as a library, the [`rustc_interface::run_compiler()`][i_rc]
1313
function is the main entrypoint to the compiler. It takes a configuration for the compiler
1414
and a closure that takes a [`Compiler`]. `run_compiler` creates a `Compiler` from the
1515
configuration and passes it to the closure. Inside the closure, you can use the `Compiler`
@@ -19,7 +19,7 @@ You can see a minimal example of how to use `rustc_interface` [here][example].
1919
You can see what queries are currently available through the rustdocs for [`Compiler`].
2020
You can see an example of how to use them by looking at the `rustc_driver` implementation,
2121
specifically the [`rustc_driver::run_compiler` function][rd_rc] (not to be confused with
22-
[`rustc_interface::interface::run_compiler`][i_rc]). The `rustc_driver::run_compiler` function
22+
[`rustc_interface::run_compiler`][i_rc]). The `rustc_driver::run_compiler` function
2323
takes a bunch of command-line args and some other configurations and
2424
drives the compilation to completion.
2525

0 commit comments

Comments
 (0)