about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2025-07-11 20:11:49 +0800
committerbohan <bohan-zhang@foxmail.com>2025-07-13 02:52:13 +0800
commitdc6c3300fcf520b2931355e922caa66758becb71 (patch)
treee022929734426c354df6da9cc33f4a79a6e69ca3 /tests
parentbfc046a4b8d6b57db02540182466e989a9b0fb40 (diff)
downloadrust-dc6c3300fcf520b2931355e922caa66758becb71.tar.gz
rust-dc6c3300fcf520b2931355e922caa66758becb71.zip
compute all rpitit of a trait
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs13
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr23
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs
index e3dc22c1992..9c9cef24a96 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs
@@ -43,4 +43,17 @@ trait Qux {
     //~^^^^ ERROR: the name `foo` is defined multiple times
 }
 
+trait T0<T> {
+    type Target;
+}
+trait T1<T> {}
+
+trait X {
+    fn a() -> impl T0<(), Target = impl T1<()>>;
+    fn a() -> impl T0<(), Target = impl T1<()>>;
+    //~^ ERROR the name `a` is defined multiple times
+    fn a() -> impl T0<(), Target = impl T1<()>>;
+    //~^ ERROR the name `a` is defined multiple times
+}
+
 fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr
index f4e73dc1798..8356f94f2aa 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr
@@ -44,6 +44,27 @@ LL | |         >;
    |
    = note: `foo` must be defined only once in the value namespace of this trait
 
-error: aborting due to 4 previous errors
+error[E0428]: the name `a` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:53:5
+   |
+LL |     fn a() -> impl T0<(), Target = impl T1<()>>;
+   |     -------------------------------------------- previous definition of the value `a` here
+LL |     fn a() -> impl T0<(), Target = impl T1<()>>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here
+   |
+   = note: `a` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `a` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:55:5
+   |
+LL |     fn a() -> impl T0<(), Target = impl T1<()>>;
+   |     -------------------------------------------- previous definition of the value `a` here
+...
+LL |     fn a() -> impl T0<(), Target = impl T1<()>>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here
+   |
+   = note: `a` must be defined only once in the value namespace of this trait
+
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0428`.