about summary refs log tree commit diff
path: root/tests/ui/impl-trait/extra-impl-in-trait-impl.rs
diff options
context:
space:
mode:
authory21 <30553356+y21@users.noreply.github.com>2023-05-11 21:55:50 +0200
committery21 <30553356+y21@users.noreply.github.com>2023-05-13 10:51:21 +0200
commit7fe83345ef0204eedd8ac3847a527466f6853c0b (patch)
tree4eebd7ea8dbf0aa0663e32a0b28f65638dee6a1b /tests/ui/impl-trait/extra-impl-in-trait-impl.rs
parent69fef92ab2f287f072b66fb7b4f62c8bb4acba43 (diff)
downloadrust-7fe83345ef0204eedd8ac3847a527466f6853c0b.tar.gz
rust-7fe83345ef0204eedd8ac3847a527466f6853c0b.zip
improve error for `impl<..> impl Trait for Type`
Diffstat (limited to 'tests/ui/impl-trait/extra-impl-in-trait-impl.rs')
-rw-r--r--tests/ui/impl-trait/extra-impl-in-trait-impl.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/extra-impl-in-trait-impl.rs b/tests/ui/impl-trait/extra-impl-in-trait-impl.rs
new file mode 100644
index 00000000000..024b703e6f2
--- /dev/null
+++ b/tests/ui/impl-trait/extra-impl-in-trait-impl.rs
@@ -0,0 +1,19 @@
+// run-rustfix
+
+struct S<T>(T);
+struct S2;
+
+impl<T: Default> impl Default for S<T> {
+    //~^ ERROR: unexpected `impl` keyword
+    //~| HELP: remove the extra `impl`
+    fn default() -> Self { todo!() }
+}
+
+impl impl Default for S2 {
+    //~^ ERROR: unexpected `impl` keyword
+    //~| HELP: remove the extra `impl`
+    fn default() -> Self { todo!() }
+}
+
+
+fn main() {}