From baac961fb5e50cdd4f537af75e95e1ad3f358bc9 Mon Sep 17 00:00:00 2001 From: YI Date: Wed, 22 Apr 2020 20:18:22 +0800 Subject: [PATCH] fix error code for E0751 --- src/librustc_error_codes/error_codes/E0751.md | 2 +- src/librustc_trait_selection/traits/specialize/mod.rs | 2 +- .../coherence-conflicting-negative-trait-impl.stderr | 4 ++-- src/test/ui/issues/issue-33140-hack-boundaries.rs | 2 +- src/test/ui/issues/issue-33140-hack-boundaries.stderr | 4 ++-- .../ui/specialization/specialization-overlap-negative.rs | 2 +- .../specialization/specialization-overlap-negative.stderr | 4 ++-- src/test/ui/specialization/specialization-polarity.rs | 4 ++-- src/test/ui/specialization/specialization-polarity.stderr | 6 +++--- .../negative-impls/negative-specializes-positive-item.rs | 2 +- .../negative-specializes-positive-item.stderr | 4 ++-- .../traits/negative-impls/negative-specializes-positive.rs | 2 +- .../negative-impls/negative-specializes-positive.stderr | 4 ++-- .../traits/negative-impls/pin-unsound-issue-66544-clone.rs | 2 +- .../negative-impls/pin-unsound-issue-66544-clone.stderr | 4 ++-- .../negative-impls/pin-unsound-issue-66544-derefmut.rs | 2 +- .../negative-impls/pin-unsound-issue-66544-derefmut.stderr | 4 ++-- .../traits/negative-impls/positive-specializes-negative.rs | 2 +- .../negative-impls/positive-specializes-negative.stderr | 4 ++-- 19 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0751.md b/src/librustc_error_codes/error_codes/E0751.md index a440f82e4b6b3..809b888d92ac3 100644 --- a/src/librustc_error_codes/error_codes/E0751.md +++ b/src/librustc_error_codes/error_codes/E0751.md @@ -2,7 +2,7 @@ There are both a positive and negative trait implementation for the same type. Erroneous code example: -```compile_fail,E0748 +```compile_fail,E0751 trait MyTrait {} impl MyTrait for i32 { } impl !MyTrait for i32 { } diff --git a/src/librustc_trait_selection/traits/specialize/mod.rs b/src/librustc_trait_selection/traits/specialize/mod.rs index fabd8c89b72af..57d13e35fd2dc 100644 --- a/src/librustc_trait_selection/traits/specialize/mod.rs +++ b/src/librustc_trait_selection/traits/specialize/mod.rs @@ -345,7 +345,7 @@ fn report_negative_positive_conflict( let mut err = struct_span_err!( tcx.sess, impl_span, - E0748, + E0751, "found both positive and negative implementation of trait `{}`{}:", overlap.trait_desc, overlap.self_desc.clone().map_or(String::new(), |ty| format!(" for type `{}`", ty)) diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr index 5081536b70245..4d9f815c79581 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`: +error[E0751]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`: --> $DIR/coherence-conflicting-negative-trait-impl.rs:11:1 | LL | unsafe impl Send for TestType {} @@ -18,5 +18,5 @@ LL | unsafe impl Send for TestType {} error: aborting due to 2 previous errors -Some errors have detailed explanations: E0119, E0748. +Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/issues/issue-33140-hack-boundaries.rs b/src/test/ui/issues/issue-33140-hack-boundaries.rs index 5984a256a3086..d091162fced6b 100644 --- a/src/test/ui/issues/issue-33140-hack-boundaries.rs +++ b/src/test/ui/issues/issue-33140-hack-boundaries.rs @@ -23,7 +23,7 @@ trait Trait2 {} impl Trait2 for dyn Send {} impl !Trait2 for dyn Send {} -//~^ ERROR E0748 +//~^ ERROR E0751 // Problem 3: type parameter trait Trait3 {} diff --git a/src/test/ui/issues/issue-33140-hack-boundaries.stderr b/src/test/ui/issues/issue-33140-hack-boundaries.stderr index b3bf34a2a9031..ae65701ecb52a 100644 --- a/src/test/ui/issues/issue-33140-hack-boundaries.stderr +++ b/src/test/ui/issues/issue-33140-hack-boundaries.stderr @@ -6,7 +6,7 @@ LL | impl Trait1 for dyn Send {} LL | impl Trait1 for dyn Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` -error[E0748]: found both positive and negative implementation of trait `Trait2` for type `(dyn std::marker::Send + 'static)`: +error[E0751]: found both positive and negative implementation of trait `Trait2` for type `(dyn std::marker::Send + 'static)`: --> $DIR/issue-33140-hack-boundaries.rs:25:1 | LL | impl Trait2 for dyn Send {} @@ -64,5 +64,5 @@ LL | impl Trait5 for dyn Send where u32: Copy {} error: aborting due to 8 previous errors -Some errors have detailed explanations: E0119, E0748. +Some errors have detailed explanations: E0119, E0751. For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/specialization/specialization-overlap-negative.rs b/src/test/ui/specialization/specialization-overlap-negative.rs index dff2b28bf003c..90dbef3075b7f 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.rs +++ b/src/test/ui/specialization/specialization-overlap-negative.rs @@ -6,6 +6,6 @@ trait MyTrait {} struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} -impl !Send for TestType {} //~ ERROR E0748 +impl !Send for TestType {} //~ ERROR E0751 fn main() {} diff --git a/src/test/ui/specialization/specialization-overlap-negative.stderr b/src/test/ui/specialization/specialization-overlap-negative.stderr index cbc7271b199a6..e2616534d2041 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.stderr +++ b/src/test/ui/specialization/specialization-overlap-negative.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`: +error[E0751]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`: --> $DIR/specialization-overlap-negative.rs:9:1 | LL | unsafe impl Send for TestType {} @@ -8,4 +8,4 @@ LL | impl !Send for TestType {} error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/specialization/specialization-polarity.rs b/src/test/ui/specialization/specialization-polarity.rs index 4a733fb3c497e..e78035f171075 100644 --- a/src/test/ui/specialization/specialization-polarity.rs +++ b/src/test/ui/specialization/specialization-polarity.rs @@ -7,11 +7,11 @@ auto trait Foo {} impl Foo for T {} -impl !Foo for u8 {} //~ ERROR E0748 +impl !Foo for u8 {} //~ ERROR E0751 auto trait Bar {} impl !Bar for T {} -impl Bar for u8 {} //~ ERROR E0748 +impl Bar for u8 {} //~ ERROR E0751 fn main() {} diff --git a/src/test/ui/specialization/specialization-polarity.stderr b/src/test/ui/specialization/specialization-polarity.stderr index 30655d87d5500..44e60cad67aa4 100644 --- a/src/test/ui/specialization/specialization-polarity.stderr +++ b/src/test/ui/specialization/specialization-polarity.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `Foo` for type `u8`: +error[E0751]: found both positive and negative implementation of trait `Foo` for type `u8`: --> $DIR/specialization-polarity.rs:10:1 | LL | impl Foo for T {} @@ -6,7 +6,7 @@ LL | impl Foo for T {} LL | impl !Foo for u8 {} | ^^^^^^^^^^^^^^^^ negative implementation here -error[E0748]: found both positive and negative implementation of trait `Bar` for type `u8`: +error[E0751]: found both positive and negative implementation of trait `Bar` for type `u8`: --> $DIR/specialization-polarity.rs:15:1 | LL | impl !Bar for T {} @@ -16,4 +16,4 @@ LL | impl Bar for u8 {} error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/traits/negative-impls/negative-specializes-positive-item.rs b/src/test/ui/traits/negative-impls/negative-specializes-positive-item.rs index 043273e624189..da22e43377f52 100644 --- a/src/test/ui/traits/negative-impls/negative-specializes-positive-item.rs +++ b/src/test/ui/traits/negative-impls/negative-specializes-positive-item.rs @@ -8,6 +8,6 @@ trait MyTrait { impl MyTrait for T { default fn foo() {} } -impl !MyTrait for u32 {} //~ ERROR E0748 +impl !MyTrait for u32 {} //~ ERROR E0751 fn main() {} diff --git a/src/test/ui/traits/negative-impls/negative-specializes-positive-item.stderr b/src/test/ui/traits/negative-impls/negative-specializes-positive-item.stderr index 21fd08251d474..079546a7df40b 100644 --- a/src/test/ui/traits/negative-impls/negative-specializes-positive-item.stderr +++ b/src/test/ui/traits/negative-impls/negative-specializes-positive-item.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`: +error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/negative-specializes-positive-item.rs:11:1 | LL | impl MyTrait for T { @@ -9,4 +9,4 @@ LL | impl !MyTrait for u32 {} error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/traits/negative-impls/negative-specializes-positive.rs b/src/test/ui/traits/negative-impls/negative-specializes-positive.rs index ac0fac10eef50..1939a098b50ee 100644 --- a/src/test/ui/traits/negative-impls/negative-specializes-positive.rs +++ b/src/test/ui/traits/negative-impls/negative-specializes-positive.rs @@ -4,7 +4,7 @@ // Negative impl for u32 cannot "specialize" the base impl. trait MyTrait {} impl MyTrait for T {} -impl !MyTrait for u32 {} //~ ERROR E0748 +impl !MyTrait for u32 {} //~ ERROR E0751 // The second impl specializes the first, no error. trait MyTrait2 {} diff --git a/src/test/ui/traits/negative-impls/negative-specializes-positive.stderr b/src/test/ui/traits/negative-impls/negative-specializes-positive.stderr index 0e7426c826028..ea005c1cbe0c6 100644 --- a/src/test/ui/traits/negative-impls/negative-specializes-positive.stderr +++ b/src/test/ui/traits/negative-impls/negative-specializes-positive.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`: +error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/negative-specializes-positive.rs:7:1 | LL | impl MyTrait for T {} @@ -8,4 +8,4 @@ LL | impl !MyTrait for u32 {} error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.rs b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.rs index d9c498fca6645..499ac461e59a5 100644 --- a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.rs +++ b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.rs @@ -5,7 +5,7 @@ use std::pin::Pin; struct MyType<'a>(Cell>>, PhantomPinned); impl<'a> Clone for &'a mut MyType<'a> { - //~^ ERROR E0748 + //~^ ERROR E0751 fn clone(&self) -> &'a mut MyType<'a> { self.0.replace(None).unwrap() } diff --git a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.stderr b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.stderr index f3305722cf2d3..d7039e3db6bde 100644 --- a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.stderr +++ b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `std::clone::Clone` for type `&mut MyType<'_>`: +error[E0751]: found both positive and negative implementation of trait `std::clone::Clone` for type `&mut MyType<'_>`: --> $DIR/pin-unsound-issue-66544-clone.rs:7:1 | LL | impl<'a> Clone for &'a mut MyType<'a> { @@ -8,4 +8,4 @@ LL | impl<'a> Clone for &'a mut MyType<'a> { error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.rs b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.rs index cc27c301ffa9d..245be80078056 100644 --- a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.rs +++ b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.rs @@ -10,7 +10,7 @@ use std::pin::Pin; struct MyType<'a>(Cell>>, PhantomPinned); impl<'a> DerefMut for &'a MyType<'a> { - //~^ ERROR E0748 + //~^ ERROR E0751 fn deref_mut(&mut self) -> &mut MyType<'a> { self.0.replace(None).unwrap() } diff --git a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.stderr b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.stderr index 4e71c2468246b..a0b62a8bab68f 100644 --- a/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.stderr +++ b/src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `std::ops::DerefMut` for type `&MyType<'_>`: +error[E0751]: found both positive and negative implementation of trait `std::ops::DerefMut` for type `&MyType<'_>`: --> $DIR/pin-unsound-issue-66544-derefmut.rs:12:1 | LL | impl<'a> DerefMut for &'a MyType<'a> { @@ -8,4 +8,4 @@ LL | impl<'a> DerefMut for &'a MyType<'a> { error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`. diff --git a/src/test/ui/traits/negative-impls/positive-specializes-negative.rs b/src/test/ui/traits/negative-impls/positive-specializes-negative.rs index eac4c24d5d3d0..f2c5f507a4ebb 100644 --- a/src/test/ui/traits/negative-impls/positive-specializes-negative.rs +++ b/src/test/ui/traits/negative-impls/positive-specializes-negative.rs @@ -4,6 +4,6 @@ trait MyTrait {} impl !MyTrait for T {} -impl MyTrait for u32 {} //~ ERROR E0748 +impl MyTrait for u32 {} //~ ERROR E0751 fn main() {} diff --git a/src/test/ui/traits/negative-impls/positive-specializes-negative.stderr b/src/test/ui/traits/negative-impls/positive-specializes-negative.stderr index ab371945a7eab..a24d7aa442f4a 100644 --- a/src/test/ui/traits/negative-impls/positive-specializes-negative.stderr +++ b/src/test/ui/traits/negative-impls/positive-specializes-negative.stderr @@ -1,4 +1,4 @@ -error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`: +error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/positive-specializes-negative.rs:7:1 | LL | impl !MyTrait for T {} @@ -8,4 +8,4 @@ LL | impl MyTrait for u32 {} error: aborting due to previous error -For more information about this error, try `rustc --explain E0748`. +For more information about this error, try `rustc --explain E0751`.