]> git.lizzy.rs Git - rust.git/commitdiff
report the total number of errors on compilation failure
authorAriel Ben-Yehuda <ariel.byd@gmail.com>
Sun, 2 Jul 2017 13:09:09 +0000 (16:09 +0300)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Sun, 2 Jul 2017 13:16:44 +0000 (16:16 +0300)
Prior to this PR, when we aborted because a "critical pass" failed, we
displayed the number of errors from that critical pass. While that's the
number of errors that caused compilation to abort in *that place*,
that's not what people really want to know. Instead, always report the
total number of errors, and don't bother to track the number of errors
from the last pass that failed.

This changes the compiler driver API to handle errors more smoothly,
and therefore is a compiler-api-[breaking-change].

Fixes #42793.

61 files changed:
src/librustc/middle/resolve_lifetime.rs
src/librustc/session/mod.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_passes/static_recursion.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/lib.rs
src/librustdoc/test.rs
src/test/run-make/llvm-phase/test.rs
src/test/ui/block-result/block-must-not-have-result-do.stderr
src/test/ui/block-result/block-must-not-have-result-res.stderr
src/test/ui/block-result/block-must-not-have-result-while.stderr
src/test/ui/block-result/consider-removing-last-semi.stderr
src/test/ui/block-result/issue-11714.stderr
src/test/ui/block-result/issue-13428.stderr
src/test/ui/block-result/issue-13624.stderr
src/test/ui/block-result/issue-20862.stderr
src/test/ui/block-result/issue-22645.stderr
src/test/ui/block-result/issue-3563.stderr
src/test/ui/block-result/issue-5500.stderr
src/test/ui/block-result/unexpected-return-on-unit.stderr
src/test/ui/closure_context/issue-26046-fn-mut.stderr
src/test/ui/closure_context/issue-26046-fn-once.stderr
src/test/ui/coercion-missing-tail-expected-type.stderr
src/test/ui/did_you_mean/issue-40006.stderr
src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr
src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr
src/test/ui/impl-trait/method-suggestion-no-duplication.stderr
src/test/ui/impl-trait/no-method-suggested-traits.stderr
src/test/ui/impl-trait/trait_type.stderr
src/test/ui/interior-mutability/interior-mutability.stderr
src/test/ui/issue-22644.stderr
src/test/ui/issue-26548.stderr
src/test/ui/issue-33525.rs [new file with mode: 0644]
src/test/ui/issue-33525.stderr [new file with mode: 0644]
src/test/ui/issue-38875/issue_38875.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr
src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr
src/test/ui/lint/outer-forbid.stderr
src/test/ui/mismatched_types/E0281.stderr
src/test/ui/mismatched_types/E0409.stderr
src/test/ui/mismatched_types/binops.stderr
src/test/ui/mismatched_types/closure-arg-count.stderr
src/test/ui/mismatched_types/for-loop-has-unit-body.stderr
src/test/ui/mismatched_types/issue-36053-2.stderr
src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
src/test/ui/missing-items/m2.stderr
src/test/ui/resolve/token-error-correct-3.stderr
src/test/ui/shadowed-type-parameter.stderr
src/test/ui/span/impl-wrong-item-for-trait.stderr
src/test/ui/span/issue-34264.stderr
src/test/ui/transmute/main.stderr
src/test/ui/transmute/transmute-from-fn-item-types-error.stderr
src/test/ui/transmute/transmute-type-parameters.stderr
src/test/ui/type-check/assignment-in-if.stderr

index ce5d58f5800c788c413d98bd42e087e72ec086c4..b347a93185124b21852a2c51c377885b52b1d82b 100644 (file)
@@ -28,6 +28,7 @@
 use syntax::ptr::P;
 use syntax_pos::Span;
 use errors::DiagnosticBuilder;
+use util::common::ErrorReported;
 use util::nodemap::{NodeMap, NodeSet, FxHashSet, FxHashMap, DefIdMap};
 use rustc_back::slice;
 
