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

Rust complains an internal compiler error when compiling console-subscriber. #124079

Closed
ybbh opened this issue Apr 17, 2024 · 1 comment · Fixed by #124066
Closed

Rust complains an internal compiler error when compiling console-subscriber. #124079

ybbh opened this issue Apr 17, 2024 · 1 comment · 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

@ybbh
Copy link

ybbh commented Apr 17, 2024

Rust complains an internal compiler error when compiling console-subscriber.
The source code is available at https://github.com/scuptio/scupt-util/, and the GitHub action reports errors https://github.com/scuptio/scupt-util/actions/runs/8723318996/job/23931268011.

My CPU

Intel 12th Gen Core i7-12700

My OS

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Code

use console_subscriber::init;

fn main() {
    init();
}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (1cec373f6 2024-04-16)
binary: rustc
commit-hash: 1cec373f65eb76e8e4b4d1847213cf3ec6c292b6
commit-date: 2024-04-16
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3

Error output

   Compiling console-subscriber v0.1.10
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:956:17: opaque types got hidden types registered from within subtype predicate: tracing_subscriber::layer::Layered<Alias(Opaque, AliasTy { args: [tracing_subscriber::Registry], def_id: DefId(0:1526 ~ console_subscriber[8522]::builder::{impl#1}::spawn::{opaque#0}) }), tracing_subscriber::Registry, tracing_subscriber::Registry> vs tracing_subscriber::layer::Layered<Alias(Opaque, AliasTy { args: [tracing_subscriber::Registry], def_id: DefId(0:1526 ~ console_subscriber[8522]::builder::{impl#1}::spawn::{opaque#0}) }), tracing_subscriber::Registry, tracing_subscriber::Registry>
   --> /home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/src/builder.rs:407:19
    |
407 |             .with(tracing_subscriber::fmt::layer().with_filter(fmt_filter))
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_infer/src/infer/mod.rs:956:17:
Box<dyn Any>
stack backtrace:
   0:     0x7cb5fa24bcd5 - std::backtrace_rs::backtrace::libunwind::trace::h39aa7bbcf61112e7
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7cb5fa24bcd5 - std::backtrace_rs::backtrace::trace_unsynchronized::h8cbdf27e1140b5c7
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7cb5fa24bcd5 - std::sys_common::backtrace::_print_fmt::hf30f89c5893a63c3
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7cb5fa24bcd5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8ae58e1a025dc15e
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7cb5fa29af9b - core::fmt::rt::Argument::fmt::h79663960ec3ead41
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/core/src/fmt/rt.rs:165:63
   5:     0x7cb5fa29af9b - core::fmt::write::hea0bc3323f37fb37
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/core/src/fmt/mod.rs:1157:21
   6:     0x7cb5fa24085f - std::io::Write::write_fmt::h0aebada01ce9c9e1
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/io/mod.rs:1832:15
   7:     0x7cb5fa24baae - std::sys_common::backtrace::_print::hb8b452cedd5245b9
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7cb5fa24baae - std::sys_common::backtrace::print::h45e09369dba6d79a
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7cb5fa24e429 - std::panicking::default_hook::{{closure}}::h17bec0ff62b1df32
  10:     0x7cb5fa24e16d - std::panicking::default_hook::hc8938c3997234b0d
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/panicking.rs:291:9
  11:     0x7cb5f6c6d3dc - std[531770c5e2e8d301]::panicking::update_hook::<alloc[d882034972180c03]::boxed::Box<rustc_driver_impl[427e5c398467f86b]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7cb5fa24eb2c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6d2f4133a0440d99
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2032:9
  13:     0x7cb5fa24eb2c - std::panicking::rust_panic_with_hook::h7c86743fcac7c36d
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/panicking.rs:792:13
  14:     0x7cb5f6c9cf54 - std[531770c5e2e8d301]::panicking::begin_panic::<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug>::{closure#0}
  15:     0x7cb5f6c99bd6 - std[531770c5e2e8d301]::sys_common::backtrace::__rust_end_short_backtrace::<std[531770c5e2e8d301]::panicking::begin_panic<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug>::{closure#0}, !>
  16:     0x7cb5f6c998b6 - std[531770c5e2e8d301]::panicking::begin_panic::<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug>
  17:     0x7cb5f6ca5f81 - <rustc_errors[1b3eec32e47ffd2f]::diagnostic::BugAbort as rustc_errors[1b3eec32e47ffd2f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7cb5f6ee55b8 - <rustc_errors[1b3eec32e47ffd2f]::DiagCtxt>::span_bug::<rustc_span[53b55791d064607f]::span_encoding::Span, alloc[d882034972180c03]::string::String>
  19:     0x7cb5f6f1c5fd - rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt::<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0}
  20:     0x7cb5f6f1c92a - rustc_middle[d8712503438341b1]::ty::context::tls::with_opt::<rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7cb5f6f0199b - rustc_middle[d8712503438341b1]::ty::context::tls::with_context_opt::<rustc_middle[d8712503438341b1]::ty::context::tls::with_opt<rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7cb5f6f006b7 - rustc_middle[d8712503438341b1]::util::bug::span_bug_fmt::<rustc_span[53b55791d064607f]::span_encoding::Span>
  23:     0x7cb5f4c07ce1 - <rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::FulfillProcessor as rustc_data_structures[f4bfcbb9d91a10eb]::obligation_forest::ObligationProcessor>::process_obligation
  24:     0x7cb5f800d823 - <rustc_data_structures[f4bfcbb9d91a10eb]::obligation_forest::ObligationForest<rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::FulfillProcessor>
  25:     0x7cb5f90e0b00 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_method_argument_types
  26:     0x7cb5f897384a - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7cb5f8973732 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7cb5f896d6e1 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected
  29:     0x7cb5f8973701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7cb5f8254821 - rustc_hir_typeck[77e1cc157524533d]::check::check_fn
  31:     0x7cb5f824ad49 - rustc_hir_typeck[77e1cc157524533d]::typeck
  32:     0x7cb5f824a709 - rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7cb5f8236d31 - rustc_query_system[219200ddf699f4fc]::query::plumbing::try_execute_query::<rustc_query_impl[ffef2ea0cc82d0dd]::DynamicConfig<rustc_query_system[219200ddf699f4fc]::query::caches::VecCache<rustc_span[53b55791d064607f]::def_id::LocalDefId, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::QueryCtxt, false>
  34:     0x7cb5f823564c - rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7cb5f8235218 - <rustc_middle[d8712503438341b1]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[6a1b22ded269dcc8]::check_crate::{closure#4}>::{closure#0}
  36:     0x7cb5f8233f01 - rustc_hir_analysis[6a1b22ded269dcc8]::check_crate
  37:     0x7cb5f88c5b7a - rustc_interface[336e9a5fb47021d9]::passes::analysis
  38:     0x7cb5f88c56d5 - rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7cb5f8e4c9a5 - rustc_query_system[219200ddf699f4fc]::query::plumbing::try_execute_query::<rustc_query_impl[ffef2ea0cc82d0dd]::DynamicConfig<rustc_query_system[219200ddf699f4fc]::query::caches::SingleCache<rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::QueryCtxt, false>
  40:     0x7cb5f8e4c709 - rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7cb5f8cbdfd9 - rustc_interface[336e9a5fb47021d9]::interface::run_compiler::<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1}
  42:     0x7cb5f8bab327 - std[531770c5e2e8d301]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_with_globals<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_pool_with_globals<rustc_interface[336e9a5fb47021d9]::interface::run_compiler<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>
  43:     0x7cb5f8bab0ea - <<std[531770c5e2e8d301]::thread::Builder>::spawn_unchecked_<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_with_globals<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_pool_with_globals<rustc_interface[336e9a5fb47021d9]::interface::run_compiler<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#2} as core[2a3c68b720306447]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7cb5fa258a1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc8d25b9018534ef3
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2018:9
  45:     0x7cb5fa258a1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9f7c65c9881af958
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2018:9
  46:     0x7cb5fa258a1b - std::sys::pal::unix::thread::Thread::new::thread_start::ha61a9957d3d99efc
                               at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys/pal/unix/thread.rs:108:17
  47:     0x7cb5f3894ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  48:     0x7cb5f3926850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/rustc-ice-2024-04-17T14_01_26-124844.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 [typeck] type-checking `builder::<impl at /home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/src/builder.rs:78:1: 78:13>::init`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `console-subscriber` (lib)
Backtrace

<backtrace>
   Compiling console-subscriber v0.1.10
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:956:17: opaque types got hidden types registered from within subtype predicate: tracing_subscriber::layer::Layered<Alias(Opaque, AliasTy { args: [tracing_subscriber::Registry], def_id: DefId(0:1526 ~ console_subscriber[8522]::builder::{impl#1}::spawn::{opaque#0}) }), tracing_subscriber::Registry, tracing_subscriber::Registry> vs tracing_subscriber::layer::Layered<Alias(Opaque, AliasTy { args: [tracing_subscriber::Registry], def_id: DefId(0:1526 ~ console_subscriber[8522]::builder::{impl#1}::spawn::{opaque#0}) }), tracing_subscriber::Registry, tracing_subscriber::Registry>
   --> /home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/src/builder.rs:407:19
    |
407 |             .with(tracing_subscriber::fmt::layer().with_filter(fmt_filter))
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
   8: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_method_argument_types
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  14: rustc_hir_typeck::check::check_fn
  15: rustc_hir_typeck::typeck
      [... omitted 1 frame ...]
  16: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#4}>::{closure#0}
  17: rustc_hir_analysis::check_crate
  18: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  19: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
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 `/home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/rustc-ice-2024-04-17T14_15_48-126716.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 [typeck] type-checking `builder::<impl at /home/ybbh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/console-subscriber-0.1.10/src/builder.rs:78:1: 78:13>::init`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `console-subscriber` (lib)

@ybbh ybbh 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
@lqd
Copy link
Member

lqd commented Apr 17, 2024

This should be a duplicate of #124054

@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 17, 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
Development

Successfully merging a pull request may close this issue.

4 participants