Registry::new(&rustc_error_codes::DIAGNOSTICS)
}
+/// This is the primary entry point for rustc.
pub struct RunCompiler<'a, 'b> {
at_args: &'a [String],
callbacks: &'b mut (dyn Callbacks + Send),
pub fn new(at_args: &'a [String], callbacks: &'b mut (dyn Callbacks + Send)) -> Self {
Self { at_args, callbacks, file_loader: None, emitter: None, make_codegen_backend: None }
}
+
+ /// Set a custom codegen backend.
+ ///
/// Used by cg_clif.
pub fn set_make_codegen_backend(
&mut self,
self.make_codegen_backend = make_codegen_backend;
self
}
+
+ /// Emit diagnostics to the specified location.
+ ///
/// Used by RLS.
pub fn set_emitter(&mut self, emitter: Option<Box<dyn Write + Send>>) -> &mut Self {
self.emitter = emitter;
self
}
+
+ /// Load files from sources other than the file system.
+ ///
/// Used by RLS.
pub fn set_file_loader(
&mut self,
self.file_loader = file_loader;
self
}
+
+ /// Parse args and run the compiler.
pub fn run(self) -> interface::Result<()> {
run_compiler(
self.at_args,
)
}
}
-// Parse args and run the compiler. This is the primary entry point for rustc.
-// The FileLoader provides a way to load files from sources other than the file system.
fn run_compiler(
at_args: &[String],
callbacks: &mut (dyn Callbacks + Send),