Skip to content

Commit baac961

Browse files
committed
fix error code for E0751
1 parent 25f070d commit baac961

19 files changed

+30
-30
lines changed

src/librustc_error_codes/error_codes/E0751.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ There are both a positive and negative trait implementation for the same type.
22

33
Erroneous code example:
44

5-
```compile_fail,E0748
5+
```compile_fail,E0751
66
trait MyTrait {}
77
impl MyTrait for i32 { }
88
impl !MyTrait for i32 { }

src/librustc_trait_selection/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn report_negative_positive_conflict(
345345
let mut err = struct_span_err!(
346346
tcx.sess,
347347
impl_span,
348-
E0748,
348+
E0751,
349349
"found both positive and negative implementation of trait `{}`{}:",
350350
overlap.trait_desc,
351351
overlap.self_desc.clone().map_or(String::new(), |ty| format!(" for type `{}`", ty))

src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`:
1+
error[E0751]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`:
22
--> $DIR/coherence-conflicting-negative-trait-impl.rs:11:1
33
|
44
LL | unsafe impl<T: MyTrait + 'static> Send for TestType<T> {}
@@ -18,5 +18,5 @@ LL | unsafe impl<T: 'static> Send for TestType<T> {}
1818

1919
error: aborting due to 2 previous errors
2020

21-
Some errors have detailed explanations: E0119, E0748.
21+
Some errors have detailed explanations: E0119, E0751.
2222
For more information about an error, try `rustc --explain E0119`.

src/test/ui/issues/issue-33140-hack-boundaries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait Trait2 {}
2323

2424
impl Trait2 for dyn Send {}
2525
impl !Trait2 for dyn Send {}
26-
//~^ ERROR E0748
26+
//~^ ERROR E0751
2727

2828
// Problem 3: type parameter
2929
trait Trait3<T: ?Sized> {}

src/test/ui/issues/issue-33140-hack-boundaries.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | impl Trait1 for dyn Send {}
66
LL | impl Trait1 for dyn Send {}
77
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
88

9-
error[E0748]: found both positive and negative implementation of trait `Trait2` for type `(dyn std::marker::Send + 'static)`:
9+
error[E0751]: found both positive and negative implementation of trait `Trait2` for type `(dyn std::marker::Send + 'static)`:
1010
--> $DIR/issue-33140-hack-boundaries.rs:25:1
1111
|
1212
LL | impl Trait2 for dyn Send {}
@@ -64,5 +64,5 @@ LL | impl Trait5 for dyn Send where u32: Copy {}
6464

6565
error: aborting due to 8 previous errors
6666

67-
Some errors have detailed explanations: E0119, E0748.
67+
Some errors have detailed explanations: E0119, E0751.
6868
For more information about an error, try `rustc --explain E0119`.

src/test/ui/specialization/specialization-overlap-negative.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ trait MyTrait {}
66
struct TestType<T>(::std::marker::PhantomData<T>);
77

88
unsafe impl<T: Clone> Send for TestType<T> {}
9-
impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0748
9+
impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0751
1010

1111
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`:
1+
error[E0751]: found both positive and negative implementation of trait `std::marker::Send` for type `TestType<_>`:
22
--> $DIR/specialization-overlap-negative.rs:9:1
33
|
44
LL | unsafe impl<T: Clone> Send for TestType<T> {}
@@ -8,4 +8,4 @@ LL | impl<T: MyTrait> !Send for TestType<T> {}
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0748`.
11+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/specialization/specialization-polarity.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
auto trait Foo {}
88

99
impl<T> Foo for T {}
10-
impl !Foo for u8 {} //~ ERROR E0748
10+
impl !Foo for u8 {} //~ ERROR E0751
1111

1212
auto trait Bar {}
1313

1414
impl<T> !Bar for T {}
15-
impl Bar for u8 {} //~ ERROR E0748
15+
impl Bar for u8 {} //~ ERROR E0751
1616

1717
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0748]: found both positive and negative implementation of trait `Foo` for type `u8`:
1+
error[E0751]: found both positive and negative implementation of trait `Foo` for type `u8`:
22
--> $DIR/specialization-polarity.rs:10:1
33
|
44
LL | impl<T> Foo for T {}
55
| ----------------- positive implementation here
66
LL | impl !Foo for u8 {}
77
| ^^^^^^^^^^^^^^^^ negative implementation here
88

9-
error[E0748]: found both positive and negative implementation of trait `Bar` for type `u8`:
9+
error[E0751]: found both positive and negative implementation of trait `Bar` for type `u8`:
1010
--> $DIR/specialization-polarity.rs:15:1
1111
|
1212
LL | impl<T> !Bar for T {}
@@ -16,4 +16,4 @@ LL | impl Bar for u8 {}
1616

1717
error: aborting due to 2 previous errors
1818

19-
For more information about this error, try `rustc --explain E0748`.
19+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/traits/negative-impls/negative-specializes-positive-item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ trait MyTrait {
88
impl<T> MyTrait for T {
99
default fn foo() {}
1010
}
11-
impl !MyTrait for u32 {} //~ ERROR E0748
11+
impl !MyTrait for u32 {} //~ ERROR E0751
1212

1313
fn main() {}

src/test/ui/traits/negative-impls/negative-specializes-positive-item.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
1+
error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
22
--> $DIR/negative-specializes-positive-item.rs:11:1
33
|
44
LL | impl<T> MyTrait for T {
@@ -9,4 +9,4 @@ LL | impl !MyTrait for u32 {}
99

1010
error: aborting due to previous error
1111

12-
For more information about this error, try `rustc --explain E0748`.
12+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/traits/negative-impls/negative-specializes-positive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Negative impl for u32 cannot "specialize" the base impl.
55
trait MyTrait {}
66
impl<T> MyTrait for T {}
7-
impl !MyTrait for u32 {} //~ ERROR E0748
7+
impl !MyTrait for u32 {} //~ ERROR E0751
88

99
// The second impl specializes the first, no error.
1010
trait MyTrait2 {}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
1+
error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
22
--> $DIR/negative-specializes-positive.rs:7:1
33
|
44
LL | impl<T> MyTrait for T {}
@@ -8,4 +8,4 @@ LL | impl !MyTrait for u32 {}
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0748`.
11+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/traits/negative-impls/pin-unsound-issue-66544-clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::pin::Pin;
55
struct MyType<'a>(Cell<Option<&'a mut MyType<'a>>>, PhantomPinned);
66

77
impl<'a> Clone for &'a mut MyType<'a> {
8-
//~^ ERROR E0748
8+
//~^ ERROR E0751
99
fn clone(&self) -> &'a mut MyType<'a> {
1010
self.0.replace(None).unwrap()
1111
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `std::clone::Clone` for type `&mut MyType<'_>`:
1+
error[E0751]: found both positive and negative implementation of trait `std::clone::Clone` for type `&mut MyType<'_>`:
22
--> $DIR/pin-unsound-issue-66544-clone.rs:7:1
33
|
44
LL | impl<'a> Clone for &'a mut MyType<'a> {
@@ -8,4 +8,4 @@ LL | impl<'a> Clone for &'a mut MyType<'a> {
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0748`.
11+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/traits/negative-impls/pin-unsound-issue-66544-derefmut.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::pin::Pin;
1010
struct MyType<'a>(Cell<Option<&'a mut MyType<'a>>>, PhantomPinned);
1111

1212
impl<'a> DerefMut for &'a MyType<'a> {
13-
//~^ ERROR E0748
13+
//~^ ERROR E0751
1414
fn deref_mut(&mut self) -> &mut MyType<'a> {
1515
self.0.replace(None).unwrap()
1616
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `std::ops::DerefMut` for type `&MyType<'_>`:
1+
error[E0751]: found both positive and negative implementation of trait `std::ops::DerefMut` for type `&MyType<'_>`:
22
--> $DIR/pin-unsound-issue-66544-derefmut.rs:12:1
33
|
44
LL | impl<'a> DerefMut for &'a MyType<'a> {
@@ -8,4 +8,4 @@ LL | impl<'a> DerefMut for &'a MyType<'a> {
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0748`.
11+
For more information about this error, try `rustc --explain E0751`.

src/test/ui/traits/negative-impls/positive-specializes-negative.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
trait MyTrait {}
55

66
impl<T> !MyTrait for T {}
7-
impl MyTrait for u32 {} //~ ERROR E0748
7+
impl MyTrait for u32 {} //~ ERROR E0751
88

99
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0748]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
1+
error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`:
22
--> $DIR/positive-specializes-negative.rs:7:1
33
|
44
LL | impl<T> !MyTrait for T {}
@@ -8,4 +8,4 @@ LL | impl MyTrait for u32 {}
88

99
error: aborting due to previous error
1010

11-
For more information about this error, try `rustc --explain E0748`.
11+
For more information about this error, try `rustc --explain E0751`.

0 commit comments

Comments
 (0)