diff --git a/src/Cargo.lock b/src/Cargo.lock index a8bcea6d781f6..76bdc8ef4c62f 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1705,6 +1705,7 @@ dependencies = [ name = "rustc_errors" version = "0.0.0" dependencies = [ + "rustc_data_structures 0.0.0", "serialize 0.0.0", "syntax_pos 0.0.0", ] diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 6642da858e551..15c9fc2e504a1 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -74,7 +74,7 @@ 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] all_traits = ','.join([trait] + super_traits) super_traits = ','.join(super_traits) @@ -113,7 +113,7 @@ def write_file(name, string): for (trait, supers, errs) in [('Clone', [], 1), ('PartialEq', [], 2), - ('PartialOrd', ['PartialEq'], 9), + ('PartialOrd', ['PartialEq'], 3), ('Eq', ['PartialEq'], 1), ('Ord', ['Eq', 'PartialOrd', 'PartialEq'], 1), ('Debug', [], 1), diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 78ff52b4b2371..c72e9dd0ea322 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -11,3 +11,4 @@ crate-type = ["dylib"] [dependencies] serialize = { path = "../libserialize" } syntax_pos = { path = "../libsyntax_pos" } +rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 02c0307e98cc8..64afdb1d2e018 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -17,7 +17,7 @@ use syntax_pos::{MultiSpan, Span}; use snippet::Style; #[must_use] -#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub struct Diagnostic { pub level: Level, pub message: Vec<(String, Style)>, @@ -28,7 +28,7 @@ pub struct Diagnostic { } /// 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 level: Level, pub message: Vec<(String, Style)>, diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index d9b0f4ac8a6c0..39bb0184289c7 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -18,10 +18,12 @@ #![feature(range_contains)] #![cfg_attr(unix, feature(libc))] #![feature(conservative_impl_trait)] +#![feature(i128_type)] extern crate term; #[cfg(unix)] extern crate libc; +extern crate rustc_data_structures; extern crate serialize as rustc_serialize; extern crate syntax_pos; @@ -31,6 +33,9 @@ use self::Level::*; use emitter::{Emitter, EmitterWriter}; +use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::stable_hasher::StableHasher; + use std::borrow::Cow; use std::cell::{RefCell, Cell}; use std::mem; @@ -47,7 +52,7 @@ mod lock; 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 { /// A FullSpan renders with both with an initial line for the /// message, prefixed by file:linenum, followed by a summary of @@ -61,7 +66,7 @@ pub enum RenderSpan { Suggestion(CodeSuggestion), } -#[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub struct CodeSuggestion { /// Each substitute can have multiple variants due to multiple /// applicable suggestions @@ -86,7 +91,7 @@ pub struct CodeSuggestion { 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` pub struct Substitution { pub span: Span, @@ -271,6 +276,11 @@ pub struct Handler { continue_after_error: Cell, delayed_span_bug: RefCell>, tracked_diagnostics: RefCell>>, + + // 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>, } impl Handler { @@ -295,6 +305,7 @@ impl Handler { continue_after_error: Cell::new(true), delayed_span_bug: 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) { + let diagnostic = &**db; + 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 { Bug, Fatal, diff --git a/src/librustc_errors/snippet.rs b/src/librustc_errors/snippet.rs index 52e3fcc1b474c..2e8deeee5a599 100644 --- a/src/librustc_errors/snippet.rs +++ b/src/librustc_errors/snippet.rs @@ -203,7 +203,7 @@ pub struct StyledString { pub style: Style, } -#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub enum Style { HeaderMsg, LineAndColumn, diff --git a/src/test/compile-fail/E0017.rs b/src/test/compile-fail/E0017.rs index c6bec6090f242..726a6f8c6feb4 100644 --- a/src/test/compile-fail/E0017.rs +++ b/src/test/compile-fail/E0017.rs @@ -13,15 +13,9 @@ const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 //~| NOTE constants require immutable values - //~| ERROR E0017 - //~| NOTE constants require immutable values static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 - //~| NOTE statics require immutable values - //~| ERROR E0017 //~| NOTE statics require immutable values //~| ERROR cannot borrow static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 //~| NOTE statics require immutable values - //~| ERROR E0017 - //~| NOTE statics require immutable values fn main() {} diff --git a/src/test/compile-fail/E0388.rs b/src/test/compile-fail/E0388.rs index 2c88039d373e5..c002badfef64c 100644 --- a/src/test/compile-fail/E0388.rs +++ b/src/test/compile-fail/E0388.rs @@ -12,11 +12,8 @@ static X: i32 = 1; const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 - //~| ERROR E0017 //~| ERROR cannot borrow static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 - //~| ERROR E0017 fn main() {} diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs index 4c20688331b6d..41f3e472cd125 100644 --- a/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs +++ b/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs @@ -67,7 +67,6 @@ fn f() { }; let sp = &mut s; 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() { diff --git a/src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs b/src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs index 0f9829ab259a9..4813b4b6a72cd 100644 --- a/src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs +++ b/src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs @@ -11,7 +11,6 @@ fn a isize>(mut f: F) { let g = &mut f; f(1, 2); //~ ERROR cannot borrow `f` as immutable - //~^ ERROR cannot borrow `f` as immutable } fn b isize>(f: F) { diff --git a/src/test/compile-fail/check-static-immutable-mut-slices.rs b/src/test/compile-fail/check-static-immutable-mut-slices.rs index 370cfe9d55012..1804b9e04c2c9 100644 --- a/src/test/compile-fail/check-static-immutable-mut-slices.rs +++ b/src/test/compile-fail/check-static-immutable-mut-slices.rs @@ -12,6 +12,5 @@ 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 pub fn main() { } diff --git a/src/test/compile-fail/const-err.rs b/src/test/compile-fail/const-err.rs index 944e458c4c0f0..e65194ab56f98 100644 --- a/src/test/compile-fail/const-err.rs +++ b/src/test/compile-fail/const-err.rs @@ -24,8 +24,6 @@ fn black_box(_: T) { const FOO: u8 = [5u8][1]; //~^ ERROR constant evaluation error //~| 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() { let a = -std::i8::MIN; @@ -33,8 +31,7 @@ fn main() { //~| attempt to negate with overflow let b = 200u8 + 200u8 + 200u8; //~^ 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 let c = 200u8 * 4; //~^ WARN this expression will panic at run-time diff --git a/src/test/compile-fail/const-err2.rs b/src/test/compile-fail/const-err2.rs index 7c1fb2ccd4729..9889ca1392ac1 100644 --- a/src/test/compile-fail/const-err2.rs +++ b/src/test/compile-fail/const-err2.rs @@ -21,7 +21,6 @@ fn main() { //~^ ERROR attempt to negate with overflow let b = 200u8 + 200u8 + 200u8; //~^ ERROR attempt to add with overflow - //~| ERROR attempt to add with overflow let c = 200u8 * 4; //~^ ERROR attempt to multiply with overflow let d = 42u8 - (42u8 + 1); diff --git a/src/test/compile-fail/cycle-trait-default-type-trait.rs b/src/test/compile-fail/cycle-trait-default-type-trait.rs index 6825572b26c83..e6caeb34a8c8f 100644 --- a/src/test/compile-fail/cycle-trait-default-type-trait.rs +++ b/src/test/compile-fail/cycle-trait-default-type-trait.rs @@ -13,7 +13,6 @@ trait Foo> { //~^ ERROR unsupported cyclic reference - //~| ERROR unsupported cyclic reference } fn main() { } diff --git a/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs index 0b73f5bebb23c..244acbf660533 100644 --- a/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Clone-enum.rs b/src/test/compile-fail/derives-span-Clone-enum.rs index 6944ea38b3726..785a3d3543088 100644 --- a/src/test/compile-fail/derives-span-Clone-enum.rs +++ b/src/test/compile-fail/derives-span-Clone-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Clone-struct.rs b/src/test/compile-fail/derives-span-Clone-struct.rs index 92bf148ccbd94..b1b1dc7bed162 100644 --- a/src/test/compile-fail/derives-span-Clone-struct.rs +++ b/src/test/compile-fail/derives-span-Clone-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Clone-tuple-struct.rs b/src/test/compile-fail/derives-span-Clone-tuple-struct.rs index 21adfc90301b8..d56e21b9a8af2 100644 --- a/src/test/compile-fail/derives-span-Clone-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Clone-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs index da777e8a14b45..4c25e482c2a68 100644 --- a/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Debug-enum.rs b/src/test/compile-fail/derives-span-Debug-enum.rs index bf5d3f2d81b29..0cb02aa54e69d 100644 --- a/src/test/compile-fail/derives-span-Debug-enum.rs +++ b/src/test/compile-fail/derives-span-Debug-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Debug-struct.rs b/src/test/compile-fail/derives-span-Debug-struct.rs index b0b275fa2d347..33fa82355ec67 100644 --- a/src/test/compile-fail/derives-span-Debug-struct.rs +++ b/src/test/compile-fail/derives-span-Debug-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Debug-tuple-struct.rs b/src/test/compile-fail/derives-span-Debug-tuple-struct.rs index 9689054a7be6d..760ed199f6abd 100644 --- a/src/test/compile-fail/derives-span-Debug-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Debug-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Default-struct.rs b/src/test/compile-fail/derives-span-Default-struct.rs index 68b99ed25b855..4adfe75adaf91 100644 --- a/src/test/compile-fail/derives-span-Default-struct.rs +++ b/src/test/compile-fail/derives-span-Default-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -15,7 +15,7 @@ struct Error; #[derive(Default)] struct Struct { - x: Error //~ ERROR `Error: std::default::Default` is not satisfied + x: Error //~ ERROR } fn main() {} diff --git a/src/test/compile-fail/derives-span-Default-tuple-struct.rs b/src/test/compile-fail/derives-span-Default-tuple-struct.rs index 822abe975a1cc..a5e3a7cd49f81 100644 --- a/src/test/compile-fail/derives-span-Default-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Default-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs index fdc74d5fef6b1..6abd1d31e6615 100644 --- a/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Eq-enum.rs b/src/test/compile-fail/derives-span-Eq-enum.rs index 4bf30fdf93f77..f361278a620f4 100644 --- a/src/test/compile-fail/derives-span-Eq-enum.rs +++ b/src/test/compile-fail/derives-span-Eq-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Eq-struct.rs b/src/test/compile-fail/derives-span-Eq-struct.rs index 685188f133786..7067caa6d5cca 100644 --- a/src/test/compile-fail/derives-span-Eq-struct.rs +++ b/src/test/compile-fail/derives-span-Eq-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Eq-tuple-struct.rs b/src/test/compile-fail/derives-span-Eq-tuple-struct.rs index 0e636d027dd37..1a09628b77091 100644 --- a/src/test/compile-fail/derives-span-Eq-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Eq-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs index bfb6566223cb3..907045cce47d5 100644 --- a/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Hash-enum.rs b/src/test/compile-fail/derives-span-Hash-enum.rs index 99f28b376dfe9..321b9e71a0f29 100644 --- a/src/test/compile-fail/derives-span-Hash-enum.rs +++ b/src/test/compile-fail/derives-span-Hash-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Hash-struct.rs b/src/test/compile-fail/derives-span-Hash-struct.rs index acfd5aa7b2a74..7f69c3a8e2565 100644 --- a/src/test/compile-fail/derives-span-Hash-struct.rs +++ b/src/test/compile-fail/derives-span-Hash-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Hash-tuple-struct.rs b/src/test/compile-fail/derives-span-Hash-tuple-struct.rs index 3d76b29834f09..2dee63c4298d0 100644 --- a/src/test/compile-fail/derives-span-Hash-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Hash-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs b/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs index 06ee588e69f49..8f4e393c96a41 100644 --- a/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Ord-enum.rs b/src/test/compile-fail/derives-span-Ord-enum.rs index af9cfbc911097..b8ceacf3753ef 100644 --- a/src/test/compile-fail/derives-span-Ord-enum.rs +++ b/src/test/compile-fail/derives-span-Ord-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Ord-struct.rs b/src/test/compile-fail/derives-span-Ord-struct.rs index 4477d933a6c7a..2ff62bac2bce1 100644 --- a/src/test/compile-fail/derives-span-Ord-struct.rs +++ b/src/test/compile-fail/derives-span-Ord-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-Ord-tuple-struct.rs b/src/test/compile-fail/derives-span-Ord-tuple-struct.rs index ebc7518641289..24eacb71d7b4a 100644 --- a/src/test/compile-fail/derives-span-Ord-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-Ord-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs b/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs index 7c98dcc2a6f1d..14d94f1599e5f 100644 --- a/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-PartialEq-enum.rs b/src/test/compile-fail/derives-span-PartialEq-enum.rs index fe6355e456cca..ab58bb938b9dd 100644 --- a/src/test/compile-fail/derives-span-PartialEq-enum.rs +++ b/src/test/compile-fail/derives-span-PartialEq-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-PartialEq-struct.rs b/src/test/compile-fail/derives-span-PartialEq-struct.rs index 10d9d64277683..05a0990ff035a 100644 --- a/src/test/compile-fail/derives-span-PartialEq-struct.rs +++ b/src/test/compile-fail/derives-span-PartialEq-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs b/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs index c92eb0f63c4da..cdeb7ce45bc4c 100644 --- a/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs index 898104d0ab29c..cf3d69bc16c43 100644 --- a/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -19,12 +19,6 @@ enum Enum { x: Error //~ ERROR //~^ ERROR //~^^ ERROR -//~^^^ ERROR -//~^^^^ ERROR -//~^^^^^ ERROR -//~^^^^^^ ERROR -//~^^^^^^^ ERROR -//~^^^^^^^^ ERROR } } diff --git a/src/test/compile-fail/derives-span-PartialOrd-enum.rs b/src/test/compile-fail/derives-span-PartialOrd-enum.rs index c0585999473b5..c4d587237a52f 100644 --- a/src/test/compile-fail/derives-span-PartialOrd-enum.rs +++ b/src/test/compile-fail/derives-span-PartialOrd-enum.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -19,12 +19,6 @@ enum Enum { Error //~ ERROR //~^ ERROR //~^^ ERROR -//~^^^ ERROR -//~^^^^ ERROR -//~^^^^^ ERROR -//~^^^^^^ ERROR -//~^^^^^^^ ERROR -//~^^^^^^^^ ERROR ) } diff --git a/src/test/compile-fail/derives-span-PartialOrd-struct.rs b/src/test/compile-fail/derives-span-PartialOrd-struct.rs index af05434af9de3..e065abd9b46a2 100644 --- a/src/test/compile-fail/derives-span-PartialOrd-struct.rs +++ b/src/test/compile-fail/derives-span-PartialOrd-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -18,12 +18,6 @@ struct Struct { x: Error //~ ERROR //~^ ERROR //~^^ ERROR -//~^^^ ERROR -//~^^^^ ERROR -//~^^^^^ ERROR -//~^^^^^^ ERROR -//~^^^^^^^ ERROR -//~^^^^^^^^ ERROR } fn main() {} diff --git a/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs b/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs index 1afb7bc2b4c47..f2df01222b989 100644 --- a/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs +++ b/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -18,12 +18,6 @@ struct Struct( Error //~ ERROR //~^ ERROR //~^^ ERROR -//~^^^ ERROR -//~^^^^ ERROR -//~^^^^^ ERROR -//~^^^^^^ ERROR -//~^^^^^^^ ERROR -//~^^^^^^^^ ERROR ); fn main() {} diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs index 4709ec2bc579b..10c1398634923 100644 --- a/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs +++ b/src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs @@ -28,7 +28,6 @@ mod rustc_deprecated { #[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 #[rustc_deprecated = "1500"] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs index 9627d32d42aad..a6eaabf7a383e 100644 --- a/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs +++ b/src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs @@ -28,7 +28,6 @@ mod stable { #[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 #[stable = "1300"] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library diff --git a/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs index 0708dc8f728e8..ff0600deb1936 100644 --- a/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs +++ b/src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs @@ -28,7 +28,6 @@ mod unstable { #[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 #[unstable = "1200"] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library diff --git a/src/test/compile-fail/issue-17718-const-bad-values.rs b/src/test/compile-fail/issue-17718-const-bad-values.rs index af356588ed9e7..17ec77d77eea2 100644 --- a/src/test/compile-fail/issue-17718-const-bad-values.rs +++ b/src/test/compile-fail/issue-17718-const-bad-values.rs @@ -10,13 +10,11 @@ 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 static mut S: usize = 3; const C2: &'static mut usize = unsafe { &mut S }; //~^ 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 fn main() {} diff --git a/src/test/compile-fail/issue-20831-debruijn.rs b/src/test/compile-fail/issue-20831-debruijn.rs index 323cd24d8dda5..3f00f561ae96f 100644 --- a/src/test/compile-fail/issue-20831-debruijn.rs +++ b/src/test/compile-fail/issue-20831-debruijn.rs @@ -38,7 +38,6 @@ impl<'a> Publisher<'a> for MyStruct<'a> { fn subscribe(&mut self, t : Box::Output> + 'a>) { // Not obvious, but there is an implicit lifetime here -------^ //~^^ ERROR cannot infer - //~| ERROR cannot infer // // The fact that `Publisher` is using an implicit lifetime is // what was causing the debruijn accounting to be off, so diff --git a/src/test/compile-fail/issue-41255.rs b/src/test/compile-fail/issue-41255.rs index a4585f7bac7da..191b867e7a8b5 100644 --- a/src/test/compile-fail/issue-41255.rs +++ b/src/test/compile-fail/issue-41255.rs @@ -39,8 +39,6 @@ fn main() { match (x, 5) { (3.14, 1) => {}, //~ ERROR floating-point literals cannot be used //~| WARNING hard error - //~| ERROR floating-point literals cannot be used - //~| WARNING hard error _ => {}, } // Or structs @@ -48,8 +46,6 @@ fn main() { match (Foo { x }) { Foo { x: 2.0 } => {}, //~ ERROR floating-point literals cannot be used //~| WARNING hard error - //~| ERROR floating-point literals cannot be used - //~| WARNING hard error _ => {}, } } diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/compile-fail/lint-stability-deprecated.rs index de455afbd6629..9bc2c021904aa 100644 --- a/src/test/compile-fail/lint-stability-deprecated.rs +++ b/src/test/compile-fail/lint-stability-deprecated.rs @@ -107,7 +107,6 @@ mod cross_crate { struct S1(T::TypeUnstable); struct S2(T::TypeDeprecated); //~^ WARN use of deprecated item - //~| WARN use of deprecated item let _ = DeprecatedStruct { //~ WARN use of deprecated item i: 0 //~ WARN use of deprecated item diff --git a/src/test/compile-fail/patkind-litrange-no-expr.rs b/src/test/compile-fail/patkind-litrange-no-expr.rs index afb2cbb7db397..d57a23f26c479 100644 --- a/src/test/compile-fail/patkind-litrange-no-expr.rs +++ b/src/test/compile-fail/patkind-litrange-no-expr.rs @@ -28,8 +28,7 @@ enum_number!(Change { Pos = 1, Neg = -1, 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() {} diff --git a/src/test/compile-fail/range_traits-1.rs b/src/test/compile-fail/range_traits-1.rs index cf5c40bd1761d..f1ea8b04e5ace 100644 --- a/src/test/compile-fail/range_traits-1.rs +++ b/src/test/compile-fail/range_traits-1.rs @@ -12,75 +12,38 @@ use std::ops::*; -// FIXME #34229 duplicated errors #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] struct AllTheRanges { a: Range, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type b: RangeTo, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type c: RangeFrom, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type d: RangeFull, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type e: RangeInclusive, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type f: RangeToInclusive, //~^ ERROR PartialOrd //~^^ ERROR Ord - //~^^^ ERROR binary operation - //~^^^^ ERROR binary operation - //~^^^^^ ERROR binary operation - //~^^^^^^ ERROR binary operation - //~^^^^^^^ ERROR binary operation - //~^^^^^^^^ ERROR binary operation - //~^^^^^^^^^ ERROR binary operation - //~^^^^^^^^^^ ERROR binary operation + //~^^^ ERROR binary operation `<` cannot be applied to type + //~^^^^ ERROR binary operation `>` cannot be applied to type } fn main() {} diff --git a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs index 1d4ffe0690d2f..617de2c5dfe84 100644 --- a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs +++ b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs @@ -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>) { //~^ ERROR method not compatible with trait - //~^^ ERROR method not compatible with trait // // Note: This is a terrible error message. It is caused // because, in the trait, 'b is early bound, and in the impl, diff --git a/src/test/compile-fail/regions-close-object-into-object-5.rs b/src/test/compile-fail/regions-close-object-into-object-5.rs index 152c65cb69bf2..6cbe5234ce0e8 100644 --- a/src/test/compile-fail/regions-close-object-into-object-5.rs +++ b/src/test/compile-fail/regions-close-object-into-object-5.rs @@ -31,7 +31,6 @@ fn f<'a, T, U>(v: Box+'static>) -> Box { //~| 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() {} diff --git a/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs b/src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs similarity index 100% rename from src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where-clause.rs rename to src/test/run-pass/associated-types-project-from-type-param-via-bound-in-where.rs diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-arg-types-from-expected-bound.rs similarity index 100% rename from src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs rename to src/test/run-pass/unboxed-closures-infer-arg-types-from-expected-bound.rs diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures-infer-arg-types-from-expected-object-type.rs similarity index 100% rename from src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs rename to src/test/run-pass/unboxed-closures-infer-arg-types-from-expected-object-type.rs diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs similarity index 100% rename from src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs rename to src/test/run-pass/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 1d2f7bb2f07e9..017a449d96f46 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -4,12 +4,6 @@ error: unexpected generic arguments in path 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 --> $DIR/macro-ty-params.rs:18:8 |