Skip to content

Commit

Permalink
add new example to reprodue a rust issue
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Nov 22, 2022
1 parent 8f818b7 commit 37bcbde
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/lifetime_issue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "lifetime_issue"
version = "0.1.0"
edition = "2021"

[dependencies]
rio_rt = { path = "../../rt" }
31 changes: 31 additions & 0 deletions examples/lifetime_issue/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use rio_rt::runitime as rio;
use std::future::Future;
use std::io;
use std::pin::Pin;
use std::task::Context;
use std::task::Poll;

pub struct AdaptorFuture<F> {
inner: F,
}

impl<F, T> Future for AdaptorFuture<F>
where
F: Future<Output = T>,
{
type Output = Result<T, io::Error>;

fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {
panic!()
}
}

fn call<R>(req: R) -> AdaptorFuture<R> {
AdaptorFuture {
inner: req,
}
}

fn main() {
rio::block_on(async { call(1); })
}

0 comments on commit 37bcbde

Please sign in to comment.