Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Lifetime issues with arguments to function calls that are awaited on #18

Closed
@alex

Description

@alex

I wasn't sure if this was a Rust bug, a futures-await bug, or a duplicate of one of the several other lifetime issues :-)

I've minimized this issue down to the following code:

#![feature(conservative_impl_trait, generators, proc_macro)]

extern crate futures_await as futures;

use futures::prelude::*;


fn f1<'a>(_: &'a [u8]) -> impl Future<Item=(), Error=()> + 'a {
    return futures::future::ok(());
}

#[async]
fn g1(v: Vec<u8>) -> Result<(), ()> {
    await!(f1(&v)).unwrap();
    Ok(())
}

fn f2(_: &[u8]) -> impl Future<Item=(), Error=()> {
    return futures::future::ok(());
}

#[async]
fn g2(v: Vec<u8>) -> Result<(), ()> {
    await!(f2(&v)).unwrap();
    Ok(())
}

f2/g2 using the default lifetimes compiles fine, however f1/g1 makes the compiler sad.

This was surprising to me, as I naively expected them to either both be accepted or both be rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions