Skip to content

panic: entered unreachable code: mismatching projection type #23357

Description

@matthiaskrgr

requires debug assertions!

// Regression test for ICE #11814
struct V(i32);

fn func(func_arg: &mut V) {
    || {
        // Declaring `x` separately instead of using
        // a destructuring binding like `let V(x) = ...`
        // because only `V(x) = ...` triggers the ICE
        let x;
        V(x) = func_arg; //~ ERROR: mismatched types
        func_arg.0 = 0;
     };
}

fn main() {}

rust-analyzer analysis-stats . --run-all-ide-things

Database loaded:     324.93ms, 223minstr, 48mb (metadata 158.09ms, 972kinstr, 153kb; build 30.13ms, 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.58s, 28ginstr, 431mb
  Total Statistics:
    crates: 1, mods: 1, decls: 3, bodies: 2, adts: 1, consts: 0, signatures: 3, variants: 1
  Workspace:
    traits: 0, macro_rules macros: 0, proc_macros: 0
    lines of code: 16, 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.43s, 13ginstr, 176mb
Crate lang items:    286.18ms, 2904minstr, 32mb
Expression Store Lowering: 197.82µs, 431kinstr, 7kb
  exprs: 11, ??ty: 0 (0%), ?ty: 0 (0%), !ty: 0
  pats: 5, ??ty: 1 (20%), ?ty: 0 (0%), !ty: 1
  panics: 0
Inference:           1.23ms, 1115kinstr, 2531kb
MIR lowering:        39.08µs, 110kinstr, 352b
Mir failed bodies: 1 (50%)
Data layouts:        32.33µs, 57kinstr, 23kb
Failed data layouts: 0 (0%)
Const evaluation:    12.41µs, 42kinstr, 208b
Failed const evals: 0 (100%)
0/1 0% inlay hints: /tmp/im/f/src/main.rs
thread 'main' (40808) panicked at crates/hir/src/lib.rs:4252:30:
internal error: entered unreachable code: mismatching projection type
stack backtrace:
   0:     0x561e8b3da1f1 - std[71a467343b18a2c1]::backtrace_rs::backtrace::libunwind::trace
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:     0x561e8b3da1f1 - 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:     0x561e8b3da1f1 - std[71a467343b18a2c1]::sys::backtrace::_print_fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:74:9
   3:     0x561e8b3da1f1 - <<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:     0x561e8b3f6e2a - <core[11918ecc8322c3ee]::fmt::rt::Argument>::fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/fmt/rt.rs:152:76
   5:     0x561e8b3f6e2a - core[11918ecc8322c3ee]::fmt::write
   6:     0x561e8b3e3b6c - 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:     0x561e8b3e3b6c - <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:     0x561e8b3b0ee6 - <std[71a467343b18a2c1]::sys::backtrace::BacktraceLock>::print
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/sys/backtrace.rs:47:9
   9:     0x561e8b3b0ee6 - std[71a467343b18a2c1]::panicking::default_hook::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:289:27
  10:     0x561e8b3cff81 - std[71a467343b18a2c1]::panicking::default_hook
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:316:9
  11:     0x561e8b3d02ab - std[71a467343b18a2c1]::panicking::panic_with_hook
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:811:13
  12:     0x561e8b3b0fc4 - std[71a467343b18a2c1]::panicking::panic_handler::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:678:13
  13:     0x561e8b3a8169 - 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:     0x561e8b3b1dcd - __rustc[3b8ba45af69cfb7c]::rust_begin_unwind
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:676:5
  15:     0x561e8b3f76fc - core[11918ecc8322c3ee]::panicking::panic_fmt
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/core/src/panicking.rs:80:14
  16:     0x561e8a8bd3ee - <hir[c7ad7fe945aa0503]::ClosureCapture>::display_place_source_code
  17:     0x561e8a21701c - ide[fb707b7c9d152f80]::inlay_hints::closure_captures::hints
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/inlay_hints/closure_captures.rs:92:21
  18:     0x561e8a1ac6ab - ide[fb707b7c9d152f80]::inlay_hints::hints
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/inlay_hints.rs:238:25
  19:     0x561e8a179f39 - ide[fb707b7c9d152f80]::inlay_hints::inlay_hints::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/inlay_hints.rs:108:13
  20:     0x561e8a179f39 - ide[fb707b7c9d152f80]::inlay_hints::inlay_hints
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/inlay_hints.rs:118:9
  21:     0x561e8a179f39 - <ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:513:27
  22:     0x561e8a179f39 - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:70
  23:     0x561e8a179f39 - std[71a467343b18a2c1]::panicking::catch_unwind::do_call::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:573:43
  24:     0x561e8a179f39 - std[71a467343b18a2c1]::panicking::catch_unwind::<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{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
  25:     0x561e8a179f39 - std[71a467343b18a2c1]::panic::catch_unwind::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>
                               at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  26:     0x561e8a179f39 - <salsa[5d03113ac9f39ed2]::cancelled::Cancelled>::catch::<<ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>
                               at /home/matthias/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/salsa-0.28.2/src/cancelled.rs:36:15
  27:     0x561e8a179f39 - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:50
  28:     0x561e8a179f39 - <hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::Attached>::attach_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2482:13
  29:     0x561e8a179f39 - hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}>::{closure#0}
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2505:46
  30:     0x561e8a179f39 - <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[fb707b7c9d152f80]::inlay_hints::InlayHint>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}>::{closure#0}, core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, 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
  31:     0x561e8a179f39 - <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[fb707b7c9d152f80]::inlay_hints::InlayHint>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}>::{closure#0}, core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, 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
  32:     0x561e8a179f39 - hir_ty[c6020b5b036d7a82]::next_solver::interner::tls_db::attach_db_allow_change::<core[11918ecc8322c3ee]::result::Result<alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>, salsa[5d03113ac9f39ed2]::cancelled::Cancelled>, <ide[fb707b7c9d152f80]::Analysis>::with_db<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>::{closure#0}>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/hir-ty/src/next_solver/interner.rs:2505:19
  33:     0x561e8a179f39 - <ide[fb707b7c9d152f80]::Analysis>::with_db::<<ide[fb707b7c9d152f80]::Analysis>::inlay_hints::{closure#0}, alloc[b37a3ff7fa4d5f32]::vec::Vec<ide[fb707b7c9d152f80]::inlay_hints::InlayHint>>
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:975:9
  34:     0x561e8a179f39 - <ide[fb707b7c9d152f80]::Analysis>::inlay_hints
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/ide/src/lib.rs:513:14
  35:     0x561e89ccaae6 - <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:1388:26
  36:     0x561e89ccaae6 - <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
  37:     0x561e899f570b - rust_analyzer[e285ded21ab2a89]::actual_main
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/bin/main.rs:74:59
  38:     0x561e899f570b - rust_analyzer[e285ded21ab2a89]::main
                               at /home/matthias/vcs/github/rust-analyzer-debug-assertions/crates/rust-analyzer/src/bin/main.rs:32:9
  39:     0x561e899f06eb - <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
  40:     0x561e899f06eb - 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
  41:     0x561e899f2e12 - 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
  42:     0x561e8b3cee28 - <&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
  43:     0x561e8b3cee28 - 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
  44:     0x561e8b3cee28 - 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
  45:     0x561e8b3cee28 - 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
  46:     0x561e8b3cee28 - std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/rt.rs:175:24
  47:     0x561e8b3cee28 - 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
  48:     0x561e8b3cee28 - std[71a467343b18a2c1]::panicking::catch_unwind::<isize, std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panicking.rs:541:19
  49:     0x561e8b3cee28 - std[71a467343b18a2c1]::panic::catch_unwind::<std[71a467343b18a2c1]::rt::lang_start_internal::{closure#0}, isize>
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/panic.rs:359:14
  50:     0x561e8b3cee28 - std[71a467343b18a2c1]::rt::lang_start_internal
                               at /rustc/0fc141305da7a8a222f65aef1f1acc739c46282b/library/std/src/rt.rs:171:5
  51:     0x561e89a0af7f - main
  52:     0x7fe63e427781 - <unknown>
  53:     0x7fe63e4278b9 - __libc_start_main
  54:     0x561e899de1c5 - _start
  55:                0x0 - <unknown>

ra @ 6aeeb8c

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions