Skip to content

[ICE]: "Reborrow expression in match" #156304

Closed

Description

@theemathas

Code

#![feature(reborrow)]

use std::marker::Reborrow;

struct Thing<'a>(&'a ());

impl<'a> Reborrow for Thing<'a> {}

fn main() {
    let x = Thing(&());
    let y: Thing<'_> = x;
}

Meta

rustc --version --verbose:

rustc 1.97.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: aarch64-apple-darwin
release: 1.97.0-dev
LLVM version: 22.1.4

Compiled from the main branch at commit 63b1dfc.

Error output

thread 'rustc' (282284) panicked at compiler/rustc_mir_build/src/thir/pattern/check_match.rs:371:17:
internal error: entered unreachable code: Reborrow expression in match
Backtrace

stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:689:5
   1: core::panicking::panic_fmt
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/panicking.rs:80:14
   2: is_known_valid_scrutinee
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:371:17
   3: {closure#0}
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:390:40
   4: map<&rustc_middle::thir::Expr, bool, rustc_mir_build::thir::pattern::check_match::{impl#1}::new_cx::{closure_env#0}>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/option.rs:1165:29
   5: new_cx
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:390:23
   6: analyze_binding
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:629:23
   7: check_binding_is_irrefutable
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:659:37
   8: check_let
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:445:18
   9: {closure#1}
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:188:30
  10: {closure#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_stmt::{closure#0}::{closure_env#1}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:205:36
  11: maybe_grow<(), rustc_mir_build::thir::pattern::check_match::{impl#1}::with_let_source::{closure_env#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_stmt::{closure#0}::{closure_env#1}>>
             at /Users/timch/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/stacker-0.1.21/src/lib.rs:57:9
  12: ensure_sufficient_stack<(), rustc_mir_build::thir::pattern::check_match::{impl#1}::with_let_source::{closure_env#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_stmt::{closure#0}::{closure_env#1}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/stack.rs:21:5
  13: with_let_source<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_stmt::{closure#0}::{closure_env#1}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:205:9
  14: {closure#0}
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:187:26
  15: with_hir_source<(), rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_stmt::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:212:19
  16: visit_stmt
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:183:22
  17: walk_block<rustc_mir_build::thir::pattern::check_match::MatchVisitor>
             at /Users/timch/rust/compiler/rustc_middle/src/thir/visit.rs:228:17
  18: {closure#4}
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:177:54
  19: {closure#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_expr::{closure_env#4}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:205:36
  20: maybe_grow<(), rustc_mir_build::thir::pattern::check_match::{impl#1}::with_let_source::{closure_env#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_expr::{closure_env#4}>>
             at /Users/timch/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/stacker-0.1.21/src/lib.rs:57:9
  21: ensure_sufficient_stack<(), rustc_mir_build::thir::pattern::check_match::{impl#1}::with_let_source::{closure_env#0}<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_expr::{closure_env#4}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/stack.rs:21:5
  22: with_let_source<rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_expr::{closure_env#4}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:205:9
  23: visit_expr
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:177:14
  24: {closure#0}
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:128:26
  25: with_hir_source<(), rustc_mir_build::thir::pattern::check_match::{impl#0}::visit_expr::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:212:19
  26: visit_expr
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:127:22
  27: check_match
             at /Users/timch/rust/compiler/rustc_mir_build/src/thir/pattern/check_match.rs:51:13
      [... omitted 42 frames ...]
  28: query_ensure_ok_or_done<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>>
             at /Users/timch/rust/compiler/rustc_middle/src/query/inner.rs:63:13
  29: mir_built<rustc_span::def_id::LocalDefId>
             at /Users/timch/rust/compiler/rustc_middle/src/query/plumbing.rs:623:21
  30: check_unsafety
             at /Users/timch/rust/compiler/rustc_mir_build/src/check_unsafety.rs:1052:23
      [... omitted 28 frames ...]
  31: check_unsafety<rustc_span::def_id::LocalDefId>
             at /Users/timch/rust/compiler/rustc_middle/src/query/plumbing.rs:589:21
  32: {closure#0}
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1159:33
  33: {closure#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_middle/src/hir/map.rs:338:79
  34: {closure#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:182:30
  35: call_once<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/panic/unwind_safe.rs:275:9
  36: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>, ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  37: catch_unwind<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  38: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>, ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  39: run<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:23:9
  40: {closure#1}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:182:23
  41: for_each<rustc_span::def_id::LocalDefId, rustc_data_structures::sync::parallel::par_for_each_in::{closure#0}::{closure_env#1}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/slice/iter/macros.rs:301:21
  42: {closure#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:181:27
  43: parallel_guard<(), rustc_data_structures::sync::parallel::par_for_each_in::{closure_env#0}<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:39:15
  44: par_for_each_in<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], rustc_middle::hir::map::{impl#3}::par_hir_body_owners::{closure_env#0}<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>>
             at /Users/timch/rust/compiler/rustc_data_structures/src/sync/parallel.rs:176:5
  45: par_hir_body_owners<rustc_interface::passes::run_required_analyses::{closure#2}::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_middle/src/hir/map.rs:338:9
  46: {closure#2}
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1155:13
  47: run<(), rustc_interface::passes::run_required_analyses::{closure_env#2}>
             at /Users/timch/rust/compiler/rustc_data_structures/src/profiling.rs:845:9
  48: time<(), rustc_interface::passes::run_required_analyses::{closure_env#2}>
             at /Users/timch/rust/compiler/rustc_session/src/utils.rs:17:50
  49: run_required_analyses
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1154:10
  50: analysis
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1198:5
      [... omitted 28 frames ...]
  51: query_ensure_ok_or_done<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>>
             at /Users/timch/rust/compiler/rustc_middle/src/query/inner.rs:63:13
  52: analysis
             at /Users/timch/rust/compiler/rustc_middle/src/query/plumbing.rs:589:21
  53: {closure#2}
             at /Users/timch/rust/compiler/rustc_driver_impl/src/lib.rs:325:29
  54: {closure#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1026:80
  55: call_once<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/panic/unwind_safe.rs:275:9
  56: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  57: catch_unwind<core::option::Option<rustc_interface::queries::Linker>, core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  58: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::create_and_enter_global_ctxt::{closure#2}::{closure_env#0}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>, core::option::Option<rustc_interface::queries::Linker>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  59: {closure#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:1026:23
  60: {closure#1}<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>
             at /Users/timch/rust/compiler/rustc_middle/src/ty/context.rs:788:37
  61: {closure#0}<rustc_middle::ty::context::{impl#15}::enter::{closure_env#1}<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
             at /Users/timch/rust/compiler/rustc_middle/src/ty/context/tls.rs:56:9
  62: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#15}::enter::{closure_env#1}<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/local.rs:462:12
  63: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#15}::enter::{closure_env#1}<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/thread/local.rs:426:20
  64: enter_context<rustc_middle::ty::context::{impl#15}::enter::{closure_env#1}<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>, core::option::Option<rustc_interface::queries::Linker>>
             at /Users/timch/rust/compiler/rustc_middle/src/ty/context/tls.rs:53:9
  65: enter<rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>, core::option::Option<rustc_interface::queries::Linker>>
             at /Users/timch/rust/compiler/rustc_middle/src/ty/context.rs:788:9
  66: create_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt::{closure_env#2}<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>>
             at /Users/timch/rust/compiler/rustc_middle/src/ty/context.rs:982:13
  67: create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure_env#2}>
             at /Users/timch/rust/compiler/rustc_interface/src/passes.rs:986:5
  68: {closure#0}
             at /Users/timch/rust/compiler/rustc_driver_impl/src/lib.rs:298:22
  69: {closure#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_interface/src/interface.rs:495:80
  70: call_once<(), rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/panic/unwind_safe.rs:275:9
  71: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  72: catch_unwind<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  73: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler::{closure#1}::{closure_env#0}<(), rustc_driver_impl::run_compiler::{closure_env#0}>>, ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  74: {closure#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>
             at /Users/timch/rust/compiler/rustc_interface/src/interface.rs:495:23
  75: {closure#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>
             at /Users/timch/rust/compiler/rustc_interface/src/util.rs:205:17
  76: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at /Users/timch/rust/compiler/rustc_interface/src/util.rs:161:24
  77: set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>, ()>
             at /Users/timch/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/scoped-tls-1.0.1/src/lib.rs:137:9
  78: create_session_globals_then<(), rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>>
             at /Users/timch/rust/compiler/rustc_span/src/lib.rs:154:21
  79: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<(), rustc_driver_impl::run_compiler::{closure_env#0}>, ()>, ()>
             at /Users/timch/rust/compiler/rustc_interface/src/util.rs:157:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/Users/timch/foo/rustc-ice-2026-05-08T09_28_21-11701.txt` to your bug report

note: rustc 1.97.0-dev running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_match] match-checking `main`
#1 [check_unsafety] unsafety-checking `main`
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 mir_built(foo[d3ea]::main)
end of try_mark_green dep node stack
error: could not compile `foo` (bin "foo")

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    F-reborrow`#![feature(reborrow)]`; see #145612
    on May 8, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 8, 2026
  3. theemathas commented on May 8, 2026

    @theemathas
    ContributorAuthor

    Presumably started ICE-ing in #151753. cc @aapoalas

  4. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on May 8, 2026
  5. aapoalas commented on May 8, 2026

    @aapoalas
    Contributor

    Presumably this came from trying out the feature? Thank you for that! I'll try take a look maybe this weekend.

  6. aapoalas commented on May 8, 2026

    @aapoalas
    Contributor

    I believe there's a similar test but it doesn't define the type on the assignment's left hand side, which perhaps is what's making the difference....?

  7. theemathas commented on May 8, 2026

    @theemathas
    ContributorAuthor

    let statements are a coercion site only if there's a type annotation. https://doc.rust-lang.org/stable/reference/type-coercions.html#r-coerce.site.let

  8. theemathas commented on May 8, 2026

    @theemathas
    ContributorAuthor

    Another way to trigger the ICE:

    #![feature(reborrow)]
    
    use std::marker::Reborrow;
    
    struct Thing<'a>(&'a ());
    
    impl<'a> Reborrow for Thing<'a> {}
    
    fn main() {
        let x = Thing(&());
        let y = x as Thing<'_>;
    }
  9. added 2 commits that reference this issue on May 10, 2026
    d33589d
    cfd0d4c
  10. added a commit that references this issue on May 10, 2026
    ec10a1d
  11. added a commit that references this issue on May 13, 2026
    5586ae1
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

    C-bugCategory: This is a bug.F-reborrow`#![feature(reborrow)]`; see #145612I-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