permit negative impls for non-auto traits

This commit is contained in:
Niko Matsakis 2020-01-08 06:39:38 -05:00
parent a17dd36084
commit e8a05e201e
35 changed files with 328 additions and 101 deletions

View file

@ -8,8 +8,9 @@ default impl S {} //~ ERROR inherent impls cannot be `default`
default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default
default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default
//~^ ERROR negative impls cannot be default impls
trait Tr {}
default impl !Tr for S {} //~ ERROR invalid negative impl
default impl !Tr for S {} //~ ERROR negative impls cannot be default impls
fn main() {}

View file

@ -24,14 +24,18 @@ LL | default impl !Send for Z {}
| |
| default because of this
error[E0192]: invalid negative impl
--> $DIR/validation.rs:13:14
error[E0750]: negative impls cannot be default impls
--> $DIR/validation.rs:10:14
|
LL | default impl !Send for Z {}
| ^^^^^^^ ^
error[E0750]: negative impls cannot be default impls
--> $DIR/validation.rs:14:14
|
LL | default impl !Tr for S {}
| ^^^
|
= note: negative impls are only allowed for auto traits, like `Send` and `Sync`
| ^^^^^^^ ^
error: aborting due to 4 previous errors
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0192`.
For more information about this error, try `rustc --explain E0750`.