Skip to content

future miscompiling to ud2 #60709

Closed
Closed
@ambr-e

Description

@ambr-e

Using rustc 1.36.0-nightly (3991285 2019-04-25), the following test compiles to ud2, when using the following command: rustc --edition=2018 -Copt-level=z -Cdebuginfo=2 --test test.rs -o test. Both the opt-level and debuginfo are necessary to get ud2.

#![feature(async_await, await_macro)]
#![allow(unused)]

#[cfg(test)]
mod tests {
    use std::future::Future;
    use std::task::Poll;
    use std::task::Context;
    use std::pin::Pin;
    use std::rc::Rc;
    
    struct Never();
    impl Future for Never {
        type Output = ();
        fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
            Poll::Pending
        }
    }

    #[test]
    fn crashing_test() {
        let fut = async {
            let _rc = Rc::new(()); // Also crashes with Arc
            await!(Never());
        };
        let _bla = fut; // Moving the future is required.
    }
}

@cramertj @tmandry

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions