Skip to content

ice: assertion failed 2 == 3 [Type, Type, Type] #16286

@matthiaskrgr

Description

@matthiaskrgr

rust-analyzer 1.77.0-nightly (595bc6f 2024-01-05)

#[lang="shr"]
pub trait Shr<RHS,Result> {
    fn shr(&self, rhs: &RHS) -> Result;
}

macro_rules! shr_impl(
    ($($t:ty)*) => ($(
        impl Shr<$t, $t> for $t {
            fn shr -> $t { (*self) >>  }
        }
    )*)
)

shr_impl!(u8)

rust-analyzer highlight < a.rs

thread 'main' panicked at crates/hir-ty/src/builder.rs:66:9:
assertion `left == right` failed: [Type, Type, Type]
  left: 2
 right: 3
stack backtrace:
   0: rust_begin_unwind
             at /rustc/595bc6f00369475047538fdae1ff8cea692ac385/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/595bc6f00369475047538fdae1ff8cea692ac385/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /rustc/595bc6f00369475047538fdae1ff8cea692ac385/library/core/src/panicking.rs:337:23
   3: core::panicking::assert_failed::<usize, usize>
   4: <hir_ty::builder::TyBuilder<()>>::build
   5: <hir_ty::infer::InferenceContext>::infer_overloadable_binop
   6: <hir_ty::infer::InferenceContext>::infer_expr_inner
   7: <hir_ty::infer::InferenceContext>::infer_expr_coerce
   8: <hir_ty::infer::InferenceContext>::infer_block
   9: <hir_ty::infer::InferenceContext>::infer_expr_inner
  10: <hir_ty::infer::InferenceContext>::infer_return
  11: hir_ty::infer::infer_query
  12: <salsa::derived::slot::Slot<hir_ty::db::InferQueryQuery, salsa::derived::AlwaysMemoizeValue>>::execute
  13: <_ as hir_ty::db::HirDatabase>::infer_query::__shim
  14: hir_ty::db::infer_wait
  15: <hir::semantics::SemanticsImpl>::analyze_impl
  16: <hir::semantics::SemanticsImpl>::resolve_path
  17: <ide_db::defs::NameRefClass>::classify
  18: ide::syntax_highlighting::highlight
  19: <ide::Analysis>::highlight_as_html
  20: <rust_analyzer::cli::flags::Highlight>::run
  21: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionC-bugCategory: bugI-panic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions