diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-16 20:18:13 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-12-10 16:52:20 +0000 |
| commit | a7fa4cbcb498b80b126a954b5944f19a11e28dec (patch) | |
| tree | 462d7ced92d08e35a6cae86caeb804c8dbefb635 /tests/ui/async-await/dyn/wrong-size.rs | |
| parent | 3b057796264e637b31c28809322028a32d22ae6f (diff) | |
| download | rust-a7fa4cbcb498b80b126a954b5944f19a11e28dec.tar.gz rust-a7fa4cbcb498b80b126a954b5944f19a11e28dec.zip | |
Implement projection and shim for AFIDT
Diffstat (limited to 'tests/ui/async-await/dyn/wrong-size.rs')
| -rw-r--r-- | tests/ui/async-await/dyn/wrong-size.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/async-await/dyn/wrong-size.rs b/tests/ui/async-await/dyn/wrong-size.rs new file mode 100644 index 00000000000..ac15dd26067 --- /dev/null +++ b/tests/ui/async-await/dyn/wrong-size.rs @@ -0,0 +1,23 @@ +//@ edition: 2021 + +#![feature(async_fn_in_dyn_trait)] +//~^ WARN the feature `async_fn_in_dyn_trait` is incomplete + +use std::future::Future; + +trait AsyncTrait { + async fn async_dispatch(&self); +} + +impl AsyncTrait for &'static str { + fn async_dispatch(&self) -> impl Future<Output = ()> { + async move { + // The implementor must box the future... + } + } +} + +fn main() { + let x: &dyn AsyncTrait = &"hello, world!"; + //~^ ERROR `impl Future<Output = ()>` needs to have the same ABI as a pointer +} |
