@@ -71,8 +71,6 @@ use pretty::{PpMode, UserIdentifiedItem};
71
71
use rustc_resolve as resolve;
72
72
use rustc_save_analysis as save;
73
73
use rustc_save_analysis:: DumpHandler ;
74
- #[ cfg( feature="llvm" ) ]
75
- use rustc_trans:: back:: write:: { RELOC_MODEL_ARGS , CODE_GEN_MODEL_ARGS } ;
76
74
use rustc:: dep_graph:: DepGraph ;
77
75
use rustc:: session:: { self , config, Session , build_session, CompileResult } ;
78
76
use rustc:: session:: CompileIncomplete ;
@@ -207,6 +205,25 @@ impl MetadataLoaderTrait for NoLLvmMetadataLoader {
207
205
}
208
206
}
209
207
208
+ #[ cfg( feature="llvm" ) ]
209
+ mod rustc_trans {
210
+ use rustc:: ty:: maps:: Providers ;
211
+ pub fn init ( _sess : & Session ) { }
212
+ pub fn enable_llvm_debug ( ) { }
213
+ pub fn provide ( _providers : & mut Providers ) { }
214
+ pub struct CrateTranslation ( ( ) ) ;
215
+ pub mod back {
216
+ pub mod write {
217
+ pub struct OngoingCrateTranslation ( ( ) ) ;
218
+ }
219
+ }
220
+ mod diagnostics {
221
+ register_long_diagnostics ! { }
222
+ }
223
+
224
+ pub use diagnostics:: DIAGNOSTICS ;
225
+ }
226
+
210
227
// Parse args and run the compiler. This is the primary entry point for rustc.
211
228
// See comments on CompilerCalls below for details about the callbacks argument.
212
229
// The FileLoader provides a way to load files from sources other than the file system.
@@ -232,7 +249,6 @@ pub fn run_compiler<'a>(args: &[String],
232
249
let ( sopts, cfg) = config:: build_session_options_and_crate_config ( & matches) ;
233
250
234
251
if sopts. debugging_opts . debug_llvm {
235
- #[ cfg( feature="llvm" ) ]
236
252
rustc_trans:: enable_llvm_debug ( ) ;
237
253
}
238
254
@@ -262,7 +278,6 @@ pub fn run_compiler<'a>(args: &[String],
262
278
let mut sess = session:: build_session_with_codemap (
263
279
sopts, & dep_graph, input_file_path, descriptions, cstore. clone ( ) , codemap, emitter_dest,
264
280
) ;
265
- #[ cfg( feature="llvm" ) ]
266
281
rustc_trans:: init ( & sess) ;
267
282
rustc_lint:: register_builtins ( & mut sess. lint_store . borrow_mut ( ) , Some ( & sess) ) ;
268
283
@@ -544,7 +559,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
544
559
None ,
545
560
descriptions. clone ( ) ,
546
561
cstore. clone ( ) ) ;
547
- #[ cfg( feature="llvm" ) ]
548
562
rustc_trans:: init ( & sess) ;
549
563
rustc_lint:: register_builtins ( & mut sess. lint_store . borrow_mut ( ) , Some ( & sess) ) ;
550
564
let mut cfg = config:: build_configuration ( & sess, cfg. clone ( ) ) ;
@@ -803,15 +817,15 @@ impl RustcDefaultCalls {
803
817
PrintRequest :: RelocationModels => {
804
818
println ! ( "Available relocation models:" ) ;
805
819
#[ cfg( feature="llvm" ) ]
806
- for & ( name, _) in RELOC_MODEL_ARGS . iter ( ) {
820
+ for & ( name, _) in rustc_trans :: back :: write :: RELOC_MODEL_ARGS . iter ( ) {
807
821
println ! ( " {}" , name) ;
808
822
}
809
823
println ! ( "" ) ;
810
824
}
811
825
PrintRequest :: CodeModels => {
812
826
println ! ( "Available code models:" ) ;
813
827
#[ cfg( feature="llvm" ) ]
814
- for & ( name, _) in CODE_GEN_MODEL_ARGS . iter ( ) {
828
+ for & ( name, _) in rustc_trans :: back :: write :: CODE_GEN_MODEL_ARGS . iter ( ) {
815
829
println ! ( " {}" , name) ;
816
830
}
817
831
println ! ( "" ) ;
@@ -1285,7 +1299,6 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
1285
1299
all_errors. extend_from_slice ( & rustc_borrowck:: DIAGNOSTICS ) ;
1286
1300
all_errors. extend_from_slice ( & rustc_resolve:: DIAGNOSTICS ) ;
1287
1301
all_errors. extend_from_slice ( & rustc_privacy:: DIAGNOSTICS ) ;
1288
- #[ cfg( feature="llvm" ) ]
1289
1302
all_errors. extend_from_slice ( & rustc_trans:: DIAGNOSTICS ) ;
1290
1303
all_errors. extend_from_slice ( & rustc_const_eval:: DIAGNOSTICS ) ;
1291
1304
all_errors. extend_from_slice ( & rustc_metadata:: DIAGNOSTICS ) ;
0 commit comments