Remove set_make_codegen_backend and set_file_loader
They can both be set inside the config callback too.
This commit is contained in:
parent
ad0c0fc6af
commit
851d9a5b20
|
|
@ -19,7 +19,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_interface::interface::Compiler;
|
||||
use rustc_interface::interface::{Compiler, Config};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
struct MyFileLoader;
|
||||
|
|
@ -51,6 +51,10 @@ fn main() {
|
|||
struct MyCallbacks;
|
||||
|
||||
impl rustc_driver::Callbacks for MyCallbacks {
|
||||
fn config(&mut self, config: &mut Config) {
|
||||
config.file_loader = Some(Box::new(MyFileLoader));
|
||||
}
|
||||
|
||||
fn after_crate_root_parsing(
|
||||
&mut self,
|
||||
_compiler: &Compiler,
|
||||
|
|
@ -83,10 +87,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
match RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks) {
|
||||
mut compiler => {
|
||||
compiler.set_file_loader(Some(Box::new(MyFileLoader)));
|
||||
compiler.run();
|
||||
}
|
||||
}
|
||||
RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,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_interface::interface::Compiler;
|
||||
use rustc_interface::interface::{Compiler, Config};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
struct MyFileLoader;
|
||||
|
|
@ -51,6 +51,10 @@ fn main() {
|
|||
struct MyCallbacks;
|
||||
|
||||
impl rustc_driver::Callbacks for MyCallbacks {
|
||||
fn config(&mut self, config: &mut Config) {
|
||||
config.file_loader = Some(Box::new(MyFileLoader));
|
||||
}
|
||||
|
||||
fn after_crate_root_parsing(
|
||||
&mut self,
|
||||
_compiler: &Compiler,
|
||||
|
|
@ -90,10 +94,5 @@ impl rustc_driver::Callbacks for MyCallbacks {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
match RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks) {
|
||||
mut compiler => {
|
||||
compiler.set_file_loader(Some(Box::new(MyFileLoader)));
|
||||
compiler.run();
|
||||
}
|
||||
}
|
||||
RunCompiler::new(&["main.rs".to_string()], &mut MyCallbacks).run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue