Skip to content

ICE: leaf_candidate.false_edge_start_block.is_some() duplicate match arm #133117

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

fn main() {
    match () {
        (!|!) if true => {}
        (!|!) if true => {}
    }
}

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (917a50a03 2024-11-15)
binary: rustc
commit-hash: 917a50a03931a9861c19a46f3e2a02a28f1da936
commit-date: 2024-11-15
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Error output

error[E0658]: `!` patterns are experimental
 --> f.rs:3:10
  |
3 |         (!|!) if true => {}
  |          ^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = help: add `#![feature(never_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-15; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
 --> f.rs:3:12
  |
3 |         (!|!) if true => {}
  |            ^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = help: add `#![feature(never_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-15; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
 --> f.rs:4:10
  |
4 |         (!|!) if true => {}
  |          ^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = help: add `#![feature(never_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-15; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
 --> f.rs:4:12
  |
4 |         (!|!) if true => {}
  |            ^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = help: add `#![feature(never_patterns)]` to the crate attributes to enable
  = note: this compiler was built on 2024-11-15; consider upgrading it if it is out of date

warning: unnecessary parentheses around pattern
 --> f.rs:3:9
  |
3 |         (!|!) if true => {}
  |         ^   ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
3 -         (!|!) if true => {}
3 +         !|! if true => {}
  |

warning: unnecessary parentheses around pattern
 --> f.rs:4:9
  |
4 |         (!|!) if true => {}
  |         ^   ^
  |
help: remove these parentheses
  |
4 -         (!|!) if true => {}
4 +         !|! if true => {}
  |

error: a never pattern is always unreachable
 --> f.rs:3:26
  |
3 |         (!|!) if true => {}
  |                          ^^
  |                          |
  |                          this will never be executed
  |                          help: remove this expression

error: a never pattern is always unreachable
 --> f.rs:4:26
  |
4 |         (!|!) if true => {}
  |                          ^^
  |                          |
  |                          this will never be executed
  |                          help: remove this expression

error: mismatched types
 --> f.rs:3:10
  |
3 |         (!|!) if true => {}
  |          ^ a never pattern must be used on an uninhabited type
  |
  = note: the matched value is of type `()`

error: mismatched types
 --> f.rs:3:12
  |
3 |         (!|!) if true => {}
  |            ^ a never pattern must be used on an uninhabited type
  |
  = note: the matched value is of type `()`
Backtrace