@@ -255,7 +256,7 @@ struct ElisionFailureInfo {
 
 pub fn krate(sess: &Session,
              hir_map: &Map)
-             -> Result<NamedRegionMap, usize> {
+             -> Result<NamedRegionMap, ErrorReported> {
     let krate = hir_map.krate();
     let mut map = NamedRegionMap {
         defs: NodeMap(),
index fb513f573d7e2bf83465b9c3aa1c1bd73888982c..8bafdda234a09b1589a30b7314f8d156a9e8b961 100644 (file)
@@ -21,7 +21,7 @@
 use session::config::DebugInfoLevel;
 use ty::tls;
 use util::nodemap::{FxHashMap, FxHashSet};
-use util::common::duration_to_secs_str;
+use util::common::{duration_to_secs_str, ErrorReported};
 
 use syntax::ast::NodeId;
 use errors::{self, DiagnosticBuilder};
@@ -255,7 +255,10 @@ pub fn has_errors(&self) -> bool {
     pub fn abort_if_errors(&self) {
         self.diagnostic().abort_if_errors();
     }
-    pub fn track_errors<F, T>(&self, f: F) -> Result<T, usize>
+    pub fn compile_status(&self) -> Result<(), CompileIncomplete> {
+        compile_result_from_err_count(self.err_count())
+    }
+    pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorReported>
         where F: FnOnce() -> T
     {
         let old_count = self.err_count();
@@ -264,7 +267,7 @@ pub fn track_errors<F, T>(&self, f: F) -> Result<T, usize>
         if errors == 0 {
             Ok(result)
         } else {
-            Err(errors)
+            Err(ErrorReported)
         }
     }
     pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
@@ -802,15 +805,23 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) {
     handler.emit(&MultiSpan::new(), msg, errors::Level::Warning);
 }
 
-// Err(0) means compilation was stopped, but no errors were found.
-// This would be better as a dedicated enum, but using try! is so convenient.
-pub type CompileResult = Result<(), usize>;
+#[derive(Copy, Clone, Debug)]
+pub enum CompileIncomplete {
+    Stopped,
+    Errored(ErrorReported)
+}
+impl From<ErrorReported> for CompileIncomplete {
+    fn from(err: ErrorReported) -> CompileIncomplete {
+        CompileIncomplete::Errored(err)
+    }
+}
+pub type CompileResult = Result<(), CompileIncomplete>;
 
 pub fn compile_result_from_err_count(err_count: usize) -> CompileResult {
     if err_count == 0 {
         Ok(())
     } else {
-        Err(err_count)
+        Err(CompileIncomplete::Errored(ErrorReported))
     }
 }
 
index 98278949d51fd43ebe6ed8dec2d0bd4ce4d7200a..a3e1cf7c1a8f81427179929d7bc6fb618d9008f0 100644 (file)
@@ -13,7 +13,8 @@
 use rustc::ich::Fingerprint;
 use rustc_data_structures::stable_hasher::StableHasher;
 use rustc_mir as mir;
-use rustc::session::{Session, CompileResult, compile_result_from_err_count};
+use rustc::session::{Session, CompileResult};
+use rustc::session::CompileIncomplete;
 use rustc::session::config::{self, Input, OutputFilenames, OutputType,
                              OutputTypes};
 use rustc::session::search_paths::PathKind;
@@ -23,7 +24,7 @@
 use rustc::mir::transform::{MIR_CONST, MIR_VALIDATED, MIR_OPTIMIZED, Passes};
 use rustc::ty::{self, TyCtxt, Resolutions, GlobalArenas};
 use rustc::traits;
-use rustc::util::common::time;
+use rustc::util::common::{ErrorReported, time};
 use rustc::util::nodemap::NodeSet;
 use rustc::util::fs::rename_or_copy_remove;
 use rustc_borrowck as borrowck;
@@ -78,7 +79,9 @@ macro_rules! controller_entry_point {
             }
 
             if control.$point.stop == Compilation::Stop {
-                return compile_result_from_err_count($tsess.err_count());
+                // FIXME: shouldn't this return Err(CompileIncomplete::Stopped)
+                // if there are no errors?
+                return $tsess.compile_status();
             }
         }}
     }
@@ -91,7 +94,7 @@ macro_rules! controller_entry_point {
             Ok(krate) => krate,
             Err(mut parse_error) => {
                 parse_error.emit();
-                return Err(1);
+                return Err(CompileIncomplete::Errored(ErrorReported));
             }
         };
 
@@ -194,7 +197,7 @@ macro_rules! controller_entry_point {
                 (control.after_analysis.callback)(&mut state);
 
                 if control.after_analysis.stop == Compilation::Stop {
-                    return result.and_then(|_| Err(0usize));
+                    return result.and_then(|_| Err(CompileIncomplete::Stopped));
                 }
             }
 
@@ -564,7 +567,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
                                        addl_plugins: Option<Vec<String>>,
                                        make_glob_map: MakeGlobMap,
                                        after_expand: F)
-                                       -> Result<ExpansionResult, usize>
+                                       -> Result<ExpansionResult, CompileIncomplete>
     where F: FnOnce(&ast::Crate) -> CompileResult,
 {
     let time_passes = sess.time_passes();
@@ -636,7 +639,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
     // Lint plugins are registered; now we can process command line flags.
     if sess.opts.describe_lints {
         super::describe_lints(&sess.lint_store.borrow(), true);
-        return Err(0);
+        return Err(CompileIncomplete::Stopped);
     }
     sess.track_errors(|| sess.lint_store.borrow_mut().process_command_line(sess))?;
 
@@ -839,7 +842,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
                                                arenas: &'tcx GlobalArenas<'tcx>,
                                                name: &str,
                                                f: F)
