about summary refs log tree commit diff
path: root/tests/ui/delegation/impl-trait.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-03-14 15:42:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-04-23 23:05:39 +0300
commit7b7c26f09bbc292da8600e8dfaa454de63ada886 (patch)
tree0c6e30748601dc0cc3a37908bdcf3b0d839cba24 /tests/ui/delegation/impl-trait.rs
parent99b635eafa372d3b8522e978262095f60a8b4e56 (diff)
downloadrust-7b7c26f09bbc292da8600e8dfaa454de63ada886.tar.gz
rust-7b7c26f09bbc292da8600e8dfaa454de63ada886.zip
delegation: Support async, const, extern "ABI" and C-variadic functions
Also allow `impl Trait` in delegated functions.
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
Diffstat (limited to 'tests/ui/delegation/impl-trait.rs')
-rw-r--r--tests/ui/delegation/impl-trait.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/delegation/impl-trait.rs b/tests/ui/delegation/impl-trait.rs
new file mode 100644
index 00000000000..13df0155485
--- /dev/null
+++ b/tests/ui/delegation/impl-trait.rs
@@ -0,0 +1,27 @@
+//@ check-pass
+
+#![feature(fn_delegation)]
+#![allow(incomplete_features)]
+
+mod to_reuse {
+    pub fn foo() -> impl Clone { 0 }
+}
+
+reuse to_reuse::foo;
+
+trait Trait {
+    fn bar() -> impl Clone { 1 }
+}
+
+struct S;
+impl Trait for S {}
+
+impl S {
+    reuse to_reuse::foo;
+    reuse <S as Trait>::bar;
+}
+
+fn main() {
+    foo().clone();
+    <S>::bar().clone();
+}