Rollup merge of #71426 - contrun:fix-e0751-explanation, r=estebank

fix error code in E0751.md

reference: https://github.com/rust-lang/rust/issues/71304
This commit is contained in:
Dylan DPC 2020-04-24 02:47:35 +02:00 committed by GitHub
commit fa7fb932cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 30 additions and 30 deletions

View File

@ -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 { }

View File

@ -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))

View File

@ -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> {}
@ -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`.

View File

@ -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> {}

View File

@ -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`.

View File

@ -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() {}

View File

@ -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> {}
@ -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`.

View File

@ -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() {}

View File

@ -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<T> Foo for T {}
@ -6,7 +6,7 @@ LL | impl<T> 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<T> !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`.

View File

@ -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() {}

View File

@ -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 {
@ -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`.

View File

@ -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 {}

View File

@ -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 {}
@ -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`.

View File

@ -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()
}

View File

@ -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`.

View File

@ -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()
}

View File

@ -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`.

View File

@ -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() {}

View File

@ -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 {}
@ -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`.