mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Document a few things
This commit is contained in:
parent
b5e049de08
commit
2fa7175293
@ -133,6 +133,7 @@ pub fn diagnostics_registry() -> Registry {
|
||||
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),
|
||||
@ -146,6 +147,9 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
|
||||
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,
|
||||
@ -156,11 +160,17 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
|
||||
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,
|
||||
@ -169,6 +179,8 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
|
||||
self.file_loader = file_loader;
|
||||
self
|
||||
}
|
||||
|
||||
/// Parse args and run the compiler.
|
||||
pub fn run(self) -> interface::Result<()> {
|
||||
run_compiler(
|
||||
self.at_args,
|
||||
@ -179,8 +191,6 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
|
||||
)
|
||||
}
|
||||
}
|
||||
// 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),
|
||||
|
Loading…
Reference in New Issue
Block a user