Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/async-await/in-trait/async-example-desugared.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
261 B
Rust
Raw Normal View History

Add additional tests for static AFIT
2022-10-07 16:15:13 +00:00
//@ check-pass
//@ edition: 2021
use std::future::Future;
trait MyTrait {
Bless tests
2023-09-26 20:20:25 +00:00
#[allow(async_fn_in_trait)]
Add additional tests for static AFIT
2022-10-07 16:15:13 +00:00
async fn foo(&self) -> i32;
}
impl MyTrait for i32 {
Implement refinement lint for RPITIT
2023-09-02 04:02:11 +00:00
fn foo(&self) -> impl Future<Output = i32> {
Ensure async trait impls are async (or otherwise return an opaque type) As a workaround for the full `#[refine]` semantics not being implemented yet, forbit returning a concrete future type like `Box<dyn Future>` or a manually implemented Future. `-> impl Future` is still permitted; while that can also cause accidental refinement, that's behind a different feature gate (`return_position_impl_trait_in_trait`) and that problem exists regardless of whether the trait method is async, so will have to be solved more generally. Fixes #102745
2022-11-02 17:45:08 -07:00
async { *self }
Add additional tests for static AFIT
2022-10-07 16:15:13 +00:00
}
}
fn main() {}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 999ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API