]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_driver/driver.rs
Auto merge of #43651 - petrochenkov:foreign-life, r=eddyb
[rust.git] / src / librustc_driver / driver.rs
index 82ced4d1bcd035d8bd5e380356cc898db36e4c4d..1444dcf4271c84563628bbe145e67e0bf6f81590 100644 (file)
@@ -71,6 +71,7 @@ pub fn compile_input(sess: &Session,
                      output: &Option<PathBuf>,
                      addl_plugins: Option<Vec<String>>,
                      control: &CompileController) -> CompileResult {
+    use rustc_trans::back::write::OngoingCrateTranslation;
     macro_rules! controller_entry_point {
         ($point: ident, $tsess: expr, $make_state: expr, $phase_result: expr) => {{
             let state = &mut $make_state;
@@ -95,7 +96,7 @@ macro_rules! controller_entry_point {
 
         if sess.opts.crate_types.iter().all(|&t|{
             t != CrateType::CrateTypeRlib && t != CrateType::CrateTypeExecutable
-        }) {
+        }) && !sess.opts.crate_types.is_empty() {
             sess.err(
                 "LLVM is not supported by this rustc, so non rlib libraries are not supported"
             );
@@ -107,7 +108,7 @@ macro_rules! controller_entry_point {
     // We need nested scopes here, because the intermediate results can keep
     // large chunks of memory alive and we want to free them as soon as
     // possible to keep the peak memory usage low
-    let (outputs, trans): (OutputFilenames, write::OngoingCrateTranslation) = {
+    let (outputs, trans): (OutputFilenames, OngoingCrateTranslation) = {
         let krate = match phase_1_parse_input(control, sess, input) {
             Ok(krate) => krate,
             Err(mut parse_error) => {
@@ -246,8 +247,7 @@ macro_rules! controller_entry_point {
         })??
     };
 
-    #[cfg(not(feature="llvm"))]
-    {
+    if cfg!(not(feature="llvm")) {
         let (_, _) = (outputs, trans);
         sess.fatal("LLVM is not supported by this rustc");
     }
@@ -967,7 +967,7 @@ macro_rules! try_with_f {
     passes.push_pass(MIR_CONST, mir::transform::type_check::TypeckMir);
     passes.push_pass(MIR_CONST, mir::transform::rustc_peek::SanityCheck);
 
-    // We compute "constant qualifications" betwen MIR_CONST and MIR_VALIDATED.
+    // We compute "constant qualifications" between MIR_CONST and MIR_VALIDATED.
 
     // What we need to run borrowck etc.
     passes.push_pass(MIR_VALIDATED, mir::transform::qualify_consts::QualifyAndPromoteConstants);