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