From 76f7584f6a008bc0a5829a4dd82840e501c6140b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:13:14 +0000 Subject: [PATCH] Remove RunCompiler It has become nothing other than a wrapper around run_compiler. --- examples/rustc-driver-example.rs | 4 ++-- examples/rustc-driver-interacting-with-the-ast.rs | 4 ++-- src/rustc-driver/intro.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/rustc-driver-example.rs b/examples/rustc-driver-example.rs index b7717284..8983915d 100644 --- a/examples/rustc-driver-example.rs +++ b/examples/rustc-driver-example.rs @@ -18,7 +18,7 @@ use std::path::Path; use rustc_ast_pretty::pprust::item_to_string; use rustc_data_structures::sync::Lrc; -use rustc_driver::{Compilation, RunCompiler}; +use rustc_driver::{Compilation, run_compiler}; use rustc_interface::interface::{Compiler, Config}; use rustc_middle::ty::TyCtxt; @@ -87,5 +87,5 @@ impl rustc_driver::Callbacks for MyCallbacks { } fn main() { - RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run(); + run_compiler(&["main.rs".to_string()], &mut MyCallbacks); } diff --git a/examples/rustc-driver-interacting-with-the-ast.rs b/examples/rustc-driver-interacting-with-the-ast.rs index 6c06bbed..c894b604 100644 --- a/examples/rustc-driver-interacting-with-the-ast.rs +++ b/examples/rustc-driver-interacting-with-the-ast.rs @@ -18,7 +18,7 @@ use std::path::Path; use rustc_ast_pretty::pprust::item_to_string; use rustc_data_structures::sync::Lrc; -use rustc_driver::{Compilation, RunCompiler}; +use rustc_driver::{Compilation, run_compiler}; use rustc_interface::interface::{Compiler, Config}; use rustc_middle::ty::TyCtxt; @@ -94,5 +94,5 @@ impl rustc_driver::Callbacks for MyCallbacks { } fn main() { - RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run(); + run_compiler(&["main.rs".to_string()], &mut MyCallbacks); } diff --git a/src/rustc-driver/intro.md b/src/rustc-driver/intro.md index a6234dc1..40500e6b 100644 --- a/src/rustc-driver/intro.md +++ b/src/rustc-driver/intro.md @@ -6,7 +6,7 @@ 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. Where possible, using [`rustc_driver`] rather than [`rustc_interface`] is recommended. -The main entry point of [`rustc_driver`] is [`rustc_driver::RunCompiler`][rd_rc]. +The main entry point of [`rustc_driver`] is [`rustc_driver::run_compiler`][rd_rc]. This builder accepts the same command-line args as rustc as well as an implementation of [`Callbacks`][cb] and a couple of other optional options. [`Callbacks`][cb] is a `trait` that allows for custom compiler configuration, as well as allowing custom code to run after different phases of the compilation. @@ -40,7 +40,7 @@ specifically [`rustc_driver_impl::run_compiler`][rdi_rc] [cb]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html [example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs [i_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html -[rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/struct.RunCompiler.html +[rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler.html [rdi_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html [stupid-stats]: https://github.com/nrc/stupid-stats [`nightly-rustc`]: https://doc.rust-lang.org/nightly/nightly-rustc/