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

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

Closed
crsche opened this issue Apr 17, 2024 · 8 comments · Fixed by #124066
Closed

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

crsche opened this issue Apr 17, 2024 · 8 comments · Fixed by #124066
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@crsche
Copy link

crsche commented Apr 17, 2024

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

@crsche crsche added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 17, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 17, 2024
@crsche crsche changed the title Compiler Panic with Leptos' [start-axum](https://github.com/leptos-rs/start-axum) Compiler Panic with Leptos' start-axum app.rs Apr 17, 2024
@crsche crsche changed the title Compiler Panic with Leptos' start-axum app.rs Compiler Panic with Leptos' start-axum app.rs Apr 17, 2024
@Edgeworth
Copy link

I'm also hitting this on 1cec373 2024-04-16 but not on 0d8b334 2024-04-14

@Nocturem
Copy link

Glad I checked to see if this had been raised before I posted a duplicate
Same issues with leptos start trunk

Just grabbed
https://github.com/leptos-rs/start-trunk

ran through
rustup toolchain install nightly --allow-downgrade
rustup target add wasm32-unknown-unknown

excitedly hit
trunk serve --port 3000 --open

and watched the compiler detonate around 6 times a second
dumping stack traces into the project directory.
rustc-ice-2024-04-17T08_44_01-2589408.txt

@farasjibran
Copy link

is this still not solved? because I also experienced this when running the command cargo leptos watch

@lqd
Copy link
Member

lqd commented Apr 17, 2024

I'm pretty sure that's from #123979 cc @oli-obk

@farasjibran
Copy link

Is there still an issue here? I still can't run cargo leptos watch

@oli-obk
Copy link
Contributor

oli-obk commented Apr 17, 2024

This is a compiler issue, it won't be fixed before the next nightly release, please stick with an older compiler until #124066 lands

@farasjibran
Copy link

This is a compiler issue, it won't be fixed before the next nightly release, please stick with an older compiler until #124066 lands

what i have to do to change to older compiler version?

@oli-obk
Copy link
Contributor

oli-obk commented Apr 17, 2024

Unless this is leptos' doing, rustup override set nightly-2024-04-14 in the folder where you are seeing the problem

@bors bors closed this as completed in 116c0f7 Apr 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 17, 2024
Rollup merge of rust-lang#124066 - oli-obk:define_opaque_types7, r=compiler-errors

Don't error on subtyping of equal types

fixes rust-lang#124054 🤦
fixes rust-lang#124075
fixes rust-lang#124079

r? `@compiler-errors`
RalfJung pushed a commit to RalfJung/miri that referenced this issue Apr 17, 2024
…rors

Don't error on subtyping of equal types

fixes rust-lang/rust#124054 🤦
fixes #124075
fixes rust-lang/rust#124079

r? `@compiler-errors`
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
8 participants