diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index ce5d58f5800c7..b347a93185124 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -28,6 +28,7 @@ use syntax::attr; 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 @@ const ROOT_SCOPE: ScopeRef<'static> = &Scope::Root; pub fn krate(sess: &Session, hir_map: &Map) - -> Result { + -> Result { let krate = hir_map.krate(); let mut map = NamedRegionMap { defs: NodeMap(), diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index fb513f573d7e2..8bafdda234a09 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -21,7 +21,7 @@ use session::search_paths::PathKind; 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 @@ impl Session { pub fn abort_if_errors(&self) { self.diagnostic().abort_if_errors(); } - pub fn track_errors(&self, f: F) -> Result + pub fn compile_status(&self) -> Result<(), CompileIncomplete> { + compile_result_from_err_count(self.err_count()) + } + pub fn track_errors(&self, f: F) -> Result where F: FnOnce() -> T { let old_count = self.err_count(); @@ -264,7 +267,7 @@ impl Session { if errors == 0 { Ok(result) } else { - Err(errors) + Err(ErrorReported) } } pub fn span_warn>(&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 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)) } } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 98278949d51fd..a3e1cf7c1a8f8 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -13,7 +13,8 @@ use rustc::hir::lowering::lower_crate; 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::middle::privacy::AccessLevels; 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 @@ pub fn compile_input(sess: &Session, } 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 @@ pub fn compile_input(sess: &Session, Ok(krate) => krate, Err(mut parse_error) => { parse_error.emit(); - return Err(1); + return Err(CompileIncomplete::Errored(ErrorReported)); } }; @@ -194,7 +197,7 @@ pub fn compile_input(sess: &Session, (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(sess: &Session, addl_plugins: Option>, make_glob_map: MakeGlobMap, after_expand: F) - -> Result + -> Result where F: FnOnce(&ast::Crate) -> CompileResult, { let time_passes = sess.time_passes(); @@ -636,7 +639,7 @@ pub fn phase_2_configure_and_expand(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 + -> Result where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>, ty::CrateAnalysis, IncrementalHashesMap, @@ -1019,7 +1022,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, // 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 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, 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. diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 061e21fadebd6..f2aacbc629fad 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -67,6 +67,7 @@ use rustc_trans::back::link; 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::Lint; 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; @@ -109,19 +110,14 @@ mod derive_registrar; 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(result: Result, sess: &Session) -> T { +pub fn abort_on_err(result: Result, 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(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(); } } } diff --git a/src/librustc_passes/static_recursion.rs b/src/librustc_passes/static_recursion.rs index 8d455adc23c99..0dbb2d1d4d0bf 100644 --- a/src/librustc_passes/static_recursion.rs +++ b/src/librustc_passes/static_recursion.rs @@ -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 @@ impl<'a, 'hir: 'a> Visitor<'hir> for CheckCrateVisitor<'a, 'hir> { } } -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, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 0dfd9a1838e5a..3241267bbc2e4 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -102,7 +102,7 @@ use rustc::ty::maps::Providers; 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 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { 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) { diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 2857b5fb5e05e..9b829e6e3ff2e 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -108,7 +108,7 @@ use rustc::ty::subst::Substs; 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 diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 4766778eed1b8..f012fd974b574 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -25,7 +25,7 @@ use rustc_lint; 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 runtest(test: &str, cratename: &str, cfgs: Vec, libs: SearchPaths, 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 { diff --git a/src/test/run-make/llvm-phase/test.rs b/src/test/run-make/llvm-phase/test.rs index ca58e007852bd..a75dc7e57a9a2 100644 --- a/src/test/run-make/llvm-phase/test.rs +++ b/src/test/run-make/llvm-phase/test.rs @@ -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); } } diff --git a/src/test/ui/block-result/block-must-not-have-result-do.stderr b/src/test/ui/block-result/block-must-not-have-result-do.stderr index a770ebeab35a7..d4024f41c26fa 100644 --- a/src/test/ui/block-result/block-must-not-have-result-do.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-do.stderr @@ -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 diff --git a/src/test/ui/block-result/block-must-not-have-result-res.stderr b/src/test/ui/block-result/block-must-not-have-result-res.stderr index b1146864566e3..f60a0c2e5f6e0 100644 --- a/src/test/ui/block-result/block-must-not-have-result-res.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-res.stderr @@ -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 diff --git a/src/test/ui/block-result/block-must-not-have-result-while.stderr b/src/test/ui/block-result/block-must-not-have-result-while.stderr index 31ec7cdd3c5ab..888a64c1bb1aa 100644 --- a/src/test/ui/block-result/block-must-not-have-result-while.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-while.stderr @@ -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 diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index 282583d32a665..5905cfa9322a2 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index ed61ec6ca291f..376834beab0da 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 5e8d92f64e293..7bd4529c46399 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-13624.stderr b/src/test/ui/block-result/issue-13624.stderr index 72ff859d7e93a..41113eb7a573e 100644 --- a/src/test/ui/block-result/issue-13624.stderr +++ b/src/test/ui/block-result/issue-13624.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr index e4367f170ce18..7c88d789fd36e 100644 --- a/src/test/ui/block-result/issue-20862.stderr +++ b/src/test/ui/block-result/issue-20862.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr index 3921a301c9223..a9bcc8bea94cc 100644 --- a/src/test/ui/block-result/issue-22645.stderr +++ b/src/test/ui/block-result/issue-22645.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr index c6ab4cbb2a7c5..4b1f8b032b74d 100644 --- a/src/test/ui/block-result/issue-3563.stderr +++ b/src/test/ui/block-result/issue-3563.stderr @@ -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 diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index bffe2a82ca8d7..bd670a14f247e 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -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 diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr index 18d0cc4814056..68afd2084f105 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.stderr +++ b/src/test/ui/block-result/unexpected-return-on-unit.stderr @@ -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 diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index dbf702e450309..42fc2909dfb5a 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -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 diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index 3ec3f0cc9aa59..7bfe72d3d6c9c 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -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 diff --git a/src/test/ui/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion-missing-tail-expected-type.stderr index 5f9a82d972ace..0de0a25e68e24 100644 --- a/src/test/ui/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion-missing-tail-expected-type.stderr @@ -24,5 +24,5 @@ error[E0308]: mismatched types = note: expected type `std::result::Result` found type `()` -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index 8e8773eba3e22..3b7f32cf8904a 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -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 diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index c4858b63c2d93..498255cb9ea37 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -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 diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr index 1b1e0eaf2039a..3bc281726ef3a 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr @@ -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 diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr index fa08c3bee9cf3..d3dbb77490b87 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr @@ -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 diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index 95d3007a4fb21..fc441f9484273 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -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 diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr index cc7a7153a3859..9216c6e290775 100644 --- a/src/test/ui/impl-trait/trait_type.stderr +++ b/src/test/ui/impl-trait/trait_type.stderr @@ -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 diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index a9535f1c83038..76362f1f494a6 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -10,5 +10,5 @@ error[E0277]: the trait bound `std::cell::UnsafeCell: std::panic::RefUnwind = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:15:18: 15:35 x:&std::cell::Cell]` = note: required by `std::panic::catch_unwind` -error: aborting due to previous error(s) +error: aborting due to previous error diff --git a/src/test/ui/issue-22644.stderr b/src/test/ui/issue-22644.stderr index a22496357d991..22c16ada05de4 100644 --- a/src/test/ui/issue-22644.stderr +++ b/src/test/ui/issue-22644.stderr @@ -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 diff --git a/src/test/ui/issue-26548.stderr b/src/test/ui/issue-26548.stderr index c27ad7680a570..8bfe4ac733b6d 100644 --- a/src/test/ui/issue-26548.stderr +++ b/src/test/ui/issue-26548.stderr @@ -5,5 +5,5 @@ note: ...which then requires computing layout of `std::option::Option<::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 index 0000000000000..0e777fe8a9454 --- /dev/null +++ b/src/test/ui/issue-33525.rs @@ -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 or the MIT license +// , 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 index 0000000000000..5de2d98f86a9d --- /dev/null +++ b/src/test/ui/issue-33525.stderr @@ -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 + diff --git a/src/test/ui/issue-38875/issue_38875.stderr b/src/test/ui/issue-38875/issue_38875.stderr index ceed83d9313cd..10bb61ee22a61 100644 --- a/src/test/ui/issue-38875/issue_38875.stderr +++ b/src/test/ui/issue-38875/issue_38875.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index 4d8c5e039af41..83716b7791d83 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index 07b276601f47c..6d5e94a5e78ad 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index 2adf0cd762c59..4288fdf89a417 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 15825017d15c3..95076bfbdc7da 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 15ecca618052e..9e4f6c421790f 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index 471b3401827d8..e3fd0192053b9 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 46fc43eaf5756..8551f015db527 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -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 diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr index ea696c51d6218..8dba0c33f201a 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -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 diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index 831b3f65634b2..df62f5acc0074 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/E0281.stderr b/src/test/ui/mismatched_types/E0281.stderr index 8a306ea41929a..887412d1be7af 100644 --- a/src/test/ui/mismatched_types/E0281.stderr +++ b/src/test/ui/mismatched_types/E0281.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr index 45a42b1c271f8..cc7c01790706a 100644 --- a/src/test/ui/mismatched_types/E0409.stderr +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index bb90a19a3ba4d..6d1a39e0d93c0 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -46,5 +46,5 @@ error[E0277]: the trait bound `{integer}: std::cmp::PartialEq>` is not implemented for `{integer}` -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index f2509040b006c..ca71154e872ee 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr index 6787fe91bf308..4a619804a6c5d 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 88309ab146fa5..51acdb719b69a 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -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 diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 4ba6dc7302316..995a125845477 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -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 diff --git a/src/test/ui/missing-items/m2.stderr b/src/test/ui/missing-items/m2.stderr index b7ba5efacc4ea..51afb95b89611 100644 --- a/src/test/ui/missing-items/m2.stderr +++ b/src/test/ui/missing-items/m2.stderr @@ -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) -> ::Type` -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index 4384822f40489..bd3bdf35da609 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -42,5 +42,5 @@ error[E0308]: mismatched types = note: expected type `()` found type `std::result::Result` -error: aborting due to previous error +error: aborting due to 5 previous errors diff --git a/src/test/ui/shadowed-type-parameter.stderr b/src/test/ui/shadowed-type-parameter.stderr index d77523299bc29..a16a9c0244fb6 100644 --- a/src/test/ui/shadowed-type-parameter.stderr +++ b/src/test/ui/shadowed-type-parameter.stderr @@ -24,5 +24,5 @@ error[E0194]: type parameter `T` shadows another type parameter of the same name 18 | fn shadow_in_method(&self) {} | ^ shadows another type parameter -error: aborting due to previous error(s) +error: aborting due to 3 previous errors diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index ae290b3b11aa7..2c4c6a148d7b3 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -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 diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index 98183e2f082e9..e25caacac8feb 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -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 diff --git a/src/test/ui/transmute/main.stderr b/src/test/ui/transmute/main.stderr index c5d5a4ed8a623..a7fc0808e1845 100644 --- a/src/test/ui/transmute/main.stderr +++ b/src/test/ui/transmute/main.stderr @@ -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 diff --git a/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr b/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr index 61ee5cf61283f..7f1929050bb8f 100644 --- a/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr +++ b/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr @@ -104,5 +104,5 @@ error[E0512]: transmute called with types of different sizes = note: source type: std::option::Option (64 bits) = note: target type: u32 (32 bits) -error: aborting due to previous error(s) +error: aborting due to 11 previous errors diff --git a/src/test/ui/transmute/transmute-type-parameters.stderr b/src/test/ui/transmute/transmute-type-parameters.stderr index bb21cfd3e4c9d..816c62812f31f 100644 --- a/src/test/ui/transmute/transmute-type-parameters.stderr +++ b/src/test/ui/transmute/transmute-type-parameters.stderr @@ -52,5 +52,5 @@ error[E0512]: transmute called with types of different sizes = note: source type: std::option::Option (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 diff --git a/src/test/ui/type-check/assignment-in-if.stderr b/src/test/ui/type-check/assignment-in-if.stderr index 2943999927322..a077f37eae6ee 100644 --- a/src/test/ui/type-check/assignment-in-if.stderr +++ b/src/test/ui/type-check/assignment-in-if.stderr @@ -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