Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error code in E0751.md #71426

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0751.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trait_selection/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T: MyTrait + 'static> Send for TestType<T> {}
Expand All @@ -18,5 +18,5 @@ LL | unsafe impl<T: 'static> Send for TestType<T> {}

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`.
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-33140-hack-boundaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: ?Sized> {}
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-33140-hack-boundaries.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ trait MyTrait {}
struct TestType<T>(::std::marker::PhantomData<T>);

unsafe impl<T: Clone> Send for TestType<T> {}
impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0748
impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0751

fn main() {}
Original file line number Diff line number Diff line change
@@ -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<T: Clone> Send for TestType<T> {}
Expand All @@ -8,4 +8,4 @@ LL | impl<T: MyTrait> !Send for TestType<T> {}

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`.
4 changes: 2 additions & 2 deletions src/test/ui/specialization/specialization-polarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
auto trait Foo {}

impl<T> Foo for T {}
impl !Foo for u8 {} //~ ERROR E0748
impl !Foo for u8 {} //~ ERROR E0751

auto trait Bar {}

impl<T> !Bar for T {}
impl Bar for u8 {} //~ ERROR E0748
impl Bar for u8 {} //~ ERROR E0751

fn main() {}
6 changes: 3 additions & 3 deletions src/test/ui/specialization/specialization-polarity.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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<T> Foo for T {}
| ----------------- positive implementation here
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<T> !Bar for T {}
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ trait MyTrait {
impl<T> MyTrait for T {
default fn foo() {}
}
impl !MyTrait for u32 {} //~ ERROR E0748
impl !MyTrait for u32 {} //~ ERROR E0751

fn main() {}
Original file line number Diff line number Diff line change
@@ -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<T> MyTrait for T {
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Negative impl for u32 cannot "specialize" the base impl.
trait MyTrait {}
impl<T> 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 {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T> MyTrait for T {}
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::pin::Pin;
struct MyType<'a>(Cell<Option<&'a mut MyType<'a>>>, 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()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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> {
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::pin::Pin;
struct MyType<'a>(Cell<Option<&'a mut MyType<'a>>>, 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()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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> {
Expand All @@ -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`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
trait MyTrait {}

impl<T> !MyTrait for T {}
impl MyTrait for u32 {} //~ ERROR E0748
impl MyTrait for u32 {} //~ ERROR E0751

fn main() {}
Original file line number Diff line number Diff line change
@@ -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<T> !MyTrait for T {}
Expand All @@ -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`.