提交 2a992167 编写于 作者: B bors

Auto merge of #43015 - arielb1:every-error-counts, r=eddyb

report the total number of errors on compilation failure

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, therefore is a compiler-api-[breaking-change].

Fixes #42793.

r? @EddyB
......@@ -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(),
......
......@@ -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))
}
}
......
......@@ -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 @@ 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<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 @@ 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.
......
......@@ -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;
......@@ -109,18 +110,14 @@
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(),
_ => "aborting due to previous error(s)".to_owned(),
}
}
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,
}
......@@ -131,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();
}
}
}
......
......@@ -506,7 +506,10 @@ pub fn abort_if_errors(&self) {
return;
}
_ => s = "aborting due to previous error(s)".to_string(),
1 => s = "aborting due to previous error".to_string(),
_ => {
s = format!("aborting due to {} previous errors", self.err_count.get());
}
}
panic!(self.fatal(&s));
......
......@@ -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,
......
......@@ -102,7 +102,7 @@
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) {
......
......@@ -108,7 +108,7 @@
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
......
......@@ -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 {
......
......@@ -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);
}
}
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -6,5 +6,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure
15 | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^ cannot move out of captured outer variable in an `Fn` closure
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure
21 | y.into_iter();
| ^ cannot move out of captured outer variable in an `Fn` closure
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -46,5 +46,5 @@ error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 mor
49 | match Some(A) {
| ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered
error: aborting due to previous error(s)
error: aborting due to 8 previous errors
......@@ -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
......@@ -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
......@@ -12,5 +12,5 @@ note: closure cannot be invoked more than once because it moves the variable `di
16 | for (key, value) in dict {
| ^^^^
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -22,5 +22,5 @@ error: expected token: `,`
|
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error(s)
error: aborting due to 3 previous errors
......@@ -6,5 +6,5 @@ error[E0592]: duplicate definitions with name `f`
15 | impl C { fn f() {} }
| --------- other definition for `f`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -4,5 +4,5 @@ error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`,
17 | unsafe impl Send for &'static Foo { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
100 | let y = &mut x;
| ^ cannot borrow mutably
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -8,5 +8,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time
101 | }
| - first borrow ends here
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -6,5 +6,5 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str`
|
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time
| | second mutable borrow occurs here
| first mutable borrow occurs here
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -25,5 +25,5 @@ error[E0592]: duplicate definitions with name `baz`
43 | fn baz(&self) {}
| ---------------- other definition for `baz`
error: aborting due to previous error(s)
error: aborting due to 3 previous errors
......@@ -7,5 +7,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
| | hint: to prevent move, use `ref _s` or `ref mut _s`
| cannot move out of here
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -4,5 +4,5 @@ error[E0425]: cannot find value `bar` in this scope
14 | \tbar;
| \t^^^ not found in this scope
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -4,5 +4,5 @@ error: invalid ABI: expected one of [cdecl, stdcall, fastcall, vectorcall, thisc
11 | extern "路濫狼á́́" fn foo() {}
| ^^^^^^^^
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -24,5 +24,5 @@ error[E0308]: mismatched types
= note: expected type `std::result::Result<u8, u64>`
found type `()`
error: aborting due to previous error(s)
error: aborting due to 2 previous errors
......@@ -11,5 +11,5 @@ error[E0276]: impl has stricter requirements than trait
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -10,5 +10,5 @@ error[E0276]: impl has stricter requirements than trait
22 | | }
| |_____^ impl has extra requirement `'a: 'b`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0276]: impl has stricter requirements than trait
22 | fn foo() where 'a: 'b { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -11,5 +11,5 @@ error[E0276]: impl has stricter requirements than trait
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -10,5 +10,5 @@ error[E0053]: method `b` has an incompatible type for trait
= note: expected type `fn(&E, F) -> F`
found type `fn(&E, G) -> G`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0276]: impl has stricter requirements than trait
25 | fn b<F: Sync, G>(&self, _x: F) -> F { panic!() } //~ ERROR E0276
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -61,5 +61,5 @@ error[E0276]: impl has stricter requirements than trait
76 | fn method<G: Getter<usize>>(&self) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `G: Getter<usize>`
error: aborting due to previous error(s)
error: aborting due to 7 previous errors
......@@ -10,5 +10,5 @@ error[E0276]: impl has stricter requirements than trait
26 | | }
| |_____^ impl has extra requirement `U: Iterator<B>`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -6,5 +6,5 @@ error: invalid reference to argument `0` (no arguments given)
|
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -22,5 +22,5 @@ error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo`
17 | z: fn() -> Foo + 'a,
| ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses?
error: aborting due to previous error(s)
error: aborting due to 4 previous errors
......@@ -8,5 +8,5 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
<Bar as Foo<i32>>
<Bar as Foo<u8>>
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -11,5 +11,5 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
<Bar as Foo<u8>>
and 2 others
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -15,5 +15,5 @@ error[E0596]: cannot borrow immutable argument `self` as mutable
23 | (&mut self).bar();
| ^^^^ cannot borrow mutably
error: aborting due to previous error(s)
error: aborting due to 2 previous errors
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable argument `self` as mutable
| try removing `&mut` here
| cannot reborrow mutably
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable
| try removing `&mut` here
| cannot reborrow mutably
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -22,5 +22,5 @@ error[E0594]: cannot assign to immutable field `s.x`
30 | s.x += 1;
| ^^^^^^^^ cannot mutably borrow immutable field
error: aborting due to previous error(s)
error: aborting due to 3 previous errors
......@@ -4,5 +4,5 @@ error[E0609]: no field `baz` on type `Foo`
17 | f.baz;
| ^^^ did you mean `bar`?
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -4,5 +4,5 @@ error[E0609]: no field `zz` on type `Foo`
17 | f.zz;
| ^^ unknown field
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable
| try removing `&mut` here
| cannot reborrow mutably
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -10,5 +10,5 @@ error[E0432]: unresolved import `Foo1`
13 | use Foo1;
| ^^^^ no `Foo1` in the root
error: aborting due to previous error(s)
error: aborting due to 2 previous errors
......@@ -6,5 +6,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference
27 | self.s.push('x');
| ^^^^^^ assignment into an immutable reference
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable
17 | self.s.push('x');
| ^^^^^^ cannot borrow as mutable
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0596]: cannot borrow immutable borrowed content `*self.s` as mutable
17 | self.s.push('x');
| ^^^^^^ cannot borrow as mutable
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -6,5 +6,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference
16 | f.s.push('x');
| ^^^ assignment into an immutable reference
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -96,5 +96,5 @@ error[E0594]: cannot assign to immutable borrowed content `*x.0`
58 | *x.0 = 1;
| ^^^^^^^^ cannot borrow as mutable
error: aborting due to previous error(s)
error: aborting due to 12 previous errors
......@@ -39,5 +39,5 @@ error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
and 2 others
= note: required by `Foo::bar`
error: aborting due to previous error(s)
error: aborting due to 3 previous errors
......@@ -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(s)
error: aborting due to 9 previous errors
......@@ -30,5 +30,5 @@ error: chained comparison operators require parentheses
|
= help: use `::<...>` instead of `<...>` if you meant to specify type arguments
error: aborting due to previous error(s)
error: aborting due to 4 previous errors
......@@ -4,5 +4,5 @@ error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable
13 | buf.iter_mut();
| ^^^ cannot borrow as mutable
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -6,5 +6,5 @@ error: `~` can not be used as a unary operator
|
= help: use `!` instead of `~` if you meant to perform bitwise negation
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -17,5 +17,5 @@ error[E0275]: overflow evaluating the requirement `K: std::marker::Send`
= note: required because it appears within the type `A`
= note: required by `is_send`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -19,5 +19,5 @@ error[E0308]: mismatched types
= note: expected type `&Bottom`
found type `&Top`
error: aborting due to previous error(s)
error: aborting due to 3 previous errors
......@@ -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(s)
error: aborting due to 3 previous errors
......@@ -42,5 +42,5 @@ error[E0597]: `c` does not live long enough
|
= note: values in a scope are dropped in the opposite order they are created
error: aborting due to previous error(s)
error: aborting due to 4 previous errors
......@@ -20,5 +20,5 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attri
43 | | }
| |_^
error: aborting due to previous error(s)
error: aborting due to 2 previous errors
......@@ -42,5 +42,5 @@ error[E0597]: `c` does not live long enough
|
= note: values in a scope are dropped in the opposite order they are created
error: aborting due to previous error(s)
error: aborting due to 4 previous errors
......@@ -42,5 +42,5 @@ error[E0597]: `c` does not live long enough
|
= note: values in a scope are dropped in the opposite order they are created
error: aborting due to previous error(s)
error: aborting due to 4 previous errors
......@@ -16,5 +16,5 @@ error: invalid format string: unmatched `}` found
= note: if you intended to print `}`, you can escape it using `}}`
= note: this error originates in a macro outside of the current crate
error: aborting due to previous error(s)
error: aborting due to 2 previous errors
......@@ -51,5 +51,5 @@ error[E0308]: mismatched types
= note: expected type `impl Foo` (i32)
found type `impl Foo` (u32)
error: aborting due to previous error(s)
error: aborting due to 6 previous errors
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -10,5 +10,5 @@ note: maybe move this module `$DIR/auxiliary/foo/bar.rs` to its own directory vi
11 | pub mod baz;
| ^^^
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -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
......@@ -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
// 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;
}
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
......@@ -8,5 +8,5 @@ error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(
|
= note: consider adding a `#![type_length_limit="2097152"]` attribute to your crate
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -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
......@@ -7,5 +7,5 @@ error[E0507]: cannot move out of indexed content
| help: consider using a reference instead `&f.v[0]`
| cannot move out of indexed content
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -7,5 +7,5 @@ error[E0507]: cannot move out of indexed content
| | ...and here (use `ref b` or `ref mut b`)
| hint: to prevent move, use `ref a` or `ref mut a`
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -13,5 +13,5 @@ note: candidate #1 is defined in the trait `issue_41652_b::Tr`
| |__________________________^
= help: to disambiguate the method call, write `issue_41652_b::Tr::f(3)` instead
error: aborting due to previous error(s)
error: aborting due to previous error
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -6,5 +6,5 @@ error[E0621]: explicit lifetime required in the type of `y`
12 | if x > y { x } else { y }
| ^ lifetime `'a` required
error: aborting due to previous error(s)
error: aborting due to previous error
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册