]> git.lizzy.rs Git - rust.git/commitdiff
Document a few things
authorbjorn3 <bjorn3@users.noreply.github.com>
Sun, 28 Mar 2021 16:48:52 +0000 (18:48 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sun, 2 May 2021 16:00:20 +0000 (18:00 +0200)
compiler/rustc_driver/src/lib.rs

index 6dd29e79593253da3999cade106108c3e1686a81..94d962a437380be9e14013f47168a8fa332dc2c0 100644 (file)
@@ -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 @@ pub fn set_make_codegen_backend(
         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 @@ pub fn set_file_loader(
         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 @@ pub fn run(self) -> interface::Result<()> {
         )
     }
 }
-// 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),