Skip to content

ICE while compiling tower for tonic on nightly #101844

Closed
@grtlr

Description

@grtlr

An ICE occurs when compiling tower as dependency for tonic:0.8.1 using the rustc nightly compiler.

Code

main.rs:

fn main() {
    println!("Hello World");
}

Cargo.toml:

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

[dependencies]
tonic = "=0.8.1"

I've created a repository with a Cargo.lock file to help reproduce this error:
https://github.com/grtlr/rustc-ice-tower-2022-09-15

Please let me know if there is anything that I can do to help solve this. Thank you!

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (750bd1a7f 2022-09-14)
binary: rustc
commit-hash: 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c
commit-date: 2022-09-14
host: x86_64-apple-darwin
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

RUST_BACKTRACE=full cargo +nightly build                                                                                                                                                                                                                          (main|✔) ~/D/ICE-tower 
   Compiling tower v0.4.13
   Compiling tower-http v0.3.4
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DefId(0:345 ~ tower[ab58]::balance::pool::{impl#3}::build) (CanonicalUserTypeAnnotation { user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(0:232 ~ tower[ab58]::balance::p2c::service::{impl#1}::new), UserSubsts { substs: [^0, ^1], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(0:229 ~ tower[ab58]::balance::p2c::service::{impl#1}), self_ty: balance::p2c::service::Balance<^2, ^3> }) }) }, span: /Users/goertler/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-0.4.13/src/balance/pool/mod.rs:293:22: 293:34 (#0), inferred_ty: fn(std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>) -> balance::p2c::service::Balance<std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>, Request> {balance::p2c::service::Balance::<std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>, Request>::new} }): bad user type AscribeUserType(fn(std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>) -> balance::p2c::service::Balance<std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>, Request> {balance::p2c::service::Balance::<std::pin::Pin<std::boxed::Box<balance::pool::PoolDiscoverer<MS, Target, Request>>>, Request>::new}, DefId(0:232 ~ tower[ab58]::balance::p2c::service::{impl#1}::new) UserSubsts { substs: [_, _], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(0:229 ~ tower[ab58]::balance::p2c::service::{impl#1}), self_ty: balance::p2c::service::Balance<_, _> }) }, type_of=fn(D) -> balance::p2c::service::Balance<D, Req> {balance::p2c::service::Balance::<D, Req>::new}): NoSolution
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1087:25

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1492:13
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.65.0-nightly (750bd1a7f 2022-09-14) running on x86_64-apple-darwin

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

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

query stack during panic:
end of query stack
error: could not compile `tower`
warning: build failed, waiting for other jobs to finish...
Backtrace

stack backtrace:
   0:        0x109646552 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4c5ecb0a45d5e886
   1:        0x10969dcca - core::fmt::write::h1b48d1d1cb0b7961
   2:        0x1096386dc - std::io::Write::write_fmt::hd88196c3a88e34fb
   3:        0x10964943b - std::panicking::default_hook::{{closure}}::h0f6810d654ce88bd
   4:        0x109649147 - std::panicking::default_hook::h99ae6a40b3c0b158
   5:        0x1120bbcca - rustc_driver[a68fcf032531d799]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x109649b6e - std::panicking::rust_panic_with_hook::h6b1861a02d4bcbed
   7:        0x116aa9a87 - std[67b2ec307cdf3306]::panicking::begin_panic::<rustc_errors[503eaa35d8a7773]::ExplicitBug>::{closure#0}
   8:        0x116aa9219 - std[67b2ec307cdf3306]::sys_common::backtrace::__rust_end_short_backtrace::<std[67b2ec307cdf3306]::panicking::begin_panic<rustc_errors[503eaa35d8a7773]::ExplicitBug>::{closure#0}, !>
   9:        0x116e0ddf9 - std[67b2ec307cdf3306]::panicking::begin_panic::<rustc_errors[503eaa35d8a7773]::ExplicitBug>
  10:        0x116a9eaa9 - std[67b2ec307cdf3306]::panic::panic_any::<rustc_errors[503eaa35d8a7773]::ExplicitBug>
  11:        0x116aa354e - <rustc_errors[503eaa35d8a7773]::HandlerInner as core[cfcc7bd811e8a7b7]::ops::drop::Drop>::drop
  12:        0x1120eb0ba - core[cfcc7bd811e8a7b7]::ptr::drop_in_place::<rustc_session[157c61238769214e]::parse::ParseSess>
  13:        0x1120f1afb - <alloc[e8b3202084de779]::rc::Rc<rustc_session[157c61238769214e]::session::Session> as core[cfcc7bd811e8a7b7]::ops::drop::Drop>::drop
  14:        0x1120d6db2 - core[cfcc7bd811e8a7b7]::ptr::drop_in_place::<rustc_interface[fcdf76b1f16a6137]::interface::Compiler>
  15:        0x1120dbe9f - rustc_interface[fcdf76b1f16a6137]::interface::create_compiler_and_run::<core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>, rustc_driver[a68fcf032531d799]::run_compiler::{closure#1}>
  16:        0x112133895 - <scoped_tls[fdde64bf4d39370e]::ScopedKey<rustc_span[a6701603fc349d9]::SessionGlobals>>::set::<rustc_interface[fcdf76b1f16a6137]::interface::run_compiler<core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>, rustc_driver[a68fcf032531d799]::run_compiler::{closure#1}>::{closure#0}, core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>>
  17:        0x1120f8ada - std[67b2ec307cdf3306]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[fcdf76b1f16a6137]::util::run_in_thread_pool_with_globals<rustc_interface[fcdf76b1f16a6137]::interface::run_compiler<core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>, rustc_driver[a68fcf032531d799]::run_compiler::{closure#1}>::{closure#0}, core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>>::{closure#0}, core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>>
  18:        0x1120fc1f8 - <<std[67b2ec307cdf3306]::thread::Builder>::spawn_unchecked_<rustc_interface[fcdf76b1f16a6137]::util::run_in_thread_pool_with_globals<rustc_interface[fcdf76b1f16a6137]::interface::run_compiler<core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>, rustc_driver[a68fcf032531d799]::run_compiler::{closure#1}>::{closure#0}, core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>>::{closure#0}, core[cfcc7bd811e8a7b7]::result::Result<(), rustc_errors[503eaa35d8a7773]::ErrorGuaranteed>>::{closure#1} as core[cfcc7bd811e8a7b7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  19:        0x109652ad7 - std::sys::unix::thread::Thread::new::thread_start::hf1224c03c7001e01
  20:     0x7ff80bf854e1 - __pthread_start

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityT-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