Skip to content

Commit 67f54e6

Browse files
committed
Remove after_llvm callback and fix build
1 parent 76d1c6e commit 67f54e6

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

src/librustc_driver/driver.rs

+7-23
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,13 @@ pub fn compile_input<Trans: TransCrate>(sess: &Session,
267267
let (phase5_result, trans) =
268268
phase_5_run_llvm_passes::<Trans>(sess, &dep_graph, trans);
269269

270-
controller_entry_point!(after_llvm,
271-
sess,
272-
CompileState::state_after_llvm(input, sess, outdir, output, &trans),
273-
phase5_result);
274270
phase5_result?;
275271

272+
if !sess.opts.output_types.keys().any(|&i| i == OutputType::Exe ||
273+
i == OutputType::Metadata) {
274+
return Ok(());
275+
}
276+
276277
// Run the linker on any artifacts that resulted from the LLVM run.
277278
// This should produce either a finished executable or library.
278279
time(sess.time_passes(), "linking", || {
@@ -336,7 +337,6 @@ pub struct CompileController<'a> {
336337
pub after_expand: PhaseController<'a>,
337338
pub after_hir_lowering: PhaseController<'a>,
338339
pub after_analysis: PhaseController<'a>,
339-
pub after_llvm: PhaseController<'a>,
340340
pub compilation_done: PhaseController<'a>,
341341

342342
// FIXME we probably want to group the below options together and offer a
@@ -355,7 +355,6 @@ impl<'a> CompileController<'a> {
355355
after_expand: PhaseController::basic(),
356356
after_hir_lowering: PhaseController::basic(),
357357
after_analysis: PhaseController::basic(),
358-
after_llvm: PhaseController::basic(),
359358
compilation_done: PhaseController::basic(),
360359
make_glob_map: MakeGlobMap::No,
361360
keep_ast: false,
@@ -385,7 +384,7 @@ impl<'a> PhaseController<'a> {
385384
/// State that is passed to a callback. What state is available depends on when
386385
/// during compilation the callback is made. See the various constructor methods
387386
/// (`state_*`) in the impl to see which data is provided for any given entry point.
388-
pub struct CompileState<'a, 'tcx: 'a, Trans: TransCrate> {
387+
pub struct CompileState<'a, 'tcx: 'a> {
389388
pub input: &'a Input,
390389
pub session: &'tcx Session,
391390
pub krate: Option<ast::Crate>,
@@ -403,10 +402,9 @@ pub struct CompileState<'a, 'tcx: 'a, Trans: TransCrate> {
403402
pub resolutions: Option<&'a Resolutions>,
404403
pub analysis: Option<&'a ty::CrateAnalysis>,
405404
pub tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
406-
pub trans: Option<&'a <Trans as TransCrate>::TranslatedCrate>,
407405
}
408406

409-
impl<'a, 'tcx, Trans: TransCrate> CompileState<'a, 'tcx, Trans> {
407+
impl<'a, 'tcx> CompileState<'a, 'tcx> {
410408
fn empty(input: &'a Input,
411409
session: &'tcx Session,
412410
out_dir: &'a Option<PathBuf>)
@@ -429,7 +427,6 @@ impl<'a, 'tcx, Trans: TransCrate> CompileState<'a, 'tcx, Trans> {
429427
resolutions: None,
430428
analysis: None,
431429
tcx: None,
432-
trans: None,
433430
}
434431
}
435432

@@ -519,19 +516,6 @@ impl<'a, 'tcx, Trans: TransCrate> CompileState<'a, 'tcx, Trans> {
519516
}
520517
}
521518

522-
fn state_after_llvm(input: &'a Input,
523-
session: &'tcx Session,
524-
out_dir: &'a Option<PathBuf>,
525-
out_file: &'a Option<PathBuf>,
526-
trans: &'a <Trans as TransCrate>::TranslatedCrate)
527-
-> Self {
528-
CompileState {
529-
trans: Some(trans),
530-
out_file: out_file.as_ref().map(|s| &**s),
531-
..CompileState::empty(input, session, out_dir)
532-
}
533-
}
534-
535519
fn state_when_compilation_done(input: &'a Input,
536520
session: &'tcx Session,
537521
out_dir: &'a Option<PathBuf>,

src/librustc_driver/lib.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use rustc_save_analysis as save;
6666
use rustc_save_analysis::DumpHandler;
6767
use rustc::session::{self, config, Session, build_session, CompileResult};
6868
use rustc::session::CompileIncomplete;
69-
use rustc::session::config::{Input, PrintRequest, OutputType, ErrorOutputType};
69+
use rustc::session::config::{Input, PrintRequest, ErrorOutputType};
7070
use rustc::session::config::nightly_options;
7171
use rustc::session::{early_error, early_warn};
7272
use rustc::lint::Lint;
@@ -241,8 +241,8 @@ pub fn run_compiler<'a>(args: &[String],
241241
let plugins = sess.opts.debugging_opts.extra_plugins.clone();
242242
let control = callbacks.build_controller(&sess, &matches);
243243

244-
let trans_name = sess.opts.debugging_opts.trans.as_ref().map(|s|&**s);
245-
match trans_name {
244+
let trans_name = sess.opts.debugging_opts.trans.clone();
245+
match trans_name.as_ref().map(|s|&**s) {
246246
None => {
247247
let cstore = Rc::new(CStore::new(DefaultTransCrate::metadata_loader()));
248248

@@ -635,11 +635,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
635635
control.after_hir_lowering.stop = Compilation::Stop;
636636
}
637637

638-
if !sess.opts.output_types.keys().any(|&i| i == OutputType::Exe ||
639-
i == OutputType::Metadata) {
640-
control.after_llvm.stop = Compilation::Stop;
641-
}
642-
643638
if save_analysis(sess) {
644639
enable_save_analysis(&mut control);
645640
}

src/librustc_driver/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl PpSourceMode {
227227
f(&annotation, hir_map.forest.krate())
228228
}
229229
PpmTyped => {
230-
abort_on_err(driver::phase_3_run_analysis_passes(sess,
230+
abort_on_err(driver::phase_3_run_analysis_passes::<::DefaultTransCrate, _, _>(sess,
231231
cstore,
232232
hir_map.clone(),
233233
analysis.clone(),
@@ -1036,7 +1036,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
10361036

10371037
let mut out = Vec::new();
10381038

1039-
abort_on_err(driver::phase_3_run_analysis_passes(sess,
1039+
abort_on_err(driver::phase_3_run_analysis_passes::<::DefaultTransCrate, _, _>(sess,
10401040
cstore,
10411041
hir_map.clone(),
10421042
analysis.clone(),

0 commit comments

Comments
 (0)