Skip to content

ICE when combining unsized locals and async #61335

Closed
@syosi

Description

@syosi

It seemed clear to me that having an unsized local across a yield point cannot work.
Indeed, you get an ICE with (playground):

#![feature(async_await)]
#![feature(unsized_locals)]
#![feature(gen_future)]

use std::future::poll_with_tls_context;
use std::pin::Pin;
use std::fmt::Display;

async fn foo2() {}

async fn foo(x: Box<dyn Display>) {
    let x = *x;
    foo2().await;
    println!("hello {}", &x);
}

fn main() {
    let mut a = foo(Box::new(5));
    let b = unsafe {
        Pin::new_unchecked(&mut a)
    };
    match poll_with_tls_context(b) {
        _ => ()
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.F-unsized_locals`#![feature(unsized_locals)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions