about summary refs log tree commit diff
path: root/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-03-08 19:44:43 +0000
committerMichael Goulet <michael@errs.io>2025-03-08 20:40:59 +0000
commitbca0ab8d7a7b06406966c7a710e9f4ad61d064fb (patch)
treeba9ca27636500cce937b118aef2e52bed2a095d1 /tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs
parent07292ccccde8b64d87036b2f90b70bc54ab68456 (diff)
downloadrust-bca0ab8d7a7b06406966c7a710e9f4ad61d064fb.tar.gz
rust-bca0ab8d7a7b06406966c7a710e9f4ad61d064fb.zip
Rework maybe_suggest_add_generic_impl_trait
Diffstat (limited to 'tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs')
-rw-r--r--tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs
new file mode 100644
index 00000000000..dcbed027c74
--- /dev/null
+++ b/tests/ui/dyn-keyword/suggest-struct-or-union-add-generic-impl-trait.rs
@@ -0,0 +1,34 @@
+//@ edition:2021
+trait Trait {}
+
+struct Foo1 {
+    a: Trait,
+    //~^ ERROR expected a type, found a trait
+    b: u32,
+}
+
+struct Foo2 {
+    a: i32,
+    b: Trait,
+    //~^ ERROR expected a type, found a trait
+}
+
+enum Enum1 {
+    A(Trait),
+    //~^ ERROR expected a type, found a trait
+    B(u32),
+}
+
+enum Enum2 {
+    A(u32),
+    B(Trait),
+    //~^ ERROR expected a type, found a trait
+}
+
+// Regression test for <https://github.com/rust-lang/rust/issues/138229>.
+pub struct InWhereClause
+where
+    Trait:, {}
+//~^ ERROR expected a type, found a trait
+
+fn main() {}