-                                               -> Result<R, usize>
+                                               -> Result<R, CompileIncomplete>
     where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>,
                             ty::CrateAnalysis,
                             IncrementalHashesMap,
@@ -1019,7 +1022,7 @@ macro_rules! try_with_f {
         // lint warnings and so on -- kindck used to do this abort, but
         // kindck is gone now). -nmatsakis
         if sess.err_count() > 0 {
-            return Ok(f(tcx, analysis, incremental_hashes_map, Err(sess.err_count())));
+            return Ok(f(tcx, analysis, incremental_hashes_map, sess.compile_status()));
         }
 
         analysis.reachable =
@@ -1035,12 +1038,7 @@ macro_rules! try_with_f {
 
         time(time_passes, "lint checking", || lint::check_crate(tcx));
 
-        // The above three passes generate errors w/o aborting
-        if sess.err_count() > 0 {
-            return Ok(f(tcx, analysis, incremental_hashes_map, Err(sess.err_count())));
-        }
-
-        Ok(f(tcx, analysis, incremental_hashes_map, Ok(())))
+        return Ok(f(tcx, analysis, incremental_hashes_map, tcx.sess.compile_status()));
     })
 }
 
@@ -1116,11 +1114,7 @@ pub fn phase_5_run_llvm_passes(sess: &Session,
          "serialize work products",
          move || rustc_incremental::save_work_products(sess));
 
-    if sess.err_count() > 0 {
-        Err(sess.err_count())
-    } else {
-        Ok(())
-    }
+    sess.compile_status()
 }
 
 /// Run the linker on any artifacts that resulted from the LLVM run.
index 061e21fadebd62ab8b0d189d9dbd03cd31bf417a..f2aacbc629fad9351705af9cffebadab1e9fe514 100644 (file)
@@ -67,6 +67,7 @@
 use rustc_trans::back::write::{RELOC_MODEL_ARGS, CODE_GEN_MODEL_ARGS};
 use rustc::dep_graph::DepGraph;
 use rustc::session::{self, config, Session, build_session, CompileResult};
+use rustc::session::CompileIncomplete;
 use rustc::session::config::{Input, PrintRequest, OutputType, ErrorOutputType};
 use rustc::session::config::nightly_options;
 use rustc::session::{early_error, early_warn};
@@ -74,7 +75,7 @@
 use rustc::lint;
 use rustc_metadata::locator;
 use rustc_metadata::cstore::CStore;
-use rustc::util::common::time;
+use rustc::util::common::{time, ErrorReported};
 
 use serialize::json::ToJson;
 
 const BUG_REPORT_URL: &'static str = "https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.\
                                       md#bug-reports";
 
