1
Fork 0

Auto merge of #45519 - michaelwoerister:dedup-errors, r=arielb1

Don't emit the same compiler diagnostic twice.

This PR makes the compiler filter out diagnostic messages that have already been emitted during the same compilation session.
This commit is contained in:
bors 2017-10-26 18:16:15 +00:00
commit b218a02ad8
60 changed files with 83 additions and 154 deletions

1
src/Cargo.lock generated
View file

@ -1681,6 +1681,7 @@ dependencies = [
name = "rustc_errors" name = "rustc_errors"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"rustc_data_structures 0.0.0",
"serialize 0.0.0", "serialize 0.0.0",
"syntax_pos 0.0.0", "syntax_pos 0.0.0",
] ]

View file

@ -74,7 +74,7 @@ struct Struct(
ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4) ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4)
def create_test_case(type, trait, super_traits, number_of_errors): def create_test_case(type, trait, super_traits, error_count):
string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type] string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type]
all_traits = ','.join([trait] + super_traits) all_traits = ','.join([trait] + super_traits)
super_traits = ','.join(super_traits) super_traits = ','.join(super_traits)
@ -113,7 +113,7 @@ traits = {
for (trait, supers, errs) in [('Clone', [], 1), for (trait, supers, errs) in [('Clone', [], 1),
('PartialEq', [], 2), ('PartialEq', [], 2),
('PartialOrd', ['PartialEq'], 9), ('PartialOrd', ['PartialEq'], 3),
('Eq', ['PartialEq'], 1), ('Eq', ['PartialEq'], 1),
('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1), ('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1),
('Debug', [], 1), ('Debug', [], 1),

View file

@ -11,3 +11,4 @@ crate-type = ["dylib"]
[dependencies] [dependencies]
serialize = { path = "../libserialize" } serialize = { path = "../libserialize" }
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" }

View file

@ -17,7 +17,7 @@ use syntax_pos::{MultiSpan, Span};
use snippet::Style; use snippet::Style;
#[must_use] #[must_use]
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub struct Diagnostic { pub struct Diagnostic {
pub level: Level, pub level: Level,
pub message: Vec<(String, Style)>, pub message: Vec<(String, Style)>,
@ -28,7 +28,7 @@ pub struct Diagnostic {
} }
/// For example a note attached to an error. /// For example a note attached to an error.
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub struct SubDiagnostic { pub struct SubDiagnostic {
pub level: Level, pub level: Level,
pub message: Vec<(String, Style)>, pub message: Vec<(String, Style)>,

View file

@ -18,10 +18,12 @@
#![feature(range_contains)] #![feature(range_contains)]
#![cfg_attr(unix, feature(libc))] #![cfg_attr(unix, feature(libc))]
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(i128_type)]
extern crate term; extern crate term;
#[cfg(unix)] #[cfg(unix)]
extern crate libc; extern crate libc;
extern crate rustc_data_structures;
extern crate serialize as rustc_serialize; extern crate serialize as rustc_serialize;
extern crate syntax_pos; extern crate syntax_pos;
@ -31,6 +33,9 @@ use self::Level::*;
use emitter::{Emitter, EmitterWriter}; use emitter::{Emitter, EmitterWriter};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::stable_hasher::StableHasher;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::{RefCell, Cell}; use std::cell::{RefCell, Cell};
use std::mem; use std::mem;
@ -47,7 +52,7 @@ mod lock;
use syntax_pos::{BytePos, Loc, FileLinesResult, FileMap, FileName, MultiSpan, Span, NO_EXPANSION}; use syntax_pos::{BytePos, Loc, FileLinesResult, FileMap, FileName, MultiSpan, Span, NO_EXPANSION};
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub enum RenderSpan { pub enum RenderSpan {
/// A FullSpan renders with both with an initial line for the /// A FullSpan renders with both with an initial line for the
/// message, prefixed by file:linenum, followed by a summary of /// message, prefixed by file:linenum, followed by a summary of
@ -61,7 +66,7 @@ pub enum RenderSpan {
Suggestion(CodeSuggestion), Suggestion(CodeSuggestion),
} }
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub struct CodeSuggestion { pub struct CodeSuggestion {
/// Each substitute can have multiple variants due to multiple /// Each substitute can have multiple variants due to multiple
/// applicable suggestions /// applicable suggestions
@ -86,7 +91,7 @@ pub struct CodeSuggestion {
pub show_code_when_inline: bool, pub show_code_when_inline: bool,
} }
#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
/// See the docs on `CodeSuggestion::substitutions` /// See the docs on `CodeSuggestion::substitutions`
pub struct Substitution { pub struct Substitution {
pub span: Span, pub span: Span,
@ -271,6 +276,11 @@ pub struct Handler {
continue_after_error: Cell<bool>, continue_after_error: Cell<bool>,
delayed_span_bug: RefCell<Option<Diagnostic>>, delayed_span_bug: RefCell<Option<Diagnostic>>,
tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>, tracked_diagnostics: RefCell<Option<Vec<Diagnostic>>>,
// This set contains a hash of every diagnostic that has been emitted by
// this handler. These hashes is used to avoid emitting the same error
// twice.
emitted_diagnostics: RefCell<FxHashSet<u128>>,
} }
impl Handler { impl Handler {
@ -295,6 +305,7 @@ impl Handler {
continue_after_error: Cell::new(true), continue_after_error: Cell::new(true),
delayed_span_bug: RefCell::new(None), delayed_span_bug: RefCell::new(None),
tracked_diagnostics: RefCell::new(None), tracked_diagnostics: RefCell::new(None),
emitted_diagnostics: RefCell::new(FxHashSet()),
} }
} }
@ -559,15 +570,29 @@ impl Handler {
} }
fn emit_db(&self, db: &DiagnosticBuilder) { fn emit_db(&self, db: &DiagnosticBuilder) {
let diagnostic = &**db;
if let Some(ref mut list) = *self.tracked_diagnostics.borrow_mut() { if let Some(ref mut list) = *self.tracked_diagnostics.borrow_mut() {
list.push((**db).clone()); list.push(diagnostic.clone());
}
let diagnostic_hash = {
use std::hash::Hash;
let mut hasher = StableHasher::new();
diagnostic.hash(&mut hasher);
hasher.finish()
};
// Only emit the diagnostic if we haven't already emitted an equivalent
// one:
if self.emitted_diagnostics.borrow_mut().insert(diagnostic_hash) {
self.emitter.borrow_mut().emit(db);
} }
self.emitter.borrow_mut().emit(db);
} }
} }
#[derive(Copy, PartialEq, Clone, Debug, RustcEncodable, RustcDecodable)] #[derive(Copy, PartialEq, Clone, Hash, Debug, RustcEncodable, RustcDecodable)]
pub enum Level { pub enum Level {
Bug, Bug,
Fatal, Fatal,

View file

@ -203,7 +203,7 @@ pub struct StyledString {
pub style: Style, pub style: Style,
} }
#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] #[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub enum Style { pub enum Style {
HeaderMsg, HeaderMsg,
LineAndColumn, LineAndColumn,

View file

@ -13,15 +13,9 @@ const C: i32 = 2;
const CR: &'static mut i32 = &mut C; //~ ERROR E0017 const CR: &'static mut i32 = &mut C; //~ ERROR E0017
//~| NOTE constants require immutable values //~| NOTE constants require immutable values
//~| ERROR E0017
//~| NOTE constants require immutable values
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
//~| NOTE statics require immutable values
//~| ERROR E0017
//~| NOTE statics require immutable values //~| NOTE statics require immutable values
//~| ERROR cannot borrow //~| ERROR cannot borrow
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
//~| NOTE statics require immutable values //~| NOTE statics require immutable values
//~| ERROR E0017
//~| NOTE statics require immutable values
fn main() {} fn main() {}

View file

@ -12,11 +12,8 @@ static X: i32 = 1;
const C: i32 = 2; const C: i32 = 2;
const CR: &'static mut i32 = &mut C; //~ ERROR E0017 const CR: &'static mut i32 = &mut C; //~ ERROR E0017
//~| ERROR E0017
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
//~| ERROR E0017
//~| ERROR cannot borrow //~| ERROR cannot borrow
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
//~| ERROR E0017
fn main() {} fn main() {}

View file

@ -67,7 +67,6 @@ fn f() {
}; };
let sp = &mut s; let sp = &mut s;
s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
//~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
} }
fn g() { fn g() {

View file

@ -11,7 +11,6 @@
fn a<F:Fn(isize, isize) -> isize>(mut f: F) { fn a<F:Fn(isize, isize) -> isize>(mut f: F) {
let g = &mut f; let g = &mut f;
f(1, 2); //~ ERROR cannot borrow `f` as immutable f(1, 2); //~ ERROR cannot borrow `f` as immutable
//~^ ERROR cannot borrow `f` as immutable
} }
fn b<F:FnMut(isize, isize) -> isize>(f: F) { fn b<F:FnMut(isize, isize) -> isize>(f: F) {

View file

@ -12,6 +12,5 @@
static TEST: &'static mut [isize] = &mut []; static TEST: &'static mut [isize] = &mut [];
//~^ ERROR references in statics may only refer to immutable values //~^ ERROR references in statics may only refer to immutable values
//~^^ ERROR references in statics may only refer to immutable values
pub fn main() { } pub fn main() { }

View file

@ -24,8 +24,6 @@ fn black_box<T>(_: T) {
const FOO: u8 = [5u8][1]; const FOO: u8 = [5u8][1];
//~^ ERROR constant evaluation error //~^ ERROR constant evaluation error
//~| index out of bounds: the len is 1 but the index is 1 //~| index out of bounds: the len is 1 but the index is 1
//~^^^ ERROR constant evaluation error
//~| index out of bounds: the len is 1 but the index is 1
fn main() { fn main() {
let a = -std::i8::MIN; let a = -std::i8::MIN;
@ -33,8 +31,7 @@ fn main() {
//~| attempt to negate with overflow //~| attempt to negate with overflow
let b = 200u8 + 200u8 + 200u8; let b = 200u8 + 200u8 + 200u8;
//~^ WARN this expression will panic at run-time //~^ WARN this expression will panic at run-time
//~| attempt to add with overflow //~^^ WARN this expression will panic at run-time
//~^^^ WARN this expression will panic at run-time
//~| attempt to add with overflow //~| attempt to add with overflow
let c = 200u8 * 4; let c = 200u8 * 4;
//~^ WARN this expression will panic at run-time //~^ WARN this expression will panic at run-time

View file

@ -21,7 +21,6 @@ fn main() {
//~^ ERROR attempt to negate with overflow //~^ ERROR attempt to negate with overflow
let b = 200u8 + 200u8 + 200u8; let b = 200u8 + 200u8 + 200u8;
//~^ ERROR attempt to add with overflow //~^ ERROR attempt to add with overflow
//~| ERROR attempt to add with overflow
let c = 200u8 * 4; let c = 200u8 * 4;
//~^ ERROR attempt to multiply with overflow //~^ ERROR attempt to multiply with overflow
let d = 42u8 - (42u8 + 1); let d = 42u8 - (42u8 + 1);

View file

@ -13,7 +13,6 @@
trait Foo<X = Box<Foo>> { trait Foo<X = Box<Foo>> {
//~^ ERROR unsupported cyclic reference //~^ ERROR unsupported cyclic reference
//~| ERROR unsupported cyclic reference
} }
fn main() { } fn main() { }

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -15,7 +15,7 @@ struct Error;
#[derive(Default)] #[derive(Default)]
struct Struct { struct Struct {
x: Error //~ ERROR `Error: std::default::Default` is not satisfied x: Error //~ ERROR
} }
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -19,12 +19,6 @@ enum Enum {
x: Error //~ ERROR x: Error //~ ERROR
//~^ ERROR //~^ ERROR
//~^^ ERROR //~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -19,12 +19,6 @@ enum Enum {
Error //~ ERROR Error //~ ERROR
//~^ ERROR //~^ ERROR
//~^^ ERROR //~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
) )
} }

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -18,12 +18,6 @@ struct Struct {
x: Error //~ ERROR x: Error //~ ERROR
//~^ ERROR //~^ ERROR
//~^^ ERROR //~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
} }
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -18,12 +18,6 @@ struct Struct(
Error //~ ERROR Error //~ ERROR
//~^ ERROR //~^ ERROR
//~^^ ERROR //~^^ ERROR
//~^^^ ERROR
//~^^^^ ERROR
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
); );
fn main() {} fn main() {}

View file

@ -28,7 +28,6 @@ mod rustc_deprecated {
#[rustc_deprecated = "1500"] struct S; #[rustc_deprecated = "1500"] struct S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated = "1500"] type T = S; #[rustc_deprecated = "1500"] type T = S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library

View file

@ -28,7 +28,6 @@ mod stable {
#[stable = "1300"] struct S; #[stable = "1300"] struct S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[stable = "1300"] type T = S; #[stable = "1300"] type T = S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library

View file

@ -28,7 +28,6 @@ mod unstable {
#[unstable = "1200"] struct S; #[unstable = "1200"] struct S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[unstable = "1200"] type T = S; #[unstable = "1200"] type T = S;
//~^ ERROR stability attributes may not be used outside of the standard library //~^ ERROR stability attributes may not be used outside of the standard library

View file

@ -10,13 +10,11 @@
const C1: &'static mut [usize] = &mut []; const C1: &'static mut [usize] = &mut [];
//~^ ERROR: references in constants may only refer to immutable values //~^ ERROR: references in constants may only refer to immutable values
//~| ERROR: references in constants may only refer to immutable values
static mut S: usize = 3; static mut S: usize = 3;
const C2: &'static mut usize = unsafe { &mut S }; const C2: &'static mut usize = unsafe { &mut S };
//~^ ERROR: constants cannot refer to statics //~^ ERROR: constants cannot refer to statics
//~| ERROR: references in constants may only refer to immutable values //~| ERROR: references in constants may only refer to immutable values
//~| ERROR: references in constants may only refer to immutable values //~| ERROR: references in constants may only refer to immutable values
//~| ERROR: references in constants may only refer to immutable values
fn main() {} fn main() {}

View file

@ -38,7 +38,6 @@ impl<'a> Publisher<'a> for MyStruct<'a> {
fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) { fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
// Not obvious, but there is an implicit lifetime here -------^ // Not obvious, but there is an implicit lifetime here -------^
//~^^ ERROR cannot infer //~^^ ERROR cannot infer
//~| ERROR cannot infer
// //
// The fact that `Publisher` is using an implicit lifetime is // The fact that `Publisher` is using an implicit lifetime is
// what was causing the debruijn accounting to be off, so // what was causing the debruijn accounting to be off, so

View file

@ -39,8 +39,6 @@ fn main() {
match (x, 5) { match (x, 5) {
(3.14, 1) => {}, //~ ERROR floating-point literals cannot be used (3.14, 1) => {}, //~ ERROR floating-point literals cannot be used
//~| WARNING hard error //~| WARNING hard error
//~| ERROR floating-point literals cannot be used
//~| WARNING hard error
_ => {}, _ => {},
} }
// Or structs // Or structs
@ -48,8 +46,6 @@ fn main() {
match (Foo { x }) { match (Foo { x }) {
Foo { x: 2.0 } => {}, //~ ERROR floating-point literals cannot be used Foo { x: 2.0 } => {}, //~ ERROR floating-point literals cannot be used
//~| WARNING hard error //~| WARNING hard error
//~| ERROR floating-point literals cannot be used
//~| WARNING hard error
_ => {}, _ => {},
} }
} }

View file

@ -107,7 +107,6 @@ mod cross_crate {
struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable); struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated); struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
//~^ WARN use of deprecated item //~^ WARN use of deprecated item
//~| WARN use of deprecated item
let _ = DeprecatedStruct { //~ WARN use of deprecated item let _ = DeprecatedStruct { //~ WARN use of deprecated item
i: 0 //~ WARN use of deprecated item i: 0 //~ WARN use of deprecated item

View file

@ -28,8 +28,7 @@ enum_number!(Change {
Pos = 1, Pos = 1,
Neg = -1, Neg = -1,
Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns
//~^ ERROR arbitrary expressions aren't allowed in patterns //~^ ERROR only char and numeric types are allowed in range patterns
//~^^ ERROR only char and numeric types are allowed in range patterns
}); });
fn main() {} fn main() {}

View file

@ -12,75 +12,38 @@
use std::ops::*; use std::ops::*;
// FIXME #34229 duplicated errors
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
struct AllTheRanges { struct AllTheRanges {
a: Range<usize>, a: Range<usize>,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
b: RangeTo<usize>, b: RangeTo<usize>,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
c: RangeFrom<usize>, c: RangeFrom<usize>,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
d: RangeFull, d: RangeFull,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
e: RangeInclusive<usize>, e: RangeInclusive<usize>,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
f: RangeToInclusive<usize>, f: RangeToInclusive<usize>,
//~^ ERROR PartialOrd //~^ ERROR PartialOrd
//~^^ ERROR Ord //~^^ ERROR Ord
//~^^^ ERROR binary operation //~^^^ ERROR binary operation `<` cannot be applied to type
//~^^^^ ERROR binary operation //~^^^^ ERROR binary operation `>` cannot be applied to type
//~^^^^^ ERROR binary operation
//~^^^^^^ ERROR binary operation
//~^^^^^^^ ERROR binary operation
//~^^^^^^^^ ERROR binary operation
//~^^^^^^^^^ ERROR binary operation
//~^^^^^^^^^^ ERROR binary operation
} }
fn main() {} fn main() {}

View file

@ -35,7 +35,6 @@ impl<'a, 't> Foo<'a, 't> for &'a isize {
fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
//~^ ERROR method not compatible with trait //~^ ERROR method not compatible with trait
//~^^ ERROR method not compatible with trait
// //
// Note: This is a terrible error message. It is caused // Note: This is a terrible error message. It is caused
// because, in the trait, 'b is early bound, and in the impl, // because, in the trait, 'b is early bound, and in the impl,

View file

@ -31,7 +31,6 @@ fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
//~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough
//~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough
//~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough
//~| ERROR the parameter type `T` may not live long enough
} }
fn main() {} fn main() {}

View file

@ -4,12 +4,6 @@ error: unexpected generic arguments in path
20 | m!(MyTrait<>); 20 | m!(MyTrait<>);
| ^^^^^^^^^ | ^^^^^^^^^
error: unexpected generic arguments in path
--> $DIR/macro-ty-params.rs:20:8
|
20 | m!(MyTrait<>);
| ^^^^^^^^^
error: generic arguments in macro path error: generic arguments in macro path
--> $DIR/macro-ty-params.rs:18:8 --> $DIR/macro-ty-params.rs:18:8
| |