about summary refs log tree commit diff
path: root/tests/ui/auto-traits/auto-trait-validation.fixed
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-02-28 23:37:37 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-08-04 17:20:07 +0000
commit91e606b715ac4e8f59fac86d42ec2ad23f4ef169 (patch)
tree78664d6652a1c1d5fde0dc0e1882544b24cef2c9 /tests/ui/auto-traits/auto-trait-validation.fixed
parente5e79f8bd428d0b8d26e8240d718b134ef297459 (diff)
downloadrust-91e606b715ac4e8f59fac86d42ec2ad23f4ef169.tar.gz
rust-91e606b715ac4e8f59fac86d42ec2ad23f4ef169.zip
Tweak auto trait errors
Make suggestions to remove params and super traits tool-only, and make
the suggestion span more accurate.

```
error[E0567]: auto traits cannot have generic parameters
  --> $DIR/auto-trait-validation.rs:6:19
   |
LL | auto trait Generic<T> {}
   |            -------^^^
   |            |
   |            auto trait cannot have generic parameters

error[E0568]: auto traits cannot have super traits or lifetime bounds
  --> $DIR/auto-trait-validation.rs:8:20
   |
LL | auto trait Bound : Copy {}
   |            -----   ^^^^
   |            |
   |            auto traits cannot have super traits or lifetime bounds
```

```
error[E0380]: auto traits cannot have associated items
  --> $DIR/issue-23080.rs:5:8
   |
LL | unsafe auto trait Trait {
   |                   ----- auto traits cannot have associated items
LL |     fn method(&self) {
   |        ^^^^^^
```
Diffstat (limited to 'tests/ui/auto-traits/auto-trait-validation.fixed')
-rw-r--r--tests/ui/auto-traits/auto-trait-validation.fixed11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/auto-traits/auto-trait-validation.fixed b/tests/ui/auto-traits/auto-trait-validation.fixed
index 8a445448c85..b24dc1cb2c3 100644
--- a/tests/ui/auto-traits/auto-trait-validation.fixed
+++ b/tests/ui/auto-traits/auto-trait-validation.fixed
@@ -11,4 +11,15 @@ auto trait LifetimeBound {}
 //~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
 auto trait MyTrait {  }
 //~^ ERROR auto traits cannot have associated items [E0380]
+auto trait AssocTy {  }
+//~^ ERROR auto traits cannot have associated items [E0380]
+auto trait All {
+    //~^ ERROR auto traits cannot have generic parameters [E0567]
+    
+}
+// We can't test both generic params and super-traits because the suggestion span overlaps.
+auto trait All2 {
+    //~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
+    
+}
 fn main() {}