diff options
| author | bors <bors@rust-lang.org> | 2020-03-23 12:40:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-23 12:40:36 +0000 |
| commit | 8549cfed4bbcdd28ef3a36e5de72c000e32f650e (patch) | |
| tree | 8767b779bc071839adf90065d75c6d4484634190 /src/test | |
| parent | 5aa8f199c398644d9fc2bb9ac8cffd14f985686d (diff) | |
| parent | b8f98662577f5423e2a2c4ffdfafbad9e4526058 (diff) | |
| download | rust-8549cfed4bbcdd28ef3a36e5de72c000e32f650e.tar.gz rust-8549cfed4bbcdd28ef3a36e5de72c000e32f650e.zip | |
Auto merge of #69649 - estebank:negative-impl-span, r=Centril
Tweak output for invalid negative impl errors
Follow up to #69722. Tweak negative impl errors emitted in the HIR:
```
error[E0192]: invalid negative impl
--> $DIR/E0192.rs:9:6
|
LL | impl !Trait for Foo { }
| ^^^^^^
|
= note: negative impls are only allowed for auto traits, like `Send` and `Sync`
```
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/error-codes/E0192.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/specialization/defaultimpl/validation.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/specialization/defaultimpl/validation.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/syntax-trait-polarity.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/syntax-trait-polarity.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/typeck/typeck-negative-impls-builtin.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/typeck/typeck-negative-impls-builtin.stderr | 8 |
7 files changed, 37 insertions, 23 deletions
diff --git a/src/test/ui/error-codes/E0192.stderr b/src/test/ui/error-codes/E0192.stderr index 8faa550a509..da706dea167 100644 --- a/src/test/ui/error-codes/E0192.stderr +++ b/src/test/ui/error-codes/E0192.stderr @@ -1,8 +1,10 @@ -error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/E0192.rs:9:1 +error[E0192]: invalid negative impl + --> $DIR/E0192.rs:9:6 | LL | impl !Trait for Foo { } - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ + | + = note: negative impls are only allowed for auto traits, like `Send` and `Sync` error: aborting due to previous error diff --git a/src/test/ui/specialization/defaultimpl/validation.rs b/src/test/ui/specialization/defaultimpl/validation.rs index 26b3f1ec414..5b8a72104e3 100644 --- a/src/test/ui/specialization/defaultimpl/validation.rs +++ b/src/test/ui/specialization/defaultimpl/validation.rs @@ -10,6 +10,6 @@ default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be defau default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default trait Tr {} -default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits +default impl !Tr for S {} //~ ERROR invalid negative impl fn main() {} diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr index 6e19d79e48f..e03153f343b 100644 --- a/src/test/ui/specialization/defaultimpl/validation.stderr +++ b/src/test/ui/specialization/defaultimpl/validation.stderr @@ -9,22 +9,28 @@ LL | default impl S {} = note: only trait implementations may be annotated with `default` error: impls of auto traits cannot be default - --> $DIR/validation.rs:9:1 + --> $DIR/validation.rs:9:21 | LL | default unsafe impl Send for S {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ------- ^^^^ auto trait + | | + | default because of this error: impls of auto traits cannot be default - --> $DIR/validation.rs:10:1 + --> $DIR/validation.rs:10:15 | LL | default impl !Send for Z {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ------- ^^^^ auto trait + | | + | default because of this -error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/validation.rs:13:1 +error[E0192]: invalid negative impl + --> $DIR/validation.rs:13: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 diff --git a/src/test/ui/syntax-trait-polarity.rs b/src/test/ui/syntax-trait-polarity.rs index 1b7fc1587e6..bfbe6394c16 100644 --- a/src/test/ui/syntax-trait-polarity.rs +++ b/src/test/ui/syntax-trait-polarity.rs @@ -12,7 +12,7 @@ trait TestTrait {} unsafe impl !Send for TestType {} //~^ ERROR negative impls cannot be unsafe impl !TestTrait for TestType {} -//~^ ERROR negative impls are only allowed for auto traits +//~^ ERROR invalid negative impl struct TestType2<T>(T); @@ -22,6 +22,6 @@ impl<T> !TestType2<T> {} unsafe impl<T> !Send for TestType2<T> {} //~^ ERROR negative impls cannot be unsafe impl<T> !TestTrait for TestType2<T> {} -//~^ ERROR negative impls are only allowed for auto traits +//~^ ERROR invalid negative impl fn main() {} diff --git a/src/test/ui/syntax-trait-polarity.stderr b/src/test/ui/syntax-trait-polarity.stderr index 5777e0ade90..f70d67ec7dc 100644 --- a/src/test/ui/syntax-trait-polarity.stderr +++ b/src/test/ui/syntax-trait-polarity.stderr @@ -32,17 +32,21 @@ LL | unsafe impl<T> !Send for TestType2<T> {} | | negative because of this | unsafe because of this -error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/syntax-trait-polarity.rs:14:1 +error[E0192]: invalid negative impl + --> $DIR/syntax-trait-polarity.rs:14:6 | LL | impl !TestTrait for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ + | + = note: negative impls are only allowed for auto traits, like `Send` and `Sync` -error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/syntax-trait-polarity.rs:24:1 +error[E0192]: invalid negative impl + --> $DIR/syntax-trait-polarity.rs:24:9 | LL | impl<T> !TestTrait for TestType2<T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ + | + = note: negative impls are only allowed for auto traits, like `Send` and `Sync` error: aborting due to 6 previous errors diff --git a/src/test/ui/typeck/typeck-negative-impls-builtin.rs b/src/test/ui/typeck/typeck-negative-impls-builtin.rs index 7bdd1035a1b..fef98977cc4 100644 --- a/src/test/ui/typeck/typeck-negative-impls-builtin.rs +++ b/src/test/ui/typeck/typeck-negative-impls-builtin.rs @@ -7,6 +7,6 @@ trait TestTrait { } impl !TestTrait for TestType {} -//~^ ERROR negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) +//~^ ERROR invalid negative impl fn main() {} diff --git a/src/test/ui/typeck/typeck-negative-impls-builtin.stderr b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr index 4e3d054ff6f..c90655086ac 100644 --- a/src/test/ui/typeck/typeck-negative-impls-builtin.stderr +++ b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr @@ -1,8 +1,10 @@ -error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/typeck-negative-impls-builtin.rs:9:1 +error[E0192]: invalid negative impl + --> $DIR/typeck-negative-impls-builtin.rs:9:6 | LL | impl !TestTrait for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ + | + = note: negative impls are only allowed for auto traits, like `Send` and `Sync` error: aborting due to previous error |
