rust-lang / rust-lang/rust

[ICE]: `entered unreachable code: This method is not called in impls, as patterns are always allowed there`

Open
#160,490 1 comment 0 reactions 1 assignee View on GitHub

@TaKO8Ki is already working on this.

Since Aug 4, 2026.

A-parser C-bug I-ICE S-bug-has-test S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

struct S;

impl S {
    fn f(... a: u8) -> u8 {}
}



original:

struct S;

impl S {
    fn f(... a: u8) -> u8 {}
}

fn main() {}

Version information

rustc 1.99.0-nightly (c9ff49689 2026-08-03)
binary: rustc
commit-hash: c9ff496891c278ad660bc0ab85c1f0b72059464a
commit-date: 2026-08-03
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Possibly related line of code:
https://github.com/rust-lang/rust/blob/c9ff496891c278ad660bc0ab85c1f0b72059464a/compiler/rustc_parse/src/parser/diagnostics.rs#L2395-L2407

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: range-to patterns with `...` are not allowed
 --> /tmp/icemaker_global_tempdir.xoIgQidNADMx/rustc_testrunner_tmpdir_reporting.SYwayaaFypGP/mvce.rs:4:10
  |
4 |     fn f(... a: u8) -> u8 {}
  |          ^^^
  |
help: use `..=` instead
  |
4 -     fn f(... a: u8) -> u8 {}
4 +     fn f(..= a: u8) -> u8 {}
  |


thread 'rustc' (3424648) panicked at /rustc-dev/c9ff496891c278ad660bc0ab85c1f0b72059464a/compiler/rustc_parse/src/parser/diagnostics.rs:2401:36:
internal error: entered unreachable code: This method is not called in impls, as patterns are always allowed there
stack backtrace:
   0:     0x7f0120ccdb86 - <<std[6680dfaa64cc66c5]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f17540a71317f7a8]::fmt::Display>::fmt
   1:     0x7f012140a948 - core[f17540a71317f7a8]::fmt::write
   2:     0x7f0120ce2cac - <std[6680dfaa64cc66c5]::sys::stdio::unix::Stderr as core[f17540a71317f7a8]::io::write::Write>::write_fmt
   3:     0x7f0120ca109a - std[6680dfaa64cc66c5]::panicking::default_hook::{closure#0}
   4:     0x7f0120cc1b33 - std[6680dfaa64cc66c5]::panicking::default_hook
   5:     0x7f011fc2529b - std[6680dfaa64cc66c5]::panicking::update_hook::<alloc[d5bd4e042c235362]::boxed::Box<rustc_driver_impl[27b6e2229d67d5da]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f0120cc1fd2 - std[6680dfaa64cc66c5]::panicking::panic_with_hook
   7:     0x7f0120ca1184 - std[6680dfaa64cc66c5]::panicking::panic_handler::{closure#0}
   8:     0x7f0120c98d69 - std[6680dfaa64cc66c5]::sys::backtrace::__rust_end_short_backtrace::<std[6680dfaa64cc66c5]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f0120ca2b4d - __rustc[4d6acb9b5637ad95]::rust_begin_unwind
  10:     0x7f011da34fac - core[f17540a71317f7a8]::panicking::panic_fmt
  11:     0x7f01204d9a51 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::recover_arg_parse
  12:     0x7f01214d00c6 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_param_general::{closure#0}
  13:     0x7f01214cc31a - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_param_general
  14:     0x7f01214c7016 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_fn_params
  15:     0x7f012150c751 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_fn
  16:     0x7f0121591ced - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_item_kind
  17:     0x7f012158d363 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_item_common
  18:     0x7f01214c057c - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_item_impl
  19:     0x7f0121591efd - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_item_kind
  20:     0x7f012158d363 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_item_common
  21:     0x7f0121540bd4 - <rustc_parse[5338ae46bc8a9eee]::parser::Parser>::parse_mod
  22:     0x7f01223c7f3d - rustc_interface[f3e11f48256f7348]::passes::parse
  23:     0x7f01225d0e0e - rustc_interface[f3e11f48256f7348]::interface::run_compiler::<(), rustc_driver_impl[27b6e2229d67d5da]::run_compiler::{closure#0}>::{closure#2}
  24:     0x7f012261a924 - std[6680dfaa64cc66c5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f3e11f48256f7348]::util::run_in_thread_with_globals<rustc_interface[f3e11f48256f7348]::util::run_in_thread_pool_with_globals<rustc_interface[f3e11f48256f7348]::interface::run_compiler<(), rustc_driver_impl[27b6e2229d67d5da]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  25:     0x7f012261a6ed - <std[6680dfaa64cc66c5]::thread::lifecycle::spawn_unchecked<rustc_interface[f3e11f48256f7348]::util::run_in_thread_with_globals<rustc_interface[f3e11f48256f7348]::util::run_in_thread_pool_with_globals<rustc_interface[f3e11f48256f7348]::interface::run_compiler<(), rustc_driver_impl[27b6e2229d67d5da]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f17540a71317f7a8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7f0122626986 - <std[6680dfaa64cc66c5]::sys::thread::unix::Thread>::new::thread_start
  27:     0x7f011ba97739 - <unknown>
  28:     0x7f011bb1bedc - <unknown>
  29:                0x0 - <unknown>

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: rustc 1.99.0-nightly (c9ff49689 2026-08-03) running on x86_64-unknown-linux-gnu

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


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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.