@@ -35,9 +35,9 @@ use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest, Tr
35
35
use rustc_session:: cstore:: MetadataLoader ;
36
36
use rustc_session:: getopts;
37
37
use rustc_session:: lint:: { Lint , LintId } ;
38
- use rustc_session:: { config, DiagnosticOutput , Session } ;
38
+ use rustc_session:: { config, Session } ;
39
39
use rustc_session:: { early_error, early_error_no_abort, early_warn} ;
40
- use rustc_span:: source_map:: { FileLoader , FileName } ;
40
+ use rustc_span:: source_map:: FileName ;
41
41
use rustc_span:: symbol:: sym;
42
42
use rustc_target:: json:: ToJson ;
43
43
@@ -139,76 +139,13 @@ pub fn diagnostics_registry() -> Registry {
139
139
Registry :: new ( rustc_error_codes:: DIAGNOSTICS )
140
140
}
141
141
142
- /// This is the primary entry point for rustc.
143
- pub struct RunCompiler < ' a , ' b > {
144
- at_args : & ' a [ String ] ,
145
- callbacks : & ' b mut ( dyn Callbacks + Send ) ,
146
- file_loader : Option < Box < dyn FileLoader + Send + Sync > > ,
147
- emitter : Option < Box < dyn Write + Send > > ,
148
- make_codegen_backend :
149
- Option < Box < dyn FnOnce ( & config:: Options ) -> Box < dyn CodegenBackend > + Send > > ,
150
- }
151
-
152
- impl < ' a , ' b > RunCompiler < ' a , ' b > {
153
- pub fn new ( at_args : & ' a [ String ] , callbacks : & ' b mut ( dyn Callbacks + Send ) ) -> Self {
154
- Self { at_args, callbacks, file_loader : None , emitter : None , make_codegen_backend : None }
155
- }
156
-
157
- /// Set a custom codegen backend.
158
- ///
159
- /// Used by cg_clif.
160
- pub fn set_make_codegen_backend (
161
- & mut self ,
162
- make_codegen_backend : Option <
163
- Box < dyn FnOnce ( & config:: Options ) -> Box < dyn CodegenBackend > + Send > ,
164
- > ,
165
- ) -> & mut Self {
166
- self . make_codegen_backend = make_codegen_backend;
167
- self
168
- }
169
-
170
- /// Emit diagnostics to the specified location.
171
- ///
172
- /// Used by RLS.
173
- pub fn set_emitter ( & mut self , emitter : Option < Box < dyn Write + Send > > ) -> & mut Self {
174
- self . emitter = emitter;
175
- self
176
- }
177
-
178
- /// Load files from sources other than the file system.
179
- ///
180
- /// Used by RLS.
181
- pub fn set_file_loader (
182
- & mut self ,
183
- file_loader : Option < Box < dyn FileLoader + Send + Sync > > ,
184
- ) -> & mut Self {
185
- self . file_loader = file_loader;
186
- self
187
- }
188
-
189
- /// Parse args and run the compiler.
190
- pub fn run ( self ) -> interface:: Result < ( ) > {
191
- run_compiler (
192
- self . at_args ,
193
- self . callbacks ,
194
- self . file_loader ,
195
- self . emitter ,
196
- self . make_codegen_backend ,
197
- )
198
- }
199
- }
200
- fn run_compiler (
142
+ // Primary entry point used by rustc, clippy, and miri.
143
+ pub fn run_compiler (
201
144
at_args : & [ String ] ,
202
145
callbacks : & mut ( dyn Callbacks + Send ) ,
203
- file_loader : Option < Box < dyn FileLoader + Send + Sync > > ,
204
- emitter : Option < Box < dyn Write + Send > > ,
205
- make_codegen_backend : Option <
206
- Box < dyn FnOnce ( & config:: Options ) -> Box < dyn CodegenBackend > + Send > ,
207
- > ,
208
146
) -> interface:: Result < ( ) > {
209
147
let args = args:: arg_expand_all ( at_args) ;
210
148
211
- let diagnostic_output = emitter. map_or ( DiagnosticOutput :: Default , DiagnosticOutput :: Raw ) ;
212
149
let Some ( matches) = handle_options ( & args) else { return Ok ( ( ) ) } ;
213
150
214
151
let sopts = config:: build_session_options ( & matches) ;
@@ -229,13 +166,10 @@ fn run_compiler(
229
166
input_path : None ,
230
167
output_file : ofile,
231
168
output_dir : odir,
232
- file_loader,
233
- diagnostic_output,
234
169
lint_caps : Default :: default ( ) ,
235
170
parse_sess_created : None ,
236
171
register_lints : None ,
237
172
override_queries : None ,
238
- make_codegen_backend,
239
173
registry : diagnostics_registry ( ) ,
240
174
} ;
241
175
@@ -1371,7 +1305,7 @@ pub fn main() -> ! {
1371
1305
} )
1372
1306
} )
1373
1307
. collect :: < Vec < _ > > ( ) ;
1374
- RunCompiler :: new ( & args, & mut callbacks) . run ( )
1308
+ run_compiler ( & args, & mut callbacks)
1375
1309
} ) ;
1376
1310
1377
1311
if callbacks. time_passes {
0 commit comments