diff --git a/README.md b/README.md new file mode 100644 index 0000000..cfd5f32 --- /dev/null +++ b/README.md @@ -0,0 +1,108 @@ +# Rust compiler panic error report + +While trying to upgrade rustc to the latest nightly, I stumbled across a Rust +compiler panic. This repo contains a minimum-reproducible test case +(well, reasonably compact). + +From my brief investigation, it appears that adding the `warp::trace::request()` +combinator causes recent rustc nightly's to panic. + +I've bisected the recent nightly versions; `nightly-2023-02-09` is the first +that starts panicking. Running with `nightly-2023-02-08` builds successfully. + +To reproduce the bug, just run `cargo build`. Running `cargo check` doesn't +panic, though, since it seems to be codegen related. + +The full error log: + +```bash +rustc-warp-ice$ cargo build + Compiling rustc-warp-ice v0.1.0 +error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1076:22: unexpected unsized tail: hyper::server::server::new_svc::State, [closure@src/main.rs:11:18: 11:20]>>>, std::convert::Infallible>>, warp::filter::service::FilteredService, [closure@src/main.rs:11:18: 11:20]>>>, hyper::common::exec::Exec, hyper::server::server::NoopWatcher> + +thread 'rustc' panicked at 'Box', /rustc/ef934d9b632b8ac00276558824664c104b92b5f0/compiler/rustc_errors/src/lib.rs:1644:9 +stack backtrace: + 0: 0x102f28ba8 - ::fmt::h1d8000cb115ab1b1 + 1: 0x102f7883c - core::fmt::write::hb4a42c7efd8f1690 + 2: 0x102f1c4c8 - std::io::Write::write_fmt::h4afe2735edabbc94 + 3: 0x102f289bc - std::sys_common::backtrace::print::hff3831971f64cecb + 4: 0x102f2b4c0 - std::panicking::default_hook::{{closure}}::h71a6ecf250628b79 + 5: 0x102f2b218 - std::panicking::default_hook::hca770bcc00460b96 + 6: 0x10b25f0e8 - rustc_driver_impl[26e6f04b306098c]::DEFAULT_HOOK::{closure#0}::{closure#0} + 7: 0x102f2bbb8 - std::panicking::rust_panic_with_hook::h165d4369c18cfdb9 + 8: 0x10f0401c0 - std[19d8fbcf6afc7ffd]::panicking::begin_panic::::{closure#0} + 9: 0x10f03ee14 - std[19d8fbcf6afc7ffd]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> + 10: 0x10f5b3088 - std[19d8fbcf6afc7ffd]::panicking::begin_panic:: + 11: 0x10f090f84 - std[19d8fbcf6afc7ffd]::panic::panic_any:: + 12: 0x10f090578 - ::bug::<&alloc[9c94e105aad12a13]::string::String> + 13: 0x10f0901c8 - ::bug::<&alloc[9c94e105aad12a13]::string::String> + 14: 0x10f0be91c - rustc_middle[a501841c49e30a1f]::util::bug::opt_span_bug_fmt::::{closure#0} + 15: 0x10f0bae1c - rustc_middle[a501841c49e30a1f]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} + 16: 0x10f0bade8 - rustc_middle[a501841c49e30a1f]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> + 17: 0x10f0be88c - rustc_middle[a501841c49e30a1f]::util::bug::opt_span_bug_fmt:: + 18: 0x10f5b7b90 - rustc_middle[a501841c49e30a1f]::util::bug::bug_fmt + 19: 0x10d7f58d8 - rustc_monomorphize[681161328a34c57f]::collector::find_vtable_types_for_unsizing + 20: 0x10d7f57e8 - rustc_monomorphize[681161328a34c57f]::collector::find_vtable_types_for_unsizing + 21: 0x10d7f3800 - ::visit_rvalue + 22: 0x10d7f8f14 - rustc_monomorphize[681161328a34c57f]::collector::collect_neighbours + 23: 0x10d7f7844 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 24: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 25: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 26: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 27: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 28: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 29: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 30: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 31: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 32: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 33: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 34: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 35: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 36: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 37: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 38: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 39: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 40: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 41: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 42: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 43: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 44: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 45: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 46: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 47: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 48: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 49: 0x10d7f7c40 - rustc_monomorphize[681161328a34c57f]::collector::collect_items_rec + 50: 0x10d7fb980 - , rustc_monomorphize[681161328a34c57f]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> as core[84c79705706f622d]::ops::function::FnOnce<()>>::call_once + 51: 0x10d8073ac - ::time::<(), rustc_monomorphize[681161328a34c57f]::collector::collect_crate_mono_items::{closure#1}> + 52: 0x10d7f601c - rustc_monomorphize[681161328a34c57f]::collector::collect_crate_mono_items + 53: 0x10d814230 - rustc_monomorphize[681161328a34c57f]::partitioning::collect_and_partition_mono_items + 54: 0x10e501720 - >::with_task::, &[rustc_middle[a501841c49e30a1f]::mir::mono::CodegenUnit])> + 55: 0x10e2e0010 - rustc_query_system[ee0c09c3b3207d2e]::query::plumbing::try_execute_query:: + 56: 0x10e440700 - ::collect_and_partition_mono_items + 57: 0x10b374124 - rustc_codegen_ssa[5598ec4cf5527612]::base::codegen_crate:: + 58: 0x10b3a2834 - ::codegen_crate + 59: 0x10b2fb86c - ::time::, rustc_interface[fd5e8e13dbefeeaf]::passes::start_codegen::{closure#0}> + 60: 0x10b2e9b10 - rustc_interface[fd5e8e13dbefeeaf]::passes::start_codegen + 61: 0x10b2e8e8c - ::enter::<::ongoing_codegen::{closure#0}::{closure#0}, core[84c79705706f622d]::result::Result, rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>> + 62: 0x10b3097d0 - ::ongoing_codegen + 63: 0x10b2386fc - ::enter::, rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>> + 64: 0x10b1dda34 - rustc_span[161be7aa2f1e880]::with_source_map::, rustc_interface[fd5e8e13dbefeeaf]::interface::run_compiler, rustc_driver_impl[26e6f04b306098c]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> + 65: 0x10b22eb90 - >::set::, rustc_driver_impl[26e6f04b306098c]::run_compiler::{closure#1}>::{closure#0}, core[84c79705706f622d]::result::Result<(), rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>> + 66: 0x10b1f4168 - std[19d8fbcf6afc7ffd]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[26e6f04b306098c]::run_compiler::{closure#1}>::{closure#0}, core[84c79705706f622d]::result::Result<(), rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84c79705706f622d]::result::Result<(), rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>> + 67: 0x10b1e502c - <::spawn_unchecked_, rustc_driver_impl[26e6f04b306098c]::run_compiler::{closure#1}>::{closure#0}, core[84c79705706f622d]::result::Result<(), rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84c79705706f622d]::result::Result<(), rustc_errors[ea1af16506b93a34]::ErrorGuaranteed>>::{closure#1} as core[84c79705706f622d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} + 68: 0x102f3402c - std::sys::unix::thread::Thread::new::thread_start::h088a4f7b78481523 + 69: 0x198e4a06c - __pthread_deallocate + +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.69.0-nightly (ef934d9b6 2023-02-08) running on aarch64-apple-darwin + +note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED] + +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 `rustc-warp-ice` +``` diff --git a/rust-toolchain.toml b/rust-toolchain.toml index beb315b..c69d004 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,6 @@ [toolchain] +# Switch over to the previous day's nightly to make the program compile again. +# vvvvvvvvvvvvvvvvvvvvvvvvvvvv +# channel = "nightly-2023-02-08" channel = "nightly-2023-02-09" profile = "minimal" diff --git a/src/main.rs b/src/main.rs index 72fcbfd..12d5273 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,7 @@ use std::convert::Infallible; -use std::future::Future; use std::net::SocketAddr; -use futures::{future, FutureExt}; +use futures::future; use hyper::service::make_service_fn; use warp::Filter; @@ -10,6 +9,8 @@ fn main() { let svc = warp::service( warp::path::end() .map(|| "Hello, world") + // Try commenting out this line to make the program compile again. + // vvvvvvvvvvvvvvvvvvvvvvvvvvv .with(warp::trace::request()), ); let make_svc = make_service_fn(move |_| future::ok::<_, Infallible>(svc.clone()));