Skip to content

ICE: collect_and_partition_mono_items #96703

Closed

Description

Ohai! Unfortunately I wasn't able to reduce this further, it must be some warp voodoo causing this…

Code

/* Cargo.toml:

[package]
name = "ice-ice-baby"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["full"] }
warp = "0.3"
hyper = "0.14"

*/
use std::{convert::Infallible, net::SocketAddr, sync::Arc};

use hyper::server::Server;
use tokio::sync::RwLock;
use warp::Filter;

type State = Arc<RwLock<usize>>;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let state = State::default();
    let state = warp::any().map(move || state.clone());

    let ws = warp::path("ws")
        .and(warp::ws())
        .and(state)
        .map(|ws: warp::ws::Ws, users| ws.on_upgrade(move |_socket| handle(users)));

    let index = warp::path::end().map(|| warp::reply::html(INDEX_HTML));
    let routes = index.or(ws);

    let cors = warp::cors().build();
    let service = warp::service(routes.with(cors));

    let make_svc = hyper::service::make_service_fn(|_: _| {
        let svc = service.clone();
        async move { Ok::<_, Infallible>(svc) }
    });

    let sa: SocketAddr = "0.0.0.0:3030".parse().unwrap();
    let server = Server::bind(&sa);
    server.serve(make_svc).await?;

    Ok(())
}

async fn handle(state: State) {
    state.write().await;
}

static INDEX_HTML: &str = "";

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (e1b71feb5 2022-05-03)
binary: rustc
commit-hash: e1b71feb592ba64805689e2b15b9fa570182c442
commit-date: 2022-05-03
host: x86_64-apple-darwin
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

Compiling ice-ice-baby v0.1.0 (/Users/ace/play/laserver_ice)
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1053:22: unexpected unsized tail: hyper::server::conn::spawn_all::State<hyper::server::conn::AddrStream, std::future::from_generator::GenFuture<[static generator@src/main.rs:40:20: 40:48]>, warp::filter::service::FilteredService<warp::cors::internal::CorsFilter<warp::filter::or::Or<warp::filter::map::Map<warp::filter::FilterFn<[closure@warp::path::end::{closure#0}]>, [closure@src/main.rs:32:39: 32:71]>, warp::filter::map::Map<warp::filter::and::And<warp::filter::and::And<warp::path::Exact<warp::path::internal::Opaque<&str>>, warp::filter::map::Map<warp::filter::and::And<warp::filter::and::And<warp::filter::and::And<warp::filter::and::And<warp::filter::and::And<warp::filter::FilterFn<[closure@warp::filters::method::method_is<[closure@warp::get::{closure#0}]>::{closure#0}]>, warp::filter::untuple_one::UntupleOne<warp::filter::and_then::AndThen<warp::filter::FilterFn<[closure@warp::filter::filter_fn_one<[closure@warp::header::header2<headers::common::connection::Connection>::{closure#0}], futures_util::future::ready::Ready<std::result::Result<headers::common::connection::Connection, warp::Rejection>>>::{closure#0}]>, [closure@warp::ws::{closure#0}]>>>, warp::filter::FilterFn<[closure@warp::header::exact_ignore_case::{closure#0}]>>, warp::filter::FilterFn<[closure@warp::header::exact::{closure#0}]>>, warp::filter::FilterFn<[closure@warp::filter::filter_fn_one<[closure@warp::header::header2<headers::common::sec_websocket_key::SecWebsocketKey>::{closure#0}], futures_util::future::ready::Ready<std::result::Result<headers::common::sec_websocket_key::SecWebsocketKey, warp::Rejection>>>::{closure#0}]>>, warp::filter::FilterFn<[closure@warp::filter::filter_fn_one<[closure@warp::ws::on_upgrade::{closure#0}], futures_util::future::ready::Ready<std::result::Result<std::option::Option<hyper::upgrade::OnUpgrade>, warp::Rejection>>>::{closure#0}]>>, [closure@warp::ws::{closure#1}]>>, warp::filter::map::Map<warp::filters::any::Any, [closure@src/main.rs:25:33: 25:54]>>, [closure@src/main.rs:30:14: 30:83]>>>>, hyper::common::exec::Exec, hyper::server::conn::spawn_all::NoopWatcher>

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/compiler/rustc_errors/src/lib.rs:1324:9
stack backtrace:
(see below)

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.62.0-nightly (e1b71feb5 2022-05-03) running on x86_64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `ice-ice-baby`
Backtrace

0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug::<&alloc::string::String>
   3: <rustc_errors::Handler>::bug::<&alloc::string::String>
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_monomorphize::collector::find_vtable_types_for_unsizing
   8: <rustc_monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue
   9: rustc_monomorphize::collector::collect_neighbours
  10: rustc_monomorphize::collector::collect_items_rec
  11: rustc_monomorphize::collector::collect_items_rec
  12: rustc_monomorphize::collector::collect_items_rec
  13: rustc_monomorphize::collector::collect_items_rec
  14: rustc_monomorphize::collector::collect_items_rec
  15: rustc_monomorphize::collector::collect_items_rec
  16: rustc_monomorphize::collector::collect_items_rec
  17: rustc_monomorphize::collector::collect_items_rec
  18: rustc_monomorphize::collector::collect_items_rec
  19: rustc_monomorphize::collector::collect_items_rec
  20: rustc_monomorphize::collector::collect_items_rec
  21: rustc_monomorphize::collector::collect_items_rec
  22: rustc_monomorphize::collector::collect_items_rec
  23: rustc_monomorphize::collector::collect_items_rec
  24: rustc_monomorphize::collector::collect_items_rec
  25: rustc_monomorphize::collector::collect_items_rec
  26: rustc_monomorphize::collector::collect_items_rec
  27: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  28: rustc_monomorphize::collector::collect_crate_mono_items
  29: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  30: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), (&std::collections::hash::set::HashSet<rustc_span::def_id::DefId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>, &[rustc_middle::mir::mono::CodegenUnit])>
  31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), (&std::collections::hash::set::HashSet<rustc_span::def_id::DefId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>, &[rustc_middle::mir::mono::CodegenUnit])>>
  32: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
  33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  34: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  35: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  36: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  37: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
  38: <rustc_interface::queries::Queries>::ongoing_codegen
  39: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  40: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  41: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  42: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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