Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

future miscompiling to ud2 #60709

Open
ambr-e opened this issue May 10, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@ambr-e
Copy link

commented May 10, 2019

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

@cramertj

This comment has been minimized.

Copy link
Member

commented May 10, 2019

This does not reproduce for me on current nightly (rustc 1.36.0-nightly (a784a8022 2019-05-09)). I wonder if some of @tmandry's generator representation work has affected this.

@Centril

This comment has been minimized.

Copy link
Member

commented May 10, 2019

@cramertj In that case, add it as a regression test?

@tmandry

This comment has been minimized.

Copy link
Contributor

commented May 10, 2019

This was fixed by #59897, specifically 5a7af54. I'm not sure why, though.

@cramertj

This comment has been minimized.

Copy link
Member

commented May 10, 2019

@tmandry possibly the inhabitedness fix?

@tmandry

This comment has been minimized.

Copy link
Contributor

commented May 10, 2019

@cramertj I was thinking that, but Never in this example is very much inhabited.

@cramertj

This comment has been minimized.

Copy link
Member

commented May 11, 2019

@tmandry yeah- the stack slot that it returns to is never going to be hit, though, since it's always pending. Not sure if that matters...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.