rust-lang / rust-lang/rust-analyzer

panic: entered unreachable code: pattern has unexpected type: pat: Pat

Open
#23,355 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-pattern B-unstable C-bug I-panic
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

requires ra with debug assertions, this code compiles but rust-analyzer analysis-stats . --run-all-ide-things panic

#![feature(deref_patterns)]
#![crate_type = "lib"]

pub fn foo(s: Option<String>) -> i32 {
    match s {
        Some("a") => 1234,
        s => 4321,
    }
}

fn main() {}
Database loaded:     332.24ms, 223minstr, 48mb (metadata 165.75ms, 972kinstr, 153kb; build 31.26ms, 171kinstr, 1440b)
  item trees: 1
  dependency lines of code: 1_478_357, item trees: 2_969
  dependency item stats: traits: 860, impl: 9_717, mods: 3_002, macro calls: 5_613, macro rules: 1_062
Item Tree Collection: 2.73s, 28ginstr, 431mb
  Total Statistics:
    crates: 1, mods: 1, decls: 2, bodies: 2, adts: 0, consts: 0, signatures: 2, variants: 0
  Workspace:
    traits: 0, macro_rules macros: 0, proc_macros: 0
    lines of code: 11, item trees: 1
    usages: traits: 0, impl: 0, mods: 0, macro calls: 0, macro rules: 0
  Dependencies:
    lines of code: 1_478_357, item trees: 2_969
    declarations: traits: 860, impl: 9_717, mods: 3_002, macro calls: 5_613, macro rules: 1_062
Item Collection:     1.57s, 13ginstr, 176mb
Crate lang items:    291.29ms, 2904minstr, 32mb
Expression Store Lowering: 145.75µs, 321kinstr, 6kb
  exprs: 7, ??ty: 0 (0%), ?ty: 0 (0%), !ty: 0
  pats: 4, ??ty: 0 (0%), ?ty: 0 (0%), !ty: 0
  panics: 0
