Skip to content

ICE: "unexpected resolution for an identifier in pattern"  #95878

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

impl<'a> Foo<'a> {
    const fn spam(&mut self, baz: &mut Vec<u32>) {
    match 15 {
        ref Self => (),
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (8bf93e9b6 2022-04-09)
binary: rustc
commit-hash: 8bf93e9b6791acee3a594ed202fdfe45ad9952b5
commit-date: 2022-04-09
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

Error output

error: this file contains an unclosed delimiter
 --> ./src/test/icemaker_92575.rs:8:14
  |
1 | impl<'a> Foo<'a> {
  |                  - unclosed delimiter
2 |     const fn spam(&mut self, baz: &mut Vec<u32>) {
  |                                                  - this delimiter might not be properly closed...
...
6 | }
  | - ...as it matches this but it has different indentation
7 |
8 | fn main() {}
  |              ^

error: expected identifier, found keyword `Self`
 --> ./src/test/icemaker_92575.rs:4:13
  |
4 |         ref Self => (),
  |             ^^^^ expected identifier, found keyword

thread 'rustc' panicked at 'compiler/rustc_resolve/src/late.rs:1873:18: unexpected resolution for an identifier in pattern: SelfCtor(DefId(0:3))', /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/compiler/rustc_middle/src/util/bug.rs:36:26
stack backtrace:
Backtrace

thread 'rustc' panicked at 'compiler/rustc_resolve/src/late.rs:1873:18: unexpected resolution for an identifier in pattern: SelfCtor(DefId(0:3))', /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/compiler/rustc_middle/src/util/bug.rs:36:26
stack backtrace:
   0:     0x7fc3fce9e00d - std::backtrace_rs::backtrace::libunwind::trace::h06b71e168fca8ca7
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fc3fce9e00d - std::backtrace_rs::backtrace::trace_unsynchronized::hd5c568c45ebf115f
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc3fce9e00d - std::sys_common::backtrace::_print_fmt::h2207f18151caed70
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fc3fce9e00d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hec1ef25b87918dac
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fc3fcef7d2c - core::fmt::write::h3bdfdbc9caaeb5c4
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fc3fce8f8d1 - std::io::Write::write_fmt::h75f007d851ff8f3e
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/io/mod.rs:1655:15
   6:     0x7fc3fcea0f25 - std::sys_common::backtrace::_print::h8cb608922c1cc56d
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fc3fcea0f25 - std::sys_common::backtrace::print::h69d750eeeb320760
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fc3fcea0f25 - std::panicking::default_hook::{{closure}}::h220d8c7b31c1776e
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/panicking.rs:295:22
   9:     0x7fc3fcea0b99 - std::panicking::default_hook::hd732eb9b63a7d08e
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/panicking.rs:314:9
  10:     0x7fc3fd6cf3c1 - rustc_driver[3655e38759671b1e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fc3fcea16c0 - std::panicking::rust_panic_with_hook::he731ea0e4d942ce4
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/panicking.rs:702:17
  12:     0x7fc3fdb593e2 - std[4f0b898746aae38d]::panicking::begin_panic::<alloc[216d6682df358076]::string::String>::{closure#0}
  13:     0x7fc3fdb5756a - std[4f0b898746aae38d]::sys_common::backtrace::__rust_end_short_backtrace::<std[4f0b898746aae38d]::panicking::begin_panic<alloc[216d6682df358076]::string::String>::{closure#0}, !>
  14:     0x7fc3fdae188d - std[4f0b898746aae38d]::panicking::begin_panic::<alloc[216d6682df358076]::string::String>
  15:     0x7fc3fdaec4e4 - std[4f0b898746aae38d]::panic::panic_any::<alloc[216d6682df358076]::string::String>
  16:     0x7fc3fdaeee0f - rustc_middle[b37bb0524598582d]::ty::context::tls::with_opt::<rustc_middle[b37bb0524598582d]::util::bug::opt_span_bug_fmt<rustc_span[2556154be3375056]::span_encoding::Span>::{closure#0}, ()>
  17:     0x7fc3fdaeed56 - rustc_middle[b37bb0524598582d]::util::bug::opt_span_bug_fmt::<rustc_span[2556154be3375056]::span_encoding::Span>
  18:     0x7fc3fdaeed17 - rustc_middle[b37bb0524598582d]::util::bug::span_bug_fmt::<rustc_span[2556154be3375056]::span_encoding::Span>
  19:     0x7fc3fecd6e0d - <rustc_ast[139425a543286658]::ast::Pat>::walk::<<rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor>::resolve_pattern_inner::{closure#0}>
  20:     0x7fc3fed1a0fc - <rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor as rustc_ast[139425a543286658]::visit::Visitor>::visit_arm
  21:     0x7fc3fed27fe5 - <rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor>::resolve_expr
  22:     0x7fc3fed1a45d - <rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor as rustc_ast[139425a543286658]::visit::Visitor>::visit_block
  23:     0x7fc3fed1b5ef - <rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor as rustc_ast[139425a543286658]::visit::Visitor>::visit_fn
  24:     0x7fc3fece3779 - rustc_ast[139425a543286658]::visit::walk_assoc_item::<rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor>
  25:     0x7fc3fed1e53b - <rustc_resolve[577bf44bd1426e45]::late::LateResolutionVisitor>::resolve_item
  26:     0x7fc3ffa39e4c - <rustc_resolve[577bf44bd1426e45]::Resolver>::late_resolve_crate
  27:     0x7fc3ffa1a17b - <rustc_session[77d0986998ed6bd]::session::Session>::time::<(), <rustc_resolve[577bf44bd1426e45]::Resolver>::resolve_crate::{closure#0}>
  28:     0x7fc3ff718a44 - rustc_interface[aab2741c181344a3]::passes::configure_and_expand
  29:     0x7fc3ff73f951 - <rustc_interface[aab2741c181344a3]::queries::Queries>::expansion
  30:     0x7fc3ff6e72a9 - <rustc_interface[aab2741c181344a3]::interface::Compiler>::enter::<rustc_driver[3655e38759671b1e]::run_compiler::{closure#1}::{closure#2}, core[491626612f8df212]::result::Result<core[491626612f8df212]::option::Option<rustc_interface[aab2741c181344a3]::queries::Linker>, rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>
  31:     0x7fc3ff70ff1f - rustc_span[2556154be3375056]::with_source_map::<core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>, rustc_interface[aab2741c181344a3]::interface::create_compiler_and_run<core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>, rustc_driver[3655e38759671b1e]::run_compiler::{closure#1}>::{closure#1}>
  32:     0x7fc3ff6e8237 - <scoped_tls[8f93d9f95e89128f]::ScopedKey<rustc_span[2556154be3375056]::SessionGlobals>>::set::<rustc_interface[aab2741c181344a3]::interface::run_compiler<core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>, rustc_driver[3655e38759671b1e]::run_compiler::{closure#1}>::{closure#0}, core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>
  33:     0x7fc3ff6fd3ff - std[4f0b898746aae38d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[aab2741c181344a3]::util::run_in_thread_pool_with_globals<rustc_interface[aab2741c181344a3]::interface::run_compiler<core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>, rustc_driver[3655e38759671b1e]::run_compiler::{closure#1}>::{closure#0}, core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>::{closure#0}, core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>
  34:     0x7fc3ff6fd539 - <<std[4f0b898746aae38d]::thread::Builder>::spawn_unchecked_<rustc_interface[aab2741c181344a3]::util::run_in_thread_pool_with_globals<rustc_interface[aab2741c181344a3]::interface::run_compiler<core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>, rustc_driver[3655e38759671b1e]::run_compiler::{closure#1}>::{closure#0}, core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>::{closure#0}, core[491626612f8df212]::result::Result<(), rustc_errors[ced839e2d504a56c]::ErrorGuaranteed>>::{closure#1} as core[491626612f8df212]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7fc3fceab823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6aa3defc4f10dc70
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/alloc/src/boxed.rs:1858:9
  36:     0x7fc3fceab823 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h553d7c8698383f07
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/alloc/src/boxed.rs:1858:9
  37:     0x7fc3fceab823 - std::sys::unix::thread::Thread::new::thread_start::h0643c814f607f90a
                               at /rustc/8bf93e9b6791acee3a594ed202fdfe45ad9952b5/library/std/src/sys/unix/thread.rs:108:17
  38:     0x7fc3fcc835c2 - start_thread
  39:     0x7fc3fcd08584 - __clone
  40:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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: rustc 1.62.0-nightly (8bf93e9b6 2022-04-09) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 2 previous errors

Metadata

Metadata

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