Skip to content

Internal compiler error with 'impl_trait_in_bindings' feature #87295

Closed
@chertov

Description

@chertov

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=44178d36861a0d770480156b511a3c15

Code

#![feature(impl_trait_in_bindings)]

use tokio; // 1.7.1
use std::pin::Pin;
use futures::future::{ Future, FutureExt, Fuse, OptionFuture };

enum State {Init}

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {

    let mut _keep_alive_rpc : Pin<Box<Fuse<OptionFuture<impl Future<Output = State>>>>> = Box::pin(OptionFuture::from(Some(async { State::Init })).fuse());
    
    Ok(())
}

Meta

rustc --version --verbose:

Nightly channel
Build using the Nightly version: 1.55.0-nightly

(2021-07-18 59216858a323978a9759)

Error output

error: internal compiler error: broken MIR in DefId(0:26 ~ playground[397a]::main::{closure#0}) (Terminator { source_info: SourceInfo { span: src/main.rs:12:91: 12:155 (#0), scope: scope[0] }, kind: _3 = Box::<futures::future::Fuse<OptionFuture<impl futures::Future>>>::pin(move _4) -> [return: bb5, unwind: bb7] }): call dest mismatch (std::pin::Pin<std::boxed::Box<futures::future::Fuse<futures::future::OptionFuture<impl futures::Future>>>> <- std::pin::Pin<std::boxed::Box<futures::future::Fuse<futures::future::OptionFuture<impl futures::Future>>>>): NoSolution
  --> src/main.rs:12:153
   |
12 | ...> = Box::pin(OptionFuture::from(Some(async { State::Init })).fuse());
   |                                                                      ^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:253:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/59216858a323978a97593cba22b5ed84350a3783/library/std/src/panicking.rs:515:5
   1: std::panicking::begin_panic_fmt
             at /rustc/59216858a323978a97593cba22b5ed84350a3783/library/std/src/panicking.rs:457:5
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map
   8: rustc_interface::interface::create_compiler_and_run
   9: scoped_tls::ScopedKey<T>::set

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-impl_trait_in_bindings`#![feature(impl_trait_in_bindings)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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