Inference:           257.57ms, 1527minstr, 35mb
MIR lowering:        552.56µs, 1725kinstr, 68kb
Mir failed bodies: 0 (0%)
Data layouts:        71.00ns, 14kinstr, 0b
Failed data layouts: 0 (100%)
Const evaluation:    11.42µs, 42kinstr, 288b
Failed const evals: 0 (100%)
0/1 0% diagnostics: /tmp/im/f/src/main.rs
thread 'main' (27405) panicked at crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:178:25:
internal error: entered unreachable code: pattern has unexpected type: pat: Pat { ty: String, kind: Deref { subpattern: Pat { ty: str, kind: Wild } } }, ty: String
stack backtrace:
   0:     0x56113df241f1 - std[71a467343b18a2c1]::backtrace_rs::backtrace::libunwind::trace
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:     0x56113df241f1 - std[71a467343b18a2c1]::backtrace_rs::backtrace::trace_unsynchronized::<std[71a467343b18a2c1]::sys::backtrace::_print_fmt::{closure#1}>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2:     0x56113df241f1 - std[71a467343b18a2c1]::sys::backtrace::_print_fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:74:9
   3:     0x56113df241f1 - <<std[71a467343b18a2c1]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[11918ecc8322c3ee]::fmt::Display>::fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:44:26
   4:     0x56113df40e2a - <core[11918ecc8322c3ee]::fmt::rt::Argument>::fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/fmt/rt.rs:152:76
   5:     0x56113df40e2a - core[11918ecc8322c3ee]::fmt::write
   6:     0x56113df2db6c - core[11918ecc8322c3ee]::io::write::default_write_fmt::<std[71a467343b18a2c1]::sys::stdio::unix::Stderr>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/io/write.rs:402:11
   7:     0x56113df2db6c - <std[71a467343b18a2c1]::sys::stdio::unix::Stderr as core[11918ecc8322c3ee]::io::write::Write>::write_fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/io/write.rs:335:13
   8:     0x56113defaee6 - <std[71a467343b18a2c1]::sys::backtrace::BacktraceLock>::print
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:47:9
   9:     0x56113defaee6 - std[71a467343b18a2c1]::panicking::default_hook::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:289:27
  10:     0x56113df19f81 - std[71a467343b18a2c1]::panicking::default_hook
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:316:9
  11:     0x56113df1a2ab - std[71a467343b18a2c1]::panicking::panic_with_hook
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:811:13
  12:     0x56113defaf92 - std[71a467343b18a2c1]::panicking::panic_handler::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:685:13
  13:     0x56113def2169 - std[71a467343b18a2c1]::sys::backtrace::__rust_end_short_backtrace::<std[71a467343b18a2c1]::panicking::panic_handler::{closure#0}, !>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:182:18
  14:     0x56113defbdcd - __rustc[3b8ba45af69cfb7c]::rust_begin_unwind
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:676:5
  15:     0x56113df416fc - core[11918ecc8322c3ee]::panicking::panic_fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/panicking.rs:80:14
  16:     0x56113d737313 - <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:178:25
  17:     0x56113d736e89 - <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:190:30
  18:     0x56113d736e89 - core[11918ecc8322c3ee]::iter::adapters::map::map_fold::<&hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat, ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, (), <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}, core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::extend_trusted<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>::{closure#0}>::{closure#0}>::{closure#0}
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28
  19:     0x56113d736e89 - <core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::fold::<(), core[11918ecc8322c3ee]::iter::adapters::map::map_fold<&hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat, ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, (), <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}, core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::extend_trusted<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>::{closure#0}>::{closure#0}>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:274:27
  20:     0x56113d736e89 - <core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::fold::<(), core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::extend_trusted<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>::{closure#0}>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:19
  21:     0x56113d736e89 - <core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::for_each::<<alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::extend_trusted<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:887:14
  22:     0x56113d736e89 - <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::extend_trusted::<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:4182:26
  23:     0x56113d736e89 - <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>> as alloc[b37a3ff7fa4d5f32]::vec::spec_extend::SpecExtend<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>>::spec_extend
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_extend.rs:27:14
  24:     0x56113d736e89 - <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>> as alloc[b37a3ff7fa4d5f32]::vec::spec_from_iter_nested::SpecFromIterNested<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>>::from_iter
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter_nested.rs:60:16
  25:     0x56113d736e89 - <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>> as alloc[b37a3ff7fa4d5f32]::vec::spec_from_iter::SpecFromIter<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>, core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>>::from_iter
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter.rs:33:9
  26:     0x56113d736e89 - <alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>> as core[11918ecc8322c3ee]::iter::traits::collect::FromIterator<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>::from_iter::<core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:4043:9
  27:     0x56113d736e89 - <core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::slice::iter::Iter<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::FieldPat>, <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat::{closure#1}> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::collect::<alloc[b37a3ff7fa4d5f32]::vec::Vec<ra_ap_rustc_pattern_analysis[89059be1c093763]::pat::IndexedPat<hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2086:9
  28:     0x56113d736e89 - <hir_ty[c6020b5b036d7a82]::diagnostics::match_check::pat_analysis::MatchCheckCtx>::lower_pat
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs:192:22
  29:     0x56113d7bed85 - <hir_ty[c6020b5b036d7a82]::diagnostics::expr::ExprValidator>::lower_pattern
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/expr.rs:399:26
  30:     0x56113d6ba393 - <hir_ty[c6020b5b036d7a82]::diagnostics::expr::ExprValidator>::validate_match
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/expr.rs:238:32
  31:     0x56113d6ba393 - <hir_ty[c6020b5b036d7a82]::diagnostics::expr::ExprValidator>::validate_body
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/expr.rs:143:26
  32:     0x56113d6ba393 - <hir_ty[c6020b5b036d7a82]::diagnostics::expr::BodyValidationDiagnostic>::collect
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/diagnostics/expr.rs:99:19
  33:     0x56113d4022a2 - <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_def_with_body
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir/src/diagnostics.rs:1281:27
  34:     0x56113d4004e9 - <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module_def
  35:     0x56113d3fd1bf - <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir/src/diagnostics.rs:1148:34
  36:     0x56113d3fd1bf - core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call::<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0}
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:884:29
  37:     0x56113d3fd1bf - <&mut core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0} as core[11918ecc8322c3ee]::ops::function::FnMut<((), hir_def[b797b053043be09c]::ModuleDefId)>>::call_mut
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:298:21
  38:     0x56113d3fd1bf - core[11918ecc8322c3ee]::iter::adapters::copied::copy_fold::<hir_def[b797b053043be09c]::ModuleDefId, (), &mut core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0}>::{closure#0}
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/copied.rs:36:22
  39:     0x56113d3fd1bf - <core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ModuleDefId> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::fold::<(), core[11918ecc8322c3ee]::iter::adapters::copied::copy_fold<hir_def[b797b053043be09c]::ModuleDefId, (), &mut core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0}>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:274:27
  40:     0x56113d3fd1bf - <core[11918ecc8322c3ee]::iter::adapters::copied::Copied<core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ModuleDefId>> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::fold::<(), &mut core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/copied.rs:81:17
  41:     0x56113d3fd1bf - <core[11918ecc8322c3ee]::iter::adapters::chain::Chain<core[11918ecc8322c3ee]::iter::adapters::copied::Copied<core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ModuleDefId>>, core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::iter::adapters::copied::Copied<core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ConstId>>, hir_def[b797b053043be09c]::ModuleDefId::ConstId>> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::fold::<(), core[11918ecc8322c3ee]::iter::traits::iterator::Iterator::for_each::call<hir_def[b797b053043be09c]::ModuleDefId, <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/chain.rs:121:21
  42:     0x56113d3fd1bf - <core[11918ecc8322c3ee]::iter::adapters::chain::Chain<core[11918ecc8322c3ee]::iter::adapters::copied::Copied<core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ModuleDefId>>, core[11918ecc8322c3ee]::iter::adapters::map::Map<core[11918ecc8322c3ee]::iter::adapters::copied::Copied<core[11918ecc8322c3ee]::slice::iter::Iter<hir_def[b797b053043be09c]::ConstId>>, hir_def[b797b053043be09c]::ModuleDefId::ConstId>> as core[11918ecc8322c3ee]::iter::traits::iterator::Iterator>::for_each::<<hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module::{closure#1}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:887:14
  43:     0x56113d3fd1bf - <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect_module
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir/src/diagnostics.rs:1148:14
  44:     0x56113d40f226 - <hir[c7ad7fe945aa0503]::diagnostics::DiagnosticsCollector>::collect
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir/src/diagnostics.rs:766:14
  45:     0x56113d40f226 - <hir[c7ad7fe945aa0503]::Module>::diagnostics
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir/src/lib.rs:699:9
  46:     0x56113ce54d66 - ide_diagnostics[6dc3f02d39f00f14]::semantic_diagnostics
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide-diagnostics/src/lib.rs:432:19
  47:     0x56113ce4f202 - ide_diagnostics[6dc3f02d39f00f14]::full_diagnostics
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide-diagnostics/src/lib.rs:603:16
  48:     0x56113ccd11ed - <ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:829:27
  49:     0x56113ccd11ed - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:70
  50:     0x56113ccd11ed - std[71a467343b18a2c1]::panicking::catch_unwind::do_call::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:573:43
  51:     0x56113ccd11ed - std[71a467343b18a2c1]::panicking::catch_unwind::<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}::{closure#0}>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:541:19
  52:     0x56113ccd11ed - std[71a467343b18a2c1]::panic::catch_unwind::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  53:     0x56113ccd11ed - <salsa[5d03113ac9f39ed2]::cancelled::Cancelled>::catch::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>
                               at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/cancelled.rs:36:15
  54:     0x56113ccd11ed - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:50
  55:     0x56113ccd11ed - <hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::Attached>::attach_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2482:13
  56:     0x56113ccd11ed - hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}>::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2505:46
  57:     0x56113ccd11ed - <std[71a467343b18a2c1]::thread::local::LocalKey<hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::Attached>>::try_with::<hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}>::{closure#0}, core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:463:12
  58:     0x56113ccd11ed - <std[71a467343b18a2c1]::thread::local::LocalKey<hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::Attached>>::with::<hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}>::{closure#0}, core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:427:20
  59:     0x56113ccd11ed - hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>::{closure#0}>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2505:19
  60:     0x56113ccd11ed - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::full_diagnostics::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide_diagnostics[6dc3f02d39f00f14]::Diagnostic>>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:9
  61:     0x56113ccd11ed - <ide[fb707b7c9d152f80]::Analysis>::full_diagnostics
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:829:14
  62:     0x56113c81467f - <rust_analyzer[fbb607e756b1a4f1]::cli::flags::AnalysisStats>::run_ide_things
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/cli/analysis_stats.rs:1354:26
  63:     0x56113c81467f - <rust_analyzer[fbb607e756b1a4f1]::cli::flags::AnalysisStats>::run
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/cli/analysis_stats.rs:382:18
  64:     0x56113c53f70b - rust_analyzer[e285ded21ab2a89]::actual_main
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/bin/main.rs:74:59
  65:     0x56113c53f70b - rust_analyzer[e285ded21ab2a89]::main
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/bin/main.rs:32:9
  66:     0x56113c53a6eb - <fn() -> core[11918ecc8322c3ee]::result::Result<std[71a467343b18a2c1]::process::ExitCode, anyhow[9bbca5dfff5fb2cc]::Error> as core[11918ecc8322c3ee]::ops::function::FnOnce<()>>::call_once
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  67:     0x56113c53a6eb - std[71a467343b18a2c1]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[11918ecc8322c3ee]::result::Result<std[71a467343b18a2c1]::process::ExitCode, anyhow[9bbca5dfff5fb2cc]::Error>, core[11918ecc8322c3ee]::result::Result<std[71a467343b18a2c1]::process::ExitCode, anyhow[9bbca5dfff5fb2cc]::Error>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:166:18
  68:     0x56113c53ce12 - std[71a467343b18a2c1]::rt::lang_start::<core[11918ecc8322c3ee]::result::Result<std[71a467343b18a2c1]::process::ExitCode, anyhow[9bbca5dfff5fb2cc]::Error>>::{closure#0}
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:206:18
  69:     0x56113df18e28 - <&dyn core[11918ecc8322c3ee]::ops::function::Fn<(), Output = i32> + core[11918ecc8322c3ee]::panic::unwind_safe::RefUnwindSafe + core[11918ecc8322c3ee]::marker::Sync as core[11918ecc8322c3ee]::ops::function::FnOnce<()>>::call_once
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/ops/function.rs:287:21
  70:     0x56113df18e28 - std[71a467343b18a2c1]::panicking::catch_unwind::do_call::<&dyn core[11918ecc8322c3ee]::ops::function::Fn<(), Output = i32> + core[11918ecc8322c3ee]::panic::unwind_safe::RefUnwindSafe + core[11918ecc8322c3ee]::marker::Sync, i32>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:573:43
  71:     0x56113df18e28 - std[71a467343b18a2c1]::panicking::catch_unwind::<i32, &dyn core[11918ecc8322c3ee]::ops::function::Fn<(), Output = i32> + core[11918ecc8322c3ee]::panic::unwind_safe::RefUnwindSafe + core[11918ecc8322c3ee]::marker::Sync>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:541:19
  72:     0x56113df18e28 - std[71a467343b18a2c1]::panic::catch_unwind::<&dyn core[11918ecc8322c3ee]::ops::function::Fn<(), Output = i32> + core[11918ecc8322c3ee]::panic::unwind_safe::RefUnwindSafe + core[11918ecc8322c3ee]::marker::Sync, i32>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panic.rs:359:14
  73:     0x56113df18e28 - std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/rt.rs:175:24
  74:     0x56113df18e28 - std[71a467343b18a2c1]::panicking::catch_unwind::do_call::<std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}, isize>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:573:43
  75:     0x56113df18e28 - std[71a467343b18a2c1]::panicking::catch_unwind::<isize, std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:541:19
  76:     0x56113df18e28 - std[71a467343b18a2c1]::panic::catch_unwind::<std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}, isize>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panic.rs:359:14
  77:     0x56113df18e28 - std[71a467343b18a2c1]::rt::lang_start_internal
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/rt.rs:171:5
  78:     0x56113c554f7f - main
  79:     0x7effcfe27781 - <unknown>
  80:     0x7effcfe278b9 - __libc_start_main
  81:     0x56113c5281c5 - _start
  82:                0x0 - <unknown>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the panic with the provided crate and rust-analyzer analysis-stats . --run-all-ide-things using debug assertions. Start in crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs, especially MatchCheckCtx::lower_pat at the reported line, and trace handling of the deref pattern. Done means the example no longer panics during analysis.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.