Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc panic: the naive layout isn't refined by the actual layout #1413

Closed
NicoZweifel opened this issue Jul 22, 2023 · 3 comments
Closed

rustc panic: the naive layout isn't refined by the actual layout #1413

NicoZweifel opened this issue Jul 22, 2023 · 3 comments
Labels

Comments

@NicoZweifel
Copy link

Describe the bug
Compilation fails on nightly rustc 1.73.0-nightly (0308df23e 2023-07-21).

I tried examples/ssr_modes and cargo leptos new --git https://github.com/leptos-rs/start.

It definitely used to work a week or so ago before fetching main and running rustup update.

Not sure if this is the right place to post, please let me know if I should move this to here or somewhere else.

cargo leptos watch fails with:

error: internal compiler error: compiler/rustc_ty_utils/src/layout_sanity_check.rs:25:9: the naive layout isn't refined by the actual layout:
                                NaiveLayout {
                                    abi: Sized,
                                    niches: Maybe,
                                    size: Size(0 bytes),
                                    align: Align(4 bytes),
                                    exact: false,
                                }
                                TyAndLayout {
                                    ty: iter<T>,
                                    layout: Layout {
                                        size: Size(0 bytes),
                                        align: AbiAndPrefAlign {
                                            abi: Align(1 bytes),
                                            pref: Align(8 bytes),
                                        },
                                        abi: Aggregate {
                                            sized: true,
                                        },
                                        fields: Arbitrary {
                                            offsets: [],
                                            memory_index: [],
                                        },
                                        largest_niche: None,
                                        variants: Single {
                                            index: 1,
                                        },
                                        max_repr_align: None,
                                        unadjusted_abi_align: Align(1 bytes),
                                    },
                                }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/compiler/rustc_errors/src/lib.rs:1663:9
