@@ -133,6 +133,7 @@ pub fn diagnostics_registry() -> Registry {
133
133
Registry :: new ( & rustc_error_codes:: DIAGNOSTICS )
134
134
}
135
135
136
+ /// This is the primary entry point for rustc.
136
137
pub struct RunCompiler < ' a , ' b > {
137
138
at_args : & ' a [ String ] ,
138
139
callbacks : & ' b mut ( dyn Callbacks + Send ) ,
@@ -146,6 +147,9 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
146
147
pub fn new ( at_args : & ' a [ String ] , callbacks : & ' b mut ( dyn Callbacks + Send ) ) -> Self {
147
148
Self { at_args, callbacks, file_loader : None , emitter : None , make_codegen_backend : None }
148
149
}
150
+
151
+ /// Set a custom codegen backend.
152
+ ///
149
153
/// Used by cg_clif.
150
154
pub fn set_make_codegen_backend (
151
155
& mut self ,
@@ -156,11 +160,17 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
156
160
self . make_codegen_backend = make_codegen_backend;
157
161
self
158
162
}
163
+
164
+ /// Emit diagnostics to the specified location.
165
+ ///
159
166
/// Used by RLS.
160
167
pub fn set_emitter ( & mut self , emitter : Option < Box < dyn Write + Send > > ) -> & mut Self {
161
168
self . emitter = emitter;
162
169
self
163
170
}
171
+
172
+ /// Load files from sources other than the file system.
173
+ ///
164
174
/// Used by RLS.
165
175
pub fn set_file_loader (
166
176
& mut self ,
@@ -169,6 +179,8 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
169
179
self . file_loader = file_loader;
170
180
self
171
181
}
182
+
183
+ /// Parse args and run the compiler.
172
184
pub fn run ( self ) -> interface:: Result < ( ) > {
173
185
run_compiler (
174
186
self . at_args ,
@@ -179,8 +191,6 @@ impl<'a, 'b> RunCompiler<'a, 'b> {
179
191
)
180
192
}
181
193
}
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.
184
194
fn run_compiler (
185
195
at_args : & [ String ] ,
186
196
callbacks : & mut ( dyn Callbacks + Send ) ,
0 commit comments