Skip to content

Compiler Panic with Leptos' start-axum app.rs #124054

Closed
@crsche

Description

@crsche

Code

Just the sample code from the leptos start-axum crate. Specifically app.rs:

use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;

#[component]
pub fn App() -> impl IntoView {
    // Provides context that manages stylesheets, titles, meta tags, etc.
    provide_meta_context();

    view! {


        // injects a stylesheet into the document <head>
        // id=leptos means cargo-leptos will hot-reload this stylesheet
        <Stylesheet id="leptos" href="/pkg/crsche-com.css"/>

        // sets the document title
        <Title text="Welcome to Leptos"/>

        // content for this welcome page
        <Router fallback=|| {
            let mut outside_errors = Errors::default();
            outside_errors.insert_with_default_key(AppError::NotFound);
            view! {
                <ErrorTemplate outside_errors/>
            }
            .into_view()
        }>
            <main>
                <Routes>
                    <Route path="" view=HomePage/>
                </Routes>
            </main>
        </Router>
    }
}

/// Renders the home page of your application.
#[component]
fn HomePage() -> impl IntoView {
    // Creates a reactive value to update the button
    let (count, set_count) = create_signal(0);
    let on_click = move |_| set_count.update(|count| *count += 1);

    view! {
        <h1>"Welcome to Leptos!"</h1>
        <button on:click=on_click>"Click Me: " {count}</button>
    }
}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (1cec373f6 2024-04-16)
binary: rustc
commit-hash: 1cec373f65eb76e8e4b4d1847213cf3ec6c292b6
commit-date: 2024-04-16
host: aarch64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.3

Error output

❯ RUST_BACKTRACE=1 cargo leptos build                                                                                                                                                                                                                                                                                                   (base) 
   Compiling crsche-com v0.1.0 (/Users/conor/programming/crsche-com)
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:956:17: opaque types got hidden types registered from within subtype predicate: Alias(Opaque, AliasTy { args: [], def_id: DefId(0:142 ~ crsche_com[f96b]::app::HomePage::{opaque#0}) }) vs Alias(Opaque, AliasTy { args: [], def_id: DefId(0:142 ~ crsche_com[f96b]::app::HomePage::{opaque#0}) })
  --> src/app.rs:32:22
   |
32 |                     <Route path="" view=HomePage/>
   |                      ^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_infer/src/infer/mod.rs:956:17: ...
Full Backtrace

rustc-ice-2024-04-17T03_07_31-26874.txt

❯ RUST_BACKTRACE=1 cargo leptos build                                                                                                                                                                                                                                                                                                   (base) 
   Compiling crsche-com v0.1.0 (/Users/conor/programming/crsche-com)
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:956:17: opaque types got hidden types registered from within subtype predicate: Alias(Opaque, AliasTy { args: [], def_id: DefId(0:142 ~ crsche_com[f96b]::app::HomePage::{opaque#0}) }) vs Alias(Opaque, AliasTy { args: [], def_id: DefId(0:142 ~ crsche_com[f96b]::app::HomePage::{opaque#0}) })
  --> src/app.rs:32:22
   |
32 |                     <Route path="" view=HomePage/>
   |                      ^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_infer/src/infer/mod.rs:956:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxt>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: <rustc_infer::infer::InferCtxt>::subtype_predicate
   8: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
   9: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
  10: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_method_argument_types
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl_initializer
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_stmt
  18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  20: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  21: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  27: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  29: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  30: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  31: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  33: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  34: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  35: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  37: rustc_hir_typeck::check::check_fn
  38: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_closure
  39: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  41: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  42: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  43: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  44: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  45: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  46: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  47: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  48: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  49: rustc_hir_typeck::check::check_fn
  50: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_closure
  51: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  52: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  53: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  54: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  55: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  56: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  57: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  58: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  59: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_method_argument_types
  60: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  61: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  62: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl_initializer
  63: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
  64: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_stmt
  65: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  66: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  67: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  68: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_method_argument_types
  69: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  70: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  71: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  72: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  73: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  74: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  75: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  76: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  77: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  78: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  79: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
  80: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  81: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  82: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  83: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  84: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  85: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  86: <rustc_hir_typeck::fn_ctxt::FnCtxt>::confirm_builtin_call
  87: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  88: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  89: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  90: rustc_hir_typeck::check::check_fn
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 make sure that you have updated to the latest nightly

note: please attach the file at `/Users/conor/programming/crsche-com/rustc-ice-2024-04-17T03_07_31-26874.txt` to your bug report

note: compiler flags: --crate-type cdylib --crate-type rlib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [typeck] type-checking `app::__App`
#1 [type_of_opaque] computing type of opaque `app::__App::{opaque#0}`
#2 [type_of] computing type of `app::__App::{opaque#0}`
#3 [check_well_formed] checking that `app::App::{opaque#0}` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in module `app`
#5 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `crsche-com` (lib)
Error: Failed to build crsche-com

Stack backtrace:
   0: std::backtrace::Backtrace::create
   1: anyhow::error::<impl anyhow::Error>::msg
   2: cargo_leptos::run::{{closure}}
   3: tokio::runtime::park::CachedParkThread::block_on
   4: cargo_leptos::main
   5: std::sys_common::backtrace::__rust_begin_short_backtrace
   6: std::rt::lang_start::{{closure}}
   7: std::rt::lang_start_internal
   8: std::rt::lang_start
   9: _main

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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