stack backtrace:
   0:     0x7f9441fbffc1 - std::backtrace_rs::backtrace::libunwind::trace::h8f154b6a796326e2
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9441fbffc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb8abeaf7dfb1c24b
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9441fbffc1 - std::sys_common::backtrace::_print_fmt::h3f47e60290db41a5
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9441fbffc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4552f2dd442a589d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f944202649c - core::fmt::rt::Argument::fmt::h78a6be6446bd82bd
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/rt.rs:138:9
   5:     0x7f944202649c - core::fmt::write::hd14ae211f7dd66b2
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9441fb27ae - std::io::Write::write_fmt::hdc8c0b5c45666412
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/io/mod.rs:1714:15
   7:     0x7f9441fbfdd5 - std::sys_common::backtrace::_print::h381fcf6b91d9d880
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9441fbfdd5 - std::sys_common::backtrace::print::hcfe75c5be0f60777
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9441fc2e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::hfe5fad22482c9f6d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:278:22
  10:     0x7f9441fc2ac3 - std::panicking::panic_hook_with_disk_dump::hc822f132c197763d
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:312:9
  11:     0x7f94451ef8b9 - rustc_driver_impl[fead4037fc65a3e4]::install_ice_hook::{closure#0}
  12:     0x7f9441fc36d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h549a9102e6ec42b3
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2021:9
  13:     0x7f9441fc36d0 - std::panicking::rust_panic_with_hook::h8adf1e4a5b603f89
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/panicking.rs:733:13
  14:     0x7f94457ab271 - std[bbbc53192af03470]::panicking::begin_panic::<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>::{closure#0}
  15:     0x7f94457a9266 - std[bbbc53192af03470]::sys_common::backtrace::__rust_end_short_backtrace::<std[bbbc53192af03470]::panicking::begin_panic<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>::{closure#0}, !>
  16:     0x7f94457a17a6 - std[bbbc53192af03470]::panicking::begin_panic::<rustc_errors[5f83c55a23d0ef58]::ExplicitBug>
  17:     0x7f944571ef94 - <rustc_errors[5f83c55a23d0ef58]::HandlerInner>::bug::<alloc[c920ce942076dd6e]::string::String>
  18:     0x7f944571ee26 - <rustc_errors[5f83c55a23d0ef58]::Handler>::bug::<alloc[c920ce942076dd6e]::string::String>
  19:     0x7f94456f929c - rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt::<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}
  20:     0x7f94456f90da - rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_opt::<rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f94456f90a8 - rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_context_opt::<rustc_middle[2e38e64f479fe5b8]::ty::context::tls::with_opt<rustc_middle[2e38e64f479fe5b8]::util::bug::opt_span_bug_fmt<rustc_span[a321f1cb1523dd0b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9443c05fa0 - rustc_middle[2e38e64f479fe5b8]::util::bug::bug_fmt
  23:     0x7f9443b540ce - rustc_ty_utils[55ee87bc8b98e550]::layout::layout_of
  24:     0x7f94432678ce - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 16usize]>>
  25:     0x7f9443b48ff1 - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::DefaultCache<rustc_middle[2e38e64f479fe5b8]::ty::ParamEnvAnd<rustc_middle[2e38e64f479fe5b8]::ty::Ty>, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
  26:     0x7f9443b48bf3 - rustc_query_impl[89227dfa721c8c03]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f94442233e0 - <rustc_mir_transform[bc3e936f99131297]::const_prop::CanConstProp>::check
  28:     0x7f944421edd0 - <rustc_mir_transform[bc3e936f99131297]::const_prop_lint::ConstProp as rustc_mir_transform[bc3e936f99131297]::pass_manager::MirLint>::run_lint
  29:     0x7f94439e3a60 - rustc_mir_transform[bc3e936f99131297]::mir_drops_elaborated_and_const_checked
  30:     0x7f94432d338e - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7f94432d335e - <rustc_query_impl[89227dfa721c8c03]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[d7f3879bb305828b]::ops::function::FnOnce<(rustc_middle[2e38e64f479fe5b8]::ty::context::TyCtxt, rustc_span[a321f1cb1523dd0b]::def_id::LocalDefId)>>::call_once
  32:     0x7f94433cdc9d - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::VecCache<rustc_span[a321f1cb1523dd0b]::def_id::LocalDefId, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
  33:     0x7f9444b5060f - rustc_query_impl[89227dfa721c8c03]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f9444689ed3 - <rustc_session[15d76b916424491d]::session::Session>::time::<(), rustc_interface[c9554cd0b74ea93d]::passes::analysis::{closure#2}>
  35:     0x7f94446884f5 - rustc_interface[c9554cd0b74ea93d]::passes::analysis
  36:     0x7f94446d982a - rustc_query_impl[89227dfa721c8c03]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 1usize]>>
  37:     0x7f94446d9819 - <rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::dynamic_query::{closure#2} as core[d7f3879bb305828b]::ops::function::FnOnce<(rustc_middle[2e38e64f479fe5b8]::ty::context::TyCtxt, ())>>::call_once
  38:     0x7f944488f088 - rustc_query_system[c0a52eceb1a71305]::query::plumbing::try_execute_query::<rustc_query_impl[89227dfa721c8c03]::DynamicConfig<rustc_query_system[c0a52eceb1a71305]::query::caches::SingleCache<rustc_middle[2e38e64f479fe5b8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[89227dfa721c8c03]::plumbing::QueryCtxt, false>
  39:     0x7f944488ee17 - rustc_query_impl[89227dfa721c8c03]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f9444430745 - <rustc_middle[2e38e64f479fe5b8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
  41:     0x7f944442fd72 - <rustc_interface[c9554cd0b74ea93d]::interface::Compiler>::enter::<rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}::{closure#2}, core[d7f3879bb305828b]::result::Result<core[d7f3879bb305828b]::option::Option<rustc_interface[c9554cd0b74ea93d]::queries::Linker>, rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
  42:     0x7f944442cf64 - std[bbbc53192af03470]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>
  43:     0x7f944442c68e - <<std[bbbc53192af03470]::thread::Builder>::spawn_unchecked_<rustc_interface[c9554cd0b74ea93d]::util::run_in_thread_pool_with_globals<rustc_interface[c9554cd0b74ea93d]::interface::run_compiler<core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>, rustc_driver_impl[fead4037fc65a3e4]::run_compiler::{closure#1}>::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d7f3879bb305828b]::result::Result<(), rustc_span[a321f1cb1523dd0b]::ErrorGuaranteed>>::{closure#1} as core[d7f3879bb305828b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f9441fcddc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5a713c95dff49eb9
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
  45:     0x7f9441fcddc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6c2630f276b49e94
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/alloc/src/boxed.rs:2007:9
  46:     0x7f9441fcddc5 - std::sys::unix::thread::Thread::new::thread_start::he7c79aaf88d71e7c
                               at /rustc/0308df23e621e783e31a27ca5beaa01b9df60d4a/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f9441e8e609 - start_thread
  48:     0x7f9441db1133 - clone
  49:                0x0 - <unknown>

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: please attach the file at `/home/nico/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inventory-0.3.8/rustc-ice-2023-07-22T02:32:23.67953624Z-23638.txt` to your bug report

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

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

query stack during panic:
#0 [layout_of] computing layout of `iter<T>`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `ITER::<impl at /home/nico/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inventory-0.3.8/src/lib.rs:284:5: 284:46>::into_iter`
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `inventory` (lib)

To Reproduce
Steps to reproduce the behavior:

  1. cd examples/ssr_modes or cargo leptos new --git https://github.com/leptos-rs/start
  2. cargo leptos watch

Expected behavior
Should compile and run.

@rnoba
Copy link

rnoba commented Jul 22, 2023

I'm with the same problem, is that really a rust compiler error? maybe we should follow the notes and report this.

@gbj
Copy link
Collaborator

gbj commented Jul 22, 2023

Agreed, definitely open an ICE issue with the steps in the note.

Any nightly version after about 2023-06-28 should work fine with current Leptos. I haven't bumped into this compiler issue because I'm on an early-July nightly still... Maybe try downgrading to a slightly less nightly nightly and see where it starts breaking?

ETA: Note the final line—

error: could not compile `inventory` (lib)

So this is actually a compiler panic while compiling inventory, a dependency Leptos uses for automatic server function registration. Of course I'll leave the issue open for visibility but I don't think there's anything we can do other than downgrade to a working nightly.

@gbj gbj added the FYI label Jul 22, 2023
@j0lol
Copy link
Contributor

j0lol commented Jul 30, 2023

hey, i reported this and it got fixed in the compiler! rust-lang/rust#113941

@gbj gbj closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants