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

Comments

@ambr-e
Copy link

@ambr-e 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

@cramertj cramertj 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
Copy link
Contributor

@Centril Centril commented May 10, 2019

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

@tmandry
Copy link
Contributor

@tmandry tmandry commented May 10, 2019

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

@cramertj
Copy link
Member

@cramertj cramertj commented May 10, 2019

@tmandry possibly the inhabitedness fix?

@tmandry
Copy link
Contributor

@tmandry tmandry commented May 10, 2019

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

@cramertj
Copy link
Member

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

@nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jun 4, 2019

Marking as deferred, not blocking stabilization.

tmandry added a commit to tmandry/rust that referenced this issue Jun 14, 2019
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
Issue rust-lang#60709 test

Adds a test for rust-lang#60709, which was fixed as part of rust-lang#59897.

r? @cramertj
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
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
tmandry added a commit to tmandry/rust that referenced this issue Jun 25, 2019
tmandry added a commit to tmandry/rust that referenced this issue Jun 25, 2019
Centril added a commit to Centril/rust that referenced this issue Jun 29, 2019
Issue rust-lang#60709 test

Adds a test for rust-lang#60709, which was fixed as part of rust-lang#59897.

r? @cramertj
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 in 65021ec Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants