Skip to content

ICE: assertion left == right failed #148164

Closed as duplicate
Closed as duplicate

Description

@rucsesec

It seems that rustc firstly panicked at "compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs".

Code

trait Trait1 {}
auto trait Trait2 {}

fn foo(_: Box<dyn Trait1 + !Trait2>) {}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.92.0-nightly (4068bafed 2025-10-20)
binary: rustc
commit-hash: 4068bafedd8ba724e332a5221c06a6fa531a30d2
commit-date: 2025-10-20
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
Program Output

error: negative bounds are not supported
 --> <source>:4:28
  |
4 | fn foo(_: Box<dyn Trait1 + !Trait2>) {}
  |                            ^

error[E0658]: auto traits are experimental and possibly buggy
 --> <source>:2:1
  |
2 | auto trait Trait2 {}
  | ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
  = help: add `#![feature(auto_traits)]` to the crate attributes to enable
  = note: this compiler was built on 2025-10-25; consider upgrading it if it is out of date


thread 'rustc' (3) panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs:425:17:
assertion `left == right` failed
  left: Negative
 right: Positive
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<rustc_type_ir::predicate::PredicatePolarity, rustc_type_ir::predicate::PredicatePolarity>
   4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_trait_object_ty::{closure#0}
   5: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
   6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_resolved_ty_path
   7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
   8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
   9: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty
  10: rustc_hir_analysis::collect::fn_sig
      [... omitted 2 frames ...]
  11: rustc_hir_analysis::check::check::check_item_type
  12: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 1 frame ...]
  13: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 1 frame ...]
  14: rustc_hir_analysis::check_crate
  15: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  16: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

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 `/app/rustc-ice-2025-10-27T07_17_44-1.txt` to your bug report

note: compiler flags: -C debuginfo=2 --crate-type bin -C linker=/opt/compiler-explorer/gcc-15.2.0/bin/gcc

query stack during panic:
#0 [fn_sig] computing function signature of `foo`
#1 [check_well_formed] checking that `foo` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Oct 27, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 27, 2025
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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