-#[inline]
-fn abort_msg(err_count: usize) -> String {
-    match err_count {
-        0 => "aborting with no errors (maybe a bug?)".to_owned(),
-        1 => "aborting due to previous error".to_owned(),
-        e => format!("aborting due to {} previous errors", e),
-    }
-}
-
-pub fn abort_on_err<T>(result: Result<T, usize>, sess: &Session) -> T {
+pub fn abort_on_err<T>(result: Result<T, CompileIncomplete>, sess: &Session) -> T {
     match result {
-        Err(err_count) => {
-            sess.fatal(&abort_msg(err_count));
+        Err(CompileIncomplete::Errored(ErrorReported)) => {
+            sess.abort_if_errors();
+            panic!("error reported but abort_if_errors didn't abort???");
+        }
+        Err(CompileIncomplete::Stopped) => {
+            sess.fatal("compilation terminated");
         }
         Ok(x) => x,
     }
@@ -132,19 +128,20 @@ pub fn run<F>(run_compiler: F) -> isize
 {
     monitor(move || {
         let (result, session) = run_compiler();
-        if let Err(err_count) = result {
-            if err_count > 0 {
-                match session {
-                    Some(sess) => sess.fatal(&abort_msg(err_count)),
-                    None => {
-                        let emitter =
-                            errors::emitter::EmitterWriter::stderr(errors::ColorConfig::Auto, None);
-                        let handler = errors::Handler::with_emitter(true, false, Box::new(emitter));
-                        handler.emit(&MultiSpan::new(),
-                                     &abort_msg(err_count),
-                                     errors::Level::Fatal);
-                        exit_on_err();
-                    }
+        if let Err(CompileIncomplete::Errored(_)) = result {
+            match session {
+                Some(sess) => {
+                    sess.abort_if_errors();
+                    panic!("error reported but abort_if_errors didn't abort???");
+                }
+                None => {
+                    let emitter =
+                        errors::emitter::EmitterWriter::stderr(errors::ColorConfig::Auto, None);
+                    let handler = errors::Handler::with_emitter(true, false, Box::new(emitter));
+                    handler.emit(&MultiSpan::new(),
+                                 "aborting due to previous error(s)",
+                                 errors::Level::Fatal);
+                    exit_on_err();
                 }
             }
         }
index 8d455adc23c99d95b500988fec69e1874f192d79..0dbb2d1d4d0bf8e6183c295fb1b5cc79f226475e 100644 (file)
@@ -12,8 +12,9 @@
 // recursively.
 
 use rustc::hir::map as hir_map;
-use rustc::session::{CompileResult, Session};
+use rustc::session::Session;
 use rustc::hir::def::{Def, CtorKind};
+use rustc::util::common::ErrorReported;
 use rustc::util::nodemap::{NodeMap, NodeSet};
 
 use syntax::ast;
@@ -86,7 +87,9 @@ fn visit_impl_item(&mut self, ii: &'hir hir::ImplItem) {
     }
 }
 
-pub fn check_crate<'hir>(sess: &Session, hir_map: &hir_map::Map<'hir>) -> CompileResult {
+pub fn check_crate<'hir>(sess: &Session, hir_map: &hir_map::Map<'hir>)
+                         -> Result<(), ErrorReported>
+{
     let mut visitor = CheckCrateVisitor {
         sess: sess,
         hir_map: hir_map,
index 0dfd9a1838e5a3fa524542c6c6ec8395c0ead180..3241267bbc2e48d55c78bbe00a4997819912cf3b 100644 (file)
 use rustc::ty::util::{Representability, IntTypeExt};
 use errors::DiagnosticBuilder;
 use require_c_abi_if_variadic;
-use session::{Session, CompileResult};
+use session::{CompileIncomplete, Session};
 use TypeAndSubsts;
 use lint;
 use util::common::{ErrorReported, indenter};
@@ -691,30 +691,32 @@ fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem) { }
     fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { }
 }
 
-pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
+pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> {
     tcx.sess.track_errors(|| {
         let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
         tcx.hir.krate().visit_all_item_likes(&mut visit.as_deep_visitor());
     })
 }
 
-pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
+pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> {
     tcx.sess.track_errors(|| {
         tcx.hir.krate().visit_all_item_likes(&mut CheckItemTypesVisitor { tcx });
     })
 }
 
-pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> CompileResult {
+pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), CompileIncomplete> {
     tcx.typeck_item_bodies(LOCAL_CRATE)
 }
 
-fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> CompileResult {
+fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum)
+                                -> Result<(), CompileIncomplete>
+{
     debug_assert!(crate_num == LOCAL_CRATE);
-    tcx.sess.track_errors(|| {
+    Ok(tcx.sess.track_errors(|| {
         for body_owner_def_id in tcx.body_owners() {
             tcx.typeck_tables_of(body_owner_def_id);
         }
-    })
+    })?)
 }
 
 pub fn provide(providers: &mut Providers) {
index 2857b5fb5e05e3c7c61ef9c5e3eeac07680ca29e..9b829e6e3ff2ed8cbf1ec6502dac208ffc72e6b0 100644 (file)
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::maps::Providers;
 use rustc::traits::{FulfillmentContext, ObligationCause, ObligationCauseCode, Reveal};
-use session::config;
+use session::{CompileIncomplete, config};
 use util::common::time;
 
 use syntax::ast;
@@ -293,7 +293,8 @@ pub fn provide(providers: &mut Providers) {
 }
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
-                             -> Result<(), usize> {
+                             -> Result<(), CompileIncomplete>
+{
     let time_passes = tcx.sess.time_passes();
 
     // this ensures that later parts of type checking can assume that items
@@ -328,12 +329,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
     check_unused::check_crate(tcx);
     check_for_entry_fn(tcx);
 
-    let err_count = tcx.sess.err_count();
-    if err_count == 0 {
-        Ok(())
-    } else {
-        Err(err_count)
-    }
+    tcx.sess.compile_status()
 }
 
 /// A quasi-deprecated helper used in rustdoc and save-analysis to get
index 4766778eed1b88bc00b505f708ad78b39bc83b97..f012fd974b574267d28841be6f870741872dca58 100644 (file)
@@ -25,7 +25,7 @@
 use rustc::dep_graph::DepGraph;
 use rustc::hir;
 use rustc::hir::intravisit;
-use rustc::session::{self, config};
+use rustc::session::{self, CompileIncomplete, config};
 use rustc::session::config::{OutputType, OutputTypes, Externs};
 use rustc::session::search_paths::{SearchPaths, PathKind};
 use rustc_back::dynamic_lib::DynamicLibrary;
@@ -253,35 +253,25 @@ fn drop(&mut self) {
         driver::compile_input(&sess, &cstore, &input, &out, &None, None, &control)
     }));
 
-    match res {
-        Ok(r) => {
-            match r {
-                Err(count) => {
-                    if count > 0 && !compile_fail {
-                        sess.fatal("aborting due to previous error(s)")
-                    } else if count == 0 && compile_fail {
-                        panic!("test compiled while it wasn't supposed to")
-                    }
-                    if count > 0 && error_codes.len() > 0 {
-                        let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
-                        error_codes.retain(|err| !out.contains(err));
-                    }
-                }
-                Ok(()) if compile_fail => {
-                    panic!("test compiled while it wasn't supposed to")
-                }
-                _ => {}
-            }
+    let compile_result = match res {
+        Ok(Ok(())) | Ok(Err(CompileIncomplete::Stopped)) => Ok(()),
+        Err(_) | Ok(Err(CompileIncomplete::Errored(_))) => Err(())
+    };
+
+    match (compile_result, compile_fail) {
+        (Ok(()), true) => {
+            panic!("test compiled while it wasn't supposed to")
         }
-        Err(_) => {
-            if !compile_fail {
-                panic!("couldn't compile the test");
-            }
+        (Ok(()), false) => {}
+        (Err(()), true) => {
             if error_codes.len() > 0 {
                 let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
                 error_codes.retain(|err| !out.contains(err));
             }
         }
+        (Err(()), false) => {
+            panic!("couldn't compile the test")
+        }
     }
 
     if error_codes.len() > 0 {
index ca58e007852bd53fe0216330256284544bbe33da..a75dc7e57a9a265526af8b83134ee1b4dc0581e0 100644 (file)
@@ -85,6 +85,6 @@ fn main() {
     let (result, _) = rustc_driver::run_compiler(
         &args, &mut JitCalls, Some(box JitLoader), None);
     if let Err(n) = result {
-        panic!("Error {}", n);
+        panic!("Error {:?}", n);
     }
 }
index a770ebeab35a7acc863dac283e06dec7fda01f42..d4024f41c26fa4e4f30b604822baa8ed7c175c70 100644 (file)
@@ -7,5 +7,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `bool`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index b1146864566e33ec54fa13681c0c8e2a24c11929..f60a0c2e5f6e00f017d93882debb11da567f4f9b 100644 (file)
@@ -7,5 +7,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `bool`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 31ec7cdd3c5abc39a10d9b8b5cc2f2c10518149a..888a64c1bb1aa61a0a8d383c37b834bf276d7f85 100644 (file)
@@ -7,5 +7,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `bool`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 282583d32a665dcaa0568e9276a3e7d9c41dedf8..5905cfa9322a28ab753701cb9c8e07deec9d52a9 100644 (file)
@@ -26,5 +26,5 @@ error[E0308]: mismatched types
    = note: expected type `std::string::String`
               found type `()`
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index ed61ec6ca291f5062e7ff7fe4673be389ab45ee3..376834beab0dacfc4a6b9661dbd862c1d02a3caf 100644 (file)
@@ -13,5 +13,5 @@ error[E0308]: mismatched types
    = note: expected type `i32`
               found type `()`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 5e8d92f64e29344d7389d6f932d5a89c5dd64d50..7bd4529c46399a1a600d99b23816f43d68a1d873 100644 (file)
@@ -29,5 +29,5 @@ error[E0308]: mismatched types
    = note: expected type `std::string::String`
               found type `()`
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index 72ff859d7e93a0f71bbbafcb25e79b5e804038bb..41113eb7a573e6b741508415238ce192cf9ef16c 100644 (file)
@@ -16,5 +16,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `a::Enum`
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index e4367f170ce1856dbb33c6660800e6aeb2b23171..7c88d789fd36eeb55fb971886484b42bc5f1a066 100644 (file)
@@ -15,5 +15,5 @@ error[E0618]: expected function, found `()`
 17 |     let x = foo(5)(2);
    |             ^^^^^^^^^
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index 3921a301c922393d5d7af0fb2230d7398970983b..a9bcc8bea94cc177d0ebb793ae6025d0c640fa55 100644 (file)
@@ -17,5 +17,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `Bob`
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index c6ab4cbb2a7c5e0d22175085a222af9123c0366c..4b1f8b032b74d1d257548b606c48c440b0e08390 100644 (file)
@@ -15,5 +15,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `[closure@$DIR/issue-3563.rs:13:9: 13:20 self:_]`
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index bffe2a82ca8d756961d54f284a0efbc2beff9928..bd670a14f247e7f6b0e58410b3d091c3da8559cf 100644 (file)
@@ -7,5 +7,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `&_`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 18d0cc4814056f94d93958568a4c2a8c28056a1a..68afd2084f10568dbcf09cacddc4afb3c25b1c8b 100644 (file)
@@ -11,5 +11,5 @@ help: did you mean to add a semicolon here?
 help: possibly return type missing here?
    | fn bar() -> usize {
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index dbf702e45030901ab56212e99e62c9abff739825..42fc2909dfb5a2846a1cb942ae9679e05fa52ab5 100644 (file)
@@ -16,5 +16,5 @@ note: closure is `FnMut` because it mutates the variable `num` here
 15 |         num += 1;
    |         ^^^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 3ec3f0cc9aa598ec676ddc38b4e6e840b9ec6a5a..7bfe72d3d6c9c8fbcac796e7638ba881507e2997 100644 (file)
@@ -16,5 +16,5 @@ note: closure is `FnOnce` because it moves the variable `vec` out of its environ
 15 |         vec
    |         ^^^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 5f9a82d972aceb660e2464fca070030c4f10f73c..0de0a25e68e24c0d0e63672fc5ed271e6533b7c8 100644 (file)
@@ -24,5 +24,5 @@ error[E0308]: mismatched types
    = note: expected type `std::result::Result<u8, u64>`
               found type `()`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
index 8e8773eba3e222feb5c31bbe4f2029a69ef5df5d..3b7f32cf8904a33a90898124898c3477e49b3010 100644 (file)
@@ -64,5 +64,5 @@ error[E0038]: the trait `X` cannot be made into an object
    |
    = note: method `xxx` has no receiver
 
-error: aborting due to previous error
+error: aborting due to 9 previous errors
 
index c4858b63c2d930e4a3af534edf1961a4e17386f8..498255cb9ea374cc905dab9cc6369144b4725e70 100644 (file)
@@ -18,5 +18,5 @@ error[E0038]: the trait `std::marker::Copy` cannot be made into an object
    |
    = note: the trait cannot require that `Self : Sized`
 
-error: aborting due to previous error
+error: aborting due to 3 previous errors
 
index 1b1e0eaf2039a52ad7a28d1e61d6f07a8a4360fd..3bc281726ef3a9563669869116afd1f88a6506c2 100644 (file)
@@ -8,5 +8,5 @@ error[E0599]: no method named `foo` found for type `Bar` in the current scope
    = note: the following trait defines an item `foo`, perhaps you need to implement it:
            candidate #1: `Foo`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index fa08c3bee9cf356c8538bca589bcc0dbd6c9a08d..d3dbb77490b8730cff9a5fc09ac2d7eccf09079d 100644 (file)
@@ -10,5 +10,5 @@ error[E0599]: no method named `is_empty` found for type `Foo` in the current sco
            candidate #2: `core::slice::SliceExt`
            candidate #3: `core::str::StrExt`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 95d3007a4fb218e2982727b21ef52146e45cc850..fc441f94842731d7b65ca8044615e91d6c1168e4 100644 (file)
@@ -226,5 +226,5 @@ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::bo
 131 |     std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
     |                                                                          ^^^^^^^
 
-error: aborting due to previous error(s)
+error: aborting due to 24 previous errors
 
index cc7a7153a3859098837fd18e067486451cf49451..9216c6e290775163b731ee3c03d9fa68ffd820a6 100644 (file)
@@ -31,5 +31,5 @@ error[E0046]: not all trait items implemented, missing: `fmt`
    |
    = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
 
-error: aborting due to previous error(s)
+error: aborting due to 4 previous errors
 
index a9535f1c8303884ff6e63919c0e16a2c7543b0eb..76362f1f494a6bb8b96a0e230869f72d6d5e501d 100644 (file)
@@ -10,5 +10,5 @@ error[E0277]: the trait bound `std::cell::UnsafeCell<i32>: std::panic::RefUnwind
    = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:15:18: 15:35 x:&std::cell::Cell<i32>]`
    = note: required by `std::panic::catch_unwind`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index a22496357d9915f12528a5839f563744fdfff490..22c16ada05de468757a87ec79f787039a724def9 100644 (file)
@@ -20,5 +20,5 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a com
 help: if you want to compare the casted value then write:
    |     println!("{}", (a as usize) < 4);
 
-error: aborting due to previous error(s)
+error: aborting due to 2 previous errors
 
index c27ad7680a5700696d21499d346dd8da95f5de72..8bfe4ac733b6d91c97d783b55e6a20fa95af4f4f 100644 (file)
@@ -5,5 +5,5 @@ note: ...which then requires computing layout of `std::option::Option<<S as Mirr
 note: ...which then requires computing layout of `<S as Mirror>::It`...
   = note: ...which then again requires computing layout of `S`, completing the cycle.
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
diff --git a/src/test/ui/issue-33525.rs b/src/test/ui/issue-33525.rs
new file mode 100644 (file)
index 0000000..0e777fe
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    a;
+    "".lorem;
+    "".ipsum;
+}
diff --git a/src/test/ui/issue-33525.stderr b/src/test/ui/issue-33525.stderr
new file mode 100644 (file)
index 0000000..5de2d98
--- /dev/null
@@ -0,0 +1,20 @@
+error[E0425]: cannot find value `a` in this scope
+  --> $DIR/issue-33525.rs:12:5
+   |
+12 |     a;
+   |     ^ not found in this scope
+
+error[E0609]: no field `lorem` on type `&'static str`
+  --> $DIR/issue-33525.rs:13:8
+   |
+13 |     "".lorem;
+   |        ^^^^^
+
+error[E0609]: no field `ipsum` on type `&'static str`
+  --> $DIR/issue-33525.rs:14:8
+   |
+14 |     "".ipsum;
+   |        ^^^^^
+
+error: aborting due to 3 previous errors
+
index ceed83d9313cdbe14cf928eb1558593b0da77397..10bb61ee22a610819bded82ee3e6954f6eef1c9d 100644 (file)
@@ -10,5 +10,5 @@ note: for repeat count here
 16 |     let test_x = [0; issue_38875_b::FOO];
    |                      ^^^^^^^^^^^^^^^^^^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 4d8c5e039af418846ed2476fe098e08ce4ddc445..83716b7791d83cac3a6f0046efbbb35909641234 100644 (file)
@@ -6,5 +6,5 @@ error[E0621]: explicit lifetime required in the type of `x`
 12 |     if x > y { x } else { y }
    |                ^ lifetime `'a` required
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 07b276601f47cef82517949e2908b28265b3f0ea..6d5e94a5e78adc8ead80a8c8aaaf3b4200f2df74 100644 (file)
@@ -6,5 +6,5 @@ error[E0621]: explicit lifetime required in parameter type
 12 |     if x > y { x } else { y }
    |                           ^ lifetime `'a` required
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 2adf0cd762c59b342f855438fbe5b3310b256f61..4288fdf89a41732a973360a903f0d7f8e7a498a0 100644 (file)
@@ -6,5 +6,5 @@ error[E0621]: explicit lifetime required in the type of `x`
 14 |    if x > y { x } else { y }
    |               ^ lifetime `'a` required
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 15825017d15c3edd9aada9447f00ee275a5435e9..95076bfbdc7dae548671a589ad9336a8d2bc5b7f 100644 (file)
@@ -7,5 +7,5 @@ error[E0621]: explicit lifetime required in the type of `x`
 18 |     if true { &self.field } else { x }
    |                                    ^ lifetime `'a` required
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 15ecca618052e25ce49b1b907b04dbda29e0a7c8..9e4f6c421790f5533ec266de0fd8647442b62a7c 100644 (file)
@@ -23,5 +23,5 @@ note: ...but the borrowed content is only valid for the anonymous lifetime #1 de
 23 | |     }
    | |_____^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 471b3401827d8106050281770a56350fa5b091d4..e3fd0192053b93547ce06af04fc2aabdcefb2328 100644 (file)
@@ -23,5 +23,5 @@ note: ...but the borrowed content is only valid for the lifetime 'a as defined o
 20 | |   }
    | |___^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 46fc43eaf5756fa0524dca41aab65e33f554f38b..8551f015db52772b2fe9349fa5aac4b6701ca0b8 100644 (file)
@@ -23,5 +23,5 @@ note: ...but the borrowed content is only valid for the anonymous lifetime #1 de
 20 | |     }
    | |_____^
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index ea696c51d62188ece63e4d106e3b6f612d02e005..8dba0c33f201a381e7a741f2fcb7d51467085956 100644 (file)
@@ -6,5 +6,5 @@ error[E0621]: explicit lifetime required in the type of `x`
 16 |     y.push(x);
    |            ^ lifetime `'a` required
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 831b3f65634b2b805485b8dfbe8dd3dfe1899c43..df62f5acc00748712e059522e358bbad9fd04bb2 100644 (file)
@@ -25,5 +25,5 @@ error[E0453]: allow(bad_style) overruled by outer forbid(non_snake_case)
 19 | #[allow(unused, unused_variables, bad_style)]
    |                                   ^^^^^^^^^ overruled by previous forbid
 
-error: aborting due to previous error(s)
+error: aborting due to 3 previous errors
 
index 8a306ea41929a49ca4f9060b0b36954843818864..887412d1be7af5eba8acc1b40d44032c84e2cd27 100644 (file)
@@ -9,5 +9,5 @@ error[E0281]: type mismatch: `[closure@$DIR/E0281.rs:14:9: 14:24]` implements th
    |
    = note: required by `foo`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 45a42b1c271f8678920ca841580d814aa62f6498..cc7c01790706a02ea69c6bcf8617fb1252d638c6 100644 (file)
@@ -15,5 +15,5 @@ error[E0308]: mismatched types
    = note: expected type `&{integer}`
               found type `{integer}`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
index bb90a19a3ba4d7f830e9e3405da2ecba0edea6f8..6d1a39e0d93c04554f7ccec483b0fa05226deeb4 100644 (file)
@@ -46,5 +46,5 @@ error[E0277]: the trait bound `{integer}: std::cmp::PartialEq<std::result::Resul
    |
    = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}`
 
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
 
index f2509040b006ce0a52b8564a130d10b2dffbe3c9..ca71154e872ee9ae7af4753f3c3f1b2705b5f3b7 100644 (file)
@@ -31,5 +31,5 @@ error[E0593]: closure takes 1 argument but 2 arguments are required
    |               |
    |               expected closure that takes 2 arguments
 
-error: aborting due to 7 previous errors
+error: aborting due to 4 previous errors
 
index 6787fe91bf30847efb0b341f3c18d04db2151a44..4a619804a6c5d6722d5a661e22a38da1af73d071 100644 (file)
@@ -7,5 +7,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `{integer}`
 
-error: aborting due to previous error(s)
+error: aborting due to previous error
 
index 88309ab146fa5e390438defd251256a03f511a05..51acdb719b69afc04c5e7bab30235d01c2a4b57e 100644 (file)
@@ -17,5 +17,5 @@ error[E0281]: type mismatch: `[closure@$DIR/issue-36053-2.rs:17:39: 17:53]` impl
    |                                requires `for<'r> std::ops::FnMut<(&'r &str,)>`
    |                                expected &str, found str
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
index 4ba6dc7302316bae0e0676a68c6901fd3e04a68f..995a12584547734a84abf2a68dec2b2aba38c496 100644 (file)
@@ -12,5 +12,5 @@ error[E0281]: type mismatch: `[closure@$DIR/unboxed-closures-vtable-mismatch.rs:
    |
    = note: required by `call_it`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index b7ba5efacc4eabdc4c8eab780823d9070c4cff35..51afb95b89611d3583d4c4c7c740baa29b0eea3a 100644 (file)
@@ -11,5 +11,5 @@ error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `met
    = note: `Type` from trait: `type Type;`
    = note: `method` from trait: `fn(&Self, std::string::String) -> <Self as m1::X>::Type`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
index 4384822f404892dafce7228e6b7a334b9c2f955f..bd3bdf35da60900c2874febe3b10297e56118457 100644 (file)
@@ -42,5 +42,5 @@ error[E0308]: mismatched types
    = note: expected type `()`
               found type `std::result::Result<bool, std::io::Error>`
 
-error: aborting due to previous error
+error: aborting due to 5 previous errors
 
index d77523299bc29c5cc2674b7b73abee5b54d358f4..a16a9c0244fb6dd18d1bb1a37cb0b258566387b1 100644 (file)
@@ -24,5 +24,5 @@ error[E0194]: type parameter `T` shadows another type parameter of the same name
 18 |     fn shadow_in_method<T>(&self) {}
    |                         ^ shadows another type parameter
 
-error: aborting due to previous error(s)
+error: aborting due to 3 previous errors
 
index ae290b3b11aa79c5df19475fbd03aaab7ed839b1..2c4c6a148d7b37ec107ecd6b73665a675048f371 100644 (file)
@@ -85,5 +85,5 @@ error[E0046]: not all trait items implemented, missing: `fmt`
    |
    = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
 
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
 
index 98183e2f082e9f55b33da1dd5443306de6041d29..e25caacac8febed524fc3dbcf11b6a26fd65e0ea 100644 (file)
@@ -45,5 +45,5 @@ error[E0061]: this function takes 2 parameters but 3 parameters were supplied
 19 |     bar(1, 2, 3);
    |         ^^^^^^^ expected 2 parameters
 
-error: aborting due to 3 previous errors
+error: aborting due to 6 previous errors
 
index c5d5a4ed8a6239631d2985df674f9002414779c4..a7fc0808e184557153feae0b4d62e36b0ac95fcb 100644 (file)
@@ -34,5 +34,5 @@ error[E0512]: transmute called with types of different sizes
    = note: source type: i32 (32 bits)
    = note: target type: Foo (0 bits)
 
-error: aborting due to previous error(s)
+error: aborting due to 4 previous errors
 
index 61ee5cf61283fa2937b16ad0307a40b46d72a679..7f1929050bb8fc33275a1032453ed3642b77e79f 100644 (file)
@@ -104,5 +104,5 @@ error[E0512]: transmute called with types of different sizes
    = note: source type: std::option::Option<fn()> (64 bits)
    = note: target type: u32 (32 bits)
 
-error: aborting due to previous error(s)
+error: aborting due to 11 previous errors
 
index bb21cfd3e4c9d462adc5b1e731f22a13a86c2982..816c62812f31f7541cff0a60ad2c80a22397358e 100644 (file)
@@ -52,5 +52,5 @@ error[E0512]: transmute called with types of different sizes
    = note: source type: std::option::Option<T> (size can vary because of T)
    = note: target type: i32 (32 bits)
 
-error: aborting due to previous error(s)
+error: aborting due to 6 previous errors
 
index 294399992732233a541ce4899456667b22e00fc1..a077f37eae6eeff367197194391b25a1c93122de 100644 (file)
@@ -55,5 +55,5 @@ error[E0308]: mismatched types
    = note: expected type `bool`
               found type `()`
 
-error: aborting due to previous error(s)
+error: aborting due to 5 previous errors