From d8160799b5c464ccdb99e4bab7196440106c1972 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Tue, 29 Dec 2015 21:18:24 -0800 Subject: [PATCH] Adjust overlap-related tests to account for cosmetic changes to error reporting behavior --- .../associated-types-coherence-failure.rs | 14 +++++++------- ...anket-conflicts-with-blanket-implemented.rs | 4 ++-- ...ket-conflicts-with-blanket-unimplemented.rs | 4 ++-- ...et-conflicts-with-specific-multidispatch.rs | 4 ++-- ...ce-blanket-conflicts-with-specific-trait.rs | 4 ++-- ...oherence-blanket-conflicts-with-specific.rs | 4 ++-- ...oherence-conflicting-negative-trait-impl.rs | 2 -- .../coherence-overlap-all-t-and-tuple.rs | 4 ++-- .../coherence-overlap-issue-23516.rs | 4 ++-- .../compile-fail/coherence-overlap-messages.rs | 18 +++++++++--------- .../compile-fail/coherence-tuple-conflict.rs | 4 ++-- ...e_copy_like_err_fundamental_struct_tuple.rs | 4 ++-- .../coherence_copy_like_err_struct.rs | 4 ++-- .../coherence_copy_like_err_tuple.rs | 4 ++-- src/test/compile-fail/issue-28568.rs | 10 +++++----- 15 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/compile-fail/associated-types-coherence-failure.rs index 6d68da54112..786a25500a8 100644 --- a/src/test/compile-fail/associated-types-coherence-failure.rs +++ b/src/test/compile-fail/associated-types-coherence-failure.rs @@ -22,6 +22,12 @@ pub trait IntoCow<'a, B: ?Sized> { fn into_cow(self) -> Cow<'a, B>; } +impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { + fn into_cow(self) -> Cow<'a, B> { + Cow(PhantomData) + } +} + impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { //~^ ERROR E0119 fn into_cow(self) -> Cow<'a, B> { @@ -29,14 +35,8 @@ impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { } } -impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { -//~^ ERROR E0119 - fn into_cow(self) -> Cow<'a, B> { - Cow(PhantomData) - } -} - impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned { +//~^ ERROR E0119 fn into_cow(self) -> Cow<'a, B> { Cow(PhantomData) } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs index b771b959d3e..434d77828b4 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -27,11 +27,11 @@ impl Even for isize { } impl Odd for usize { } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { +impl MyTrait for T { //~ ERROR E0119 fn get(&self) -> usize { 0 } } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs index d3b0e7f10b9..7ad5cd71ca8 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -23,11 +23,11 @@ trait Even {} trait Odd {} -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { +impl MyTrait for T { //~ ERROR E0119 fn get(&self) -> usize { 0 } } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs index 7b60a5ecbd7..1defe6c8b20 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -18,7 +18,7 @@ trait MyTrait { fn get(&self) -> T; } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { fn get(&self) -> T { panic!() } @@ -29,7 +29,7 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { +impl MyTrait for MyType { //~ ERROR E0119 fn get(&self) -> usize { (*self).clone() } } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs index eeaa68677eb..5c5c4d32d67 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs @@ -19,7 +19,7 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { fn get(&self) -> usize { 0 } } @@ -27,7 +27,7 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { +impl MyTrait for MyType { //~ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs b/src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs index d218b64af05..57d71b44b0f 100644 --- a/src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs +++ b/src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs @@ -18,7 +18,7 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { fn get(&self) -> usize { 0 } } @@ -26,7 +26,7 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { +impl MyTrait for MyType { //~ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs index 344ec89d25d..c123e381ab7 100644 --- a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs +++ b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs @@ -15,8 +15,6 @@ trait MyTrait {} struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} -//~^ ERROR conflicting implementations of trait `core::marker::Send` -//~^^ ERROR conflicting implementations of trait `core::marker::Send` impl !Send for TestType {} //~^ ERROR conflicting implementations of trait `core::marker::Send` diff --git a/src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs b/src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs index 3fd635b3d61..928ba7a36db 100644 --- a/src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs +++ b/src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs @@ -19,10 +19,10 @@ trait From { } -impl From for T { //~ ERROR E0119 +impl From for T { } -impl From<(U11,)> for (T11,) { +impl From<(U11,)> for (T11,) { //~ ERROR E0119 } fn main() { } diff --git a/src/test/compile-fail/coherence-overlap-issue-23516.rs b/src/test/compile-fail/coherence-overlap-issue-23516.rs index d7f060a3bfe..51d7c3e8b4c 100644 --- a/src/test/compile-fail/coherence-overlap-issue-23516.rs +++ b/src/test/compile-fail/coherence-overlap-issue-23516.rs @@ -14,6 +14,6 @@ pub trait Sugar { fn dummy(&self) { } } pub trait Sweet { fn dummy(&self) { } } -impl Sweet for T { } //~ ERROR E0119 -impl Sweet for Box { } +impl Sweet for T { } +impl Sweet for Box { } //~ ERROR E0119 fn main() { } diff --git a/src/test/compile-fail/coherence-overlap-messages.rs b/src/test/compile-fail/coherence-overlap-messages.rs index 2a54ad88055..0ae8135221c 100644 --- a/src/test/compile-fail/coherence-overlap-messages.rs +++ b/src/test/compile-fail/coherence-overlap-messages.rs @@ -10,23 +10,23 @@ trait Foo {} -impl Foo for T {} //~ ERROR conflicting implementations of trait `Foo`: -impl Foo for U {} +impl Foo for T {} +impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: trait Bar {} -impl Bar for (T, u8) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: -impl Bar for (u8, T) {} +impl Bar for (T, u8) {} +impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: trait Baz {} -impl Baz for T {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: -impl Baz for u8 {} +impl Baz for T {} +impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: trait Quux {} -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -impl Quux for T {} -impl Quux for T {} +impl Quux for T {} +impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: fn main() {} diff --git a/src/test/compile-fail/coherence-tuple-conflict.rs b/src/test/compile-fail/coherence-tuple-conflict.rs index 87b007fdd69..7807f93df1a 100644 --- a/src/test/compile-fail/coherence-tuple-conflict.rs +++ b/src/test/compile-fail/coherence-tuple-conflict.rs @@ -18,11 +18,11 @@ trait MyTrait { fn get(&self) -> usize; } -impl MyTrait for (T,T) { //~ ERROR E0119 +impl MyTrait for (T,T) { fn get(&self) -> usize { 0 } } -impl MyTrait for (A,B) { +impl MyTrait for (A,B) { //~ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs index a6b62d17bc4..8e3e3f31cb5 100644 --- a/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs +++ b/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs @@ -21,10 +21,10 @@ struct MyType { x: i32 } trait MyTrait { } -impl MyTrait for T { } //~ ERROR E0119 +impl MyTrait for T { } // Tuples are not fundamental. -impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } +impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 #[rustc_error] fn main() { } diff --git a/src/test/compile-fail/coherence_copy_like_err_struct.rs b/src/test/compile-fail/coherence_copy_like_err_struct.rs index 5a9f440f8bb..35bc17b8e88 100644 --- a/src/test/compile-fail/coherence_copy_like_err_struct.rs +++ b/src/test/compile-fail/coherence_copy_like_err_struct.rs @@ -18,7 +18,7 @@ extern crate coherence_copy_like_lib as lib; struct MyType { x: i32 } trait MyTrait { } -impl MyTrait for T { } //~ ERROR E0119 +impl MyTrait for T { } // `MyStruct` is not declared fundamental, therefore this would // require that @@ -26,6 +26,6 @@ impl MyTrait for T { } //~ ERROR E0119 // MyStruct: !MyTrait // // which we cannot approve. -impl MyTrait for lib::MyStruct { } +impl MyTrait for lib::MyStruct { } //~ ERROR E0119 fn main() { } diff --git a/src/test/compile-fail/coherence_copy_like_err_tuple.rs b/src/test/compile-fail/coherence_copy_like_err_tuple.rs index ee0d5550fd6..a70cc92955f 100644 --- a/src/test/compile-fail/coherence_copy_like_err_tuple.rs +++ b/src/test/compile-fail/coherence_copy_like_err_tuple.rs @@ -18,13 +18,13 @@ extern crate coherence_copy_like_lib as lib; struct MyType { x: i32 } trait MyTrait { } -impl MyTrait for T { } //~ ERROR E0119 +impl MyTrait for T { } // Tuples are not fundamental, therefore this would require that // // (MyType,): !MyTrait // // which we cannot approve. -impl MyTrait for (MyType,) { } +impl MyTrait for (MyType,) { } //~ ERROR E0119 fn main() { } diff --git a/src/test/compile-fail/issue-28568.rs b/src/test/compile-fail/issue-28568.rs index 1dfff144cef..7c051784f61 100644 --- a/src/test/compile-fail/issue-28568.rs +++ b/src/test/compile-fail/issue-28568.rs @@ -10,14 +10,14 @@ struct MyStruct; -impl Drop for MyStruct { -//~^ ERROR conflicting implementations of trait - fn drop(&mut self) { } -} - impl Drop for MyStruct { //~^ NOTE conflicting implementation is here fn drop(&mut self) { } } +impl Drop for MyStruct { +//~^ ERROR conflicting implementations of trait + fn drop(&mut self) { } +} + fn main() {}