Skip to content

Commit 2fa7175

Browse files
committed
Document a few things
1 parent b5e049d commit 2fa7175

File tree

1 file changed

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

1 file changed

+12
-2
lines changed

compiler/rustc_driver/src/lib.rs

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

136+
/// This is the primary entry point for rustc.
136137
pub struct RunCompiler<'a, 'b> {
137138
at_args: &'a [String],
138139
callbacks: &'b mut (dyn Callbacks + Send),
@@ -146,6 +147,9 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
146147
pub fn new(at_args: &'a [String], callbacks: &'b mut (dyn Callbacks + Send)) -> Self {
147148
Self { at_args, callbacks, file_loader: None, emitter: None, make_codegen_backend: None }
148149
}
150+
151+
/// Set a custom codegen backend.
152+
///
149153
/// Used by cg_clif.
150154
pub fn set_make_codegen_backend(
151155
&mut self,
@@ -156,11 +160,17 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
156160
self.make_codegen_backend = make_codegen_backend;
157161
self
158162
}
163+
164+
/// Emit diagnostics to the specified location.
165+
///
159166
/// Used by RLS.
160167
pub fn set_emitter(&mut self, emitter: Option<Box<dyn Write + Send>>) -> &mut Self {
161168
self.emitter = emitter;
162169
self
163170
}
171+
172+
/// Load files from sources other than the file system.
173+
///
164174
/// Used by RLS.
165175
pub fn set_file_loader(
166176
&mut self,
@@ -169,6 +179,8 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
169179
self.file_loader = file_loader;
170180
self
171181
}
182+
183+
/// Parse args and run the compiler.
172184
pub fn run(self) -> interface::Result<()> {
173185
run_compiler(
174186
self.at_args,
@@ -179,8 +191,6 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
179191
)
180192
}
181193
}
182-
// Parse args and run the compiler. This is the primary entry point for rustc.
183-
// The FileLoader provides a way to load files from sources other than the file system.
184194
fn run_compiler(
185195
at_args: &[String],
186196
callbacks: &mut (dyn Callbacks + Send),

0 commit comments

Comments
 (0)