thread 'rustc' panicked at compiler/rustc_mir_build/src/build/matches/mod.rs:1550:17:
assertion failed: leaf_candidate.false_edge_start_block.is_some()
stack backtrace:
   0:     0x79de1e881b0a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf209b603f512c5df
   1:     0x79de1f003f26 - core::fmt::write::hb7459499d17d36c1
   2:     0x79de2042e891 - std::io::Write::write_fmt::h4275802de0932d6f
   3:     0x79de1e881962 - std::sys::backtrace::BacktraceLock::print::hfbfa2f755b02b3d5
   4:     0x79de1e883e66 - std::panicking::default_hook::{{closure}}::h807768543f95a41b
   5:     0x79de1e883cb0 - std::panicking::default_hook::h7a17744703ed785c
   6:     0x79de1d909571 - std[7202c64df357eec]::panicking::update_hook::<alloc[27366bf968cf5613]::boxed::Box<rustc_driver_impl[45f2b7ecc3390aac]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x79de1e884578 - std::panicking::rust_panic_with_hook::h4fba84c8b130fcc8
   8:     0x79de1e884316 - std::panicking::begin_panic_handler::{{closure}}::h9a05dc892413e069
   9:     0x79de1e881fb9 - std::sys::backtrace::__rust_end_short_backtrace::hb562433a6e41eea6
  10:     0x79de1e88400c - rust_begin_unwind
  11:     0x79de1b2e1030 - core::panicking::panic_fmt::hb2b4d3a454bfbc1d
  12:     0x79de1c2b14ec - core::panicking::panic::h4826b1ec2849648d
  13:     0x79de1f2fab32 - rustc_mir_build[7b3a9d387328b746]::build::matches::traverse_candidate::<&mut rustc_mir_build[7b3a9d387328b746]::build::matches::Candidate, (), core[426ecb0f3488faf5]::iter::adapters::rev::Rev<core[426ecb0f3488faf5]::slice::iter::IterMut<rustc_mir_build[7b3a9d387328b746]::build::matches::Candidate>>, <rustc_mir_build[7b3a9d387328b746]::build::matches::Candidate>::visit_leaves_rev<<rustc_mir_build[7b3a9d387328b746]::build::Builder>::lower_match_tree::{closure#1}>::{closure#0}, <rustc_mir_build[7b3a9d387328b746]::build::matches::Candidate>::visit_leaves_rev<<rustc_mir_build[7b3a9d387328b746]::build::Builder>::lower_match_tree::{closure#1}>::{closure#1}, <rustc_mir_build[7b3a9d387328b746]::build::matches::Candidate>::visit_leaves_rev<<rustc_mir_build[7b3a9d387328b746]::build::Builder>::lower_match_tree::{closure#1}>::{closure#2}>
  14:     0x79de1f2fa14b - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::lower_match_tree
  15:     0x79de1f2d86f2 - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::expr_into_dest
  16:     0x79de1f2d9b8a - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::expr_into_dest
  17:     0x79de1fcca02b - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::ast_block_stmts
  18:     0x79de1fcc8f8c - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::ast_block
  19:     0x79de1f2d7a4e - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::expr_into_dest
  20:     0x79de1f2d9b8a - <rustc_mir_build[7b3a9d387328b746]::build::Builder>::expr_into_dest
  21:     0x79de1f2e9469 - rustc_mir_build[7b3a9d387328b746]::build::mir_build
  22:     0x79de1f007d04 - rustc_mir_transform[270f2df9b7743285]::mir_built
  23:     0x79de1f007cc7 - rustc_query_impl[fea741c774525841]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fea741c774525841]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 8usize]>>
  24:     0x79de1f537781 - rustc_query_system[4942b57954000236]::query::plumbing::try_execute_query::<rustc_query_impl[fea741c774525841]::DynamicConfig<rustc_query_system[4942b57954000236]::query::caches::VecCache<rustc_span[7bb8b1398364d9ae]::def_id::LocalDefId, rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[fea741c774525841]::plumbing::QueryCtxt, false>
  25:     0x79de1f53734d - rustc_query_impl[fea741c774525841]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  26:     0x79de1b47ef01 - rustc_mir_build[7b3a9d387328b746]::check_unsafety::check_unsafety
  27:     0x79de1f87a87d - rustc_query_impl[fea741c774525841]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fea741c774525841]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 0usize]>>
  28:     0x79de1f87ab1c - rustc_query_system[4942b57954000236]::query::plumbing::try_execute_query::<rustc_query_impl[fea741c774525841]::DynamicConfig<rustc_query_system[4942b57954000236]::query::caches::VecCache<rustc_span[7bb8b1398364d9ae]::def_id::LocalDefId, rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[fea741c774525841]::plumbing::QueryCtxt, false>
  29:     0x79de1f87a7c1 - rustc_query_impl[fea741c774525841]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
  30:     0x79de1f761c2c - rustc_interface[923321855aedf668]::passes::run_required_analyses
  31:     0x79de1ffae75e - rustc_interface[923321855aedf668]::passes::analysis
  32:     0x79de1ffae72f - rustc_query_impl[fea741c774525841]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fea741c774525841]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 1usize]>>
  33:     0x79de1ffd5cee - rustc_query_system[4942b57954000236]::query::plumbing::try_execute_query::<rustc_query_impl[fea741c774525841]::DynamicConfig<rustc_query_system[4942b57954000236]::query::caches::SingleCache<rustc_middle[19aa9677ff432410]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[fea741c774525841]::plumbing::QueryCtxt, false>
  34:     0x79de1ffd59ce - rustc_query_impl[fea741c774525841]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x79de1fee593a - rustc_interface[923321855aedf668]::interface::run_compiler::<core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>, rustc_driver_impl[45f2b7ecc3390aac]::run_compiler::{closure#0}>::{closure#1}
  36:     0x79de1ff887d0 - std[7202c64df357eec]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[923321855aedf668]::util::run_in_thread_with_globals<rustc_interface[923321855aedf668]::util::run_in_thread_pool_with_globals<rustc_interface[923321855aedf668]::interface::run_compiler<core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>, rustc_driver_impl[45f2b7ecc3390aac]::run_compiler::{closure#0}>::{closure#1}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>::{closure#0}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>
  37:     0x79de1ff88beb - <<std[7202c64df357eec]::thread::Builder>::spawn_unchecked_<rustc_interface[923321855aedf668]::util::run_in_thread_with_globals<rustc_interface[923321855aedf668]::util::run_in_thread_pool_with_globals<rustc_interface[923321855aedf668]::interface::run_compiler<core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>, rustc_driver_impl[45f2b7ecc3390aac]::run_compiler::{closure#0}>::{closure#1}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>::{closure#0}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[426ecb0f3488faf5]::result::Result<(), rustc_span[7bb8b1398364d9ae]::ErrorGuaranteed>>::{closure#1} as core[426ecb0f3488faf5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x79de1ff896b9 - std::sys::pal::unix::thread::Thread::new::thread_start::h10999df32e8f1e96
  39:     0x79de217b139d - <unknown>
  40:     0x79de2183649c - <unknown>
  41:                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: please attach the file at `/tmp/im/rustc-ice-2024-11-16T18_50_02-873945.txt` to your bug report

query stack during panic:
#0 [mir_built] building MIR for `main`
#1 [check_unsafety] unsafety-checking `main`
end of query stack
error: aborting due to 8 previous errors; 2 warnings emitted

For more information about this error, try `rustc --explain E0658`.

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.F-never_patterns`#![feature(never_patterns)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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