Skip to content

Commit 859a77c

Browse files
committed
Propagate TransCrate generic to run_compiler
1 parent 7402866 commit 859a77c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/librustc_driver/driver.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use derive_registrar;
6767

6868
use profile;
6969

70-
pub fn compile_input(sess: &Session,
70+
pub fn compile_input<Trans: TransCrate>(sess: &Session,
7171
cstore: &CStore,
7272
input: &Input,
7373
outdir: &Option<PathBuf>,
@@ -207,7 +207,7 @@ pub fn compile_input(sess: &Session,
207207
None
208208
};
209209

210-
phase_3_run_analysis_passes(sess,
210+
phase_3_run_analysis_passes<Trans, _, _>(sess,
211211
cstore,
212212
hir_map,
213213
analysis,
@@ -244,7 +244,7 @@ pub fn compile_input(sess: &Session,
244244
tcx.print_debug_stats();
245245
}
246246

247-
let trans = phase_4_translate_to_llvm::<DefaultTransCrate>(tcx, rx);
247+
let trans = phase_4_translate_to_llvm::<Trans>(tcx, rx);
248248

249249
if log_enabled!(::log::LogLevel::Info) {
250250
println!("Post-trans");
@@ -267,7 +267,7 @@ pub fn compile_input(sess: &Session,
267267
}
268268

269269
let (phase5_result, trans) =
270-
phase_5_run_llvm_passes::<DefaultTransCrate>(sess, &dep_graph, trans);
270+
phase_5_run_llvm_passes::<Trans>(sess, &dep_graph, trans);
271271

272272
controller_entry_point!(after_llvm,
273273
sess,
@@ -278,7 +278,7 @@ pub fn compile_input(sess: &Session,
278278
// Run the linker on any artifacts that resulted from the LLVM run.
279279
// This should produce either a finished executable or library.
280280
time(sess.time_passes(), "linking", || {
281-
DefaultTransCrate::link_binary(sess, &trans, &outputs)
281+
Trans::link_binary(sess, &trans, &outputs)
282282
});
283283

284284
// Now that we won't touch anything in the incremental compilation directory
@@ -910,7 +910,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
910910
/// Run the resolution, typechecking, region checking and other
911911
/// miscellaneous analysis passes on the crate. Return various
912912
/// structures carrying the results of the analysis.
913-
pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
913+
pub fn phase_3_run_analysis_passes<'tcx, Trans: TransCrate, F, R>(sess: &'tcx Session,
914914
cstore: &'tcx CrateStore,
915915
hir_map: hir_map::Map<'tcx>,
916916
mut analysis: ty::CrateAnalysis,
@@ -966,7 +966,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
966966
mir::provide(&mut local_providers);
967967
reachable::provide(&mut local_providers);
968968
rustc_privacy::provide(&mut local_providers);
969-
DefaultTransCrate::provide_local(&mut local_providers);
969+
Trans::provide_local(&mut local_providers);
970970
typeck::provide(&mut local_providers);
971971
ty::provide(&mut local_providers);
972972
traits::provide(&mut local_providers);
@@ -979,7 +979,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
979979

980980
let mut extern_providers = ty::maps::Providers::default();
981981
cstore::provide(&mut extern_providers);
982-
DefaultTransCrate::provide_extern(&mut extern_providers);
982+
Trans::provide_extern(&mut extern_providers);
983983
ty::provide_extern(&mut extern_providers);
984984
traits::provide_extern(&mut extern_providers);
985985
// FIXME(eddyb) get rid of this once we replace const_eval with miri.

src/librustc_driver/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ pub fn run_compiler<'a>(args: &[String],
226226
},
227227
};
228228

229-
let cstore = Rc::new(CStore::new(DefaultTransCrate::metadata_loader()));
230-
231229
let loader = file_loader.unwrap_or(box RealFileLoader);
232230
let codemap = Rc::new(CodeMap::with_file_loader(loader, sopts.file_path_mapping()));
233231
let mut sess = session::build_session_with_codemap(
@@ -240,6 +238,8 @@ pub fn run_compiler<'a>(args: &[String],
240238
target_features::add_configuration(&mut cfg, &sess);
241239
sess.parse_sess.config = cfg;
242240

241+
let cstore = Rc::new(CStore::new(DefaultTransCrate::metadata_loader()));
242+
243243
do_or_return!(callbacks.late_callback(&matches,
244244
&sess,
245245
&*cstore,
@@ -249,7 +249,7 @@ pub fn run_compiler<'a>(args: &[String],
249249

250250
let plugins = sess.opts.debugging_opts.extra_plugins.clone();
251251
let control = callbacks.build_controller(&sess, &matches);
252-
(driver::compile_input(&sess,
252+
(driver::compile_input::<DefaultTransCrate>(&sess,
253253
&cstore,
254254
&input,
255255
&odir,

0 commit comments

Comments
 (0)