Skip to content

Commit 2fabbf6

Browse files
committed
Document a few things
1 parent 58b9e6e commit 2fabbf6

File tree

1 file changed

+9
-2
lines changed
  • compiler/rustc_driver/src

1 file changed

+9
-2
lines changed

compiler/rustc_driver/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ pub fn diagnostics_registry() -> Registry {
132132
Registry::new(&rustc_error_codes::DIAGNOSTICS)
133133
}
134134

135+
/// This is the primary entry point for rustc.
135136
pub struct RunCompiler<'a, 'b> {
136137
at_args: &'a [String],
137138
callbacks: &'b mut (dyn Callbacks + Send),
@@ -145,6 +146,8 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
145146
pub fn new(at_args: &'a [String], callbacks: &'b mut (dyn Callbacks + Send)) -> Self {
146147
Self { at_args, callbacks, file_loader: None, emitter: None, make_codegen_backend: None }
147148
}
149+
150+
/// Set a custom codegen backend.
148151
pub fn set_make_codegen_backend(
149152
&mut self,
150153
make_codegen_backend: Option<
@@ -154,17 +157,23 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
154157
self.make_codegen_backend = make_codegen_backend;
155158
self
156159
}
160+
161+
/// Emit diagnostics to the specified location.
157162
pub fn set_emitter(&mut self, emitter: Option<Box<dyn Write + Send>>) -> &mut Self {
158163
self.emitter = emitter;
159164
self
160165
}
166+
167+
/// Load files from sources other than the file system.
161168
pub fn set_file_loader(
162169
&mut self,
163170
file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
164171
) -> &mut Self {
165172
self.file_loader = file_loader;
166173
self
167174
}
175+
176+
/// Parse args and run the compiler.
168177
pub fn run(self) -> interface::Result<()> {
169178
run_compiler(
170179
self.at_args,
@@ -175,8 +184,6 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
175184
)
176185
}
177186
}
178-
// Parse args and run the compiler. This is the primary entry point for rustc.
179-
// The FileLoader provides a way to load files from sources other than the file system.
180187
fn run_compiler(
181188
at_args: &[String],
182189
callbacks: &mut (dyn Callbacks + Send),

0 commit comments

Comments
 (0)