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

Closed
ambr-e opened this issue May 10, 2019 · 7 comments
Closed

future miscompiling to ud2 #60709

ambr-e opened this issue May 10, 2019 · 7 comments
Labels
A-async-await Area: Async & Await AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ambr-e
Copy link

ambr-e 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
Copy link
Member

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 Centril added A-async-await Area: Async & Await E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. labels May 10, 2019
@Centril
Copy link
Contributor

Centril commented May 10, 2019

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

@tmandry
Copy link
Member

tmandry commented May 10, 2019

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

@cramertj
Copy link
Member

@tmandry possibly the inhabitedness fix?

@tmandry
Copy link
Member

tmandry commented May 10, 2019

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

@cramertj
Copy link
Member

@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...

@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. labels Jun 4, 2019
@nikomatsakis
Copy link
Contributor

Marking as deferred, not blocking stabilization.

tmandry added a commit to tmandry/rust that referenced this issue Jun 14, 2019
Centril added a commit to Centril/rust that referenced this issue Jun 14, 2019
bors added a commit that referenced this issue Jun 14, 2019
Rollup of 5 pull requests

Successful merges:

 - #61704 (Pass LLVM linker flags to librustc_llvm build)
 - #61792 (Add ui test for issue 51301)
 - #61803 (typeck: small refactoring, add 'fn write_resolution')
 - #61805 (typeck: Fix ICE for blocks in repeat expr count.)
 - #61818 (Issue #60709 test)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this issue Jun 29, 2019
bors added a commit that referenced this issue Jun 29, 2019
Rollup of 7 pull requests

Successful merges:

 - #61199 (Revert "Set test flag when rustdoc is running with --test option" )
 - #61755 (Add `--pass $mode` to compiletest through `./x.py`)
 - #61818 (Issue #60709 test)
 - #62023 (publish_toolstate: don't use 'new' from inside the loop)
 - #62104 (Inform the query system about properties of queries at compile time)
 - #62163 (Avoid mem::uninitialized() in std::sys::unix)
 - #62204 (doc(libcore) Fix CS)

Failed merges:

r? @ghost
@bors bors closed this as completed in 65021ec Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants