Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE "region scope ... not in scope to drop" #104172

Closed
jruderman opened this issue Nov 8, 2022 · 1 comment · Fixed by #115677
Closed

ICE "region scope ... not in scope to drop" #104172

jruderman opened this issue Nov 8, 2022 · 1 comment · Fixed by #115677
Assignees
Labels
C-bug Category: This is a bug. F-let_chains `#![feature(let_chains)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jruderman
Copy link
Contributor

Found with a modified fuzz-rustc

Code

#![allow(dead_code)]

const N: usize = {
    struct U;
    ! let y = 42;
    3
};

struct S {
    x: [(); N]
}

fn main() {}

Error output

rsr.rs:5:7: error: expected expression, found `let` statement
rsr.rs:5:7: error: `let` expressions are not supported here
rsr.rs:5:7: error[E0658]: `let` expressions in this position are unstable
rsr.rs:5:11: error: internal compiler error: compiler/rustc_mir_build/src/build/scope.rs:935:9: region scope Remainder { block: 11, first_statement_index: 0} not in scope to drop _4
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7eef946fc0e0eff40e588eab77b09b287accbec3/compiler/rustc_errors/src/lib.rs:967:33
stack backtrace:
   0:        0x10e4fa7a2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hde9930b8710af522
   1:        0x10e5525ea - core::fmt::write::hd25ec0bfc1849a2f
   2:        0x10e4ec87c - std::io::Write::write_fmt::hca36d7396c5dc18b
   3:        0x10e4fa56a - std::sys_common::backtrace::print::hc155979e9e33e658
   4:        0x10e4fd946 - std::panicking::default_hook::{{closure}}::h03db778ae686f347
   5:        0x10e4fd697 - std::panicking::default_hook::h0d9e8bcb55be071f
   6:        0x1190577dd - rustc_driver[77a613ab63d15aac]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x10e4fe145 - std::panicking::rust_panic_with_hook::h758520931cfdfde5
   8:        0x11c2c5667 - std[11391ffec397fd56]::panicking::begin_panic::<rustc_errors[ec87cacb996b1da1]::ExplicitBug>::{closure#0}
   9:        0x11c2c0629 - std[11391ffec397fd56]::sys_common::backtrace::__rust_end_short_backtrace::<std[11391ffec397fd56]::panicking::begin_panic<rustc_errors[ec87cacb996b1da1]::ExplicitBug>::{closure#0}, !>
  10:        0x11dda1999 - std[11391ffec397fd56]::panicking::begin_panic::<rustc_errors[ec87cacb996b1da1]::ExplicitBug>
  11:        0x11c2dfa19 - std[11391ffec397fd56]::panic::panic_any::<rustc_errors[ec87cacb996b1da1]::ExplicitBug>
  12:        0x11c2df2e8 - <rustc_errors[ec87cacb996b1da1]::HandlerInner>::span_bug::<rustc_span[48482e0f8f724117]::span_encoding::Span, &alloc[a05f3e7fdaf4d80f]::string::String>
  13:        0x11c2df08e - <rustc_errors[ec87cacb996b1da1]::Handler>::span_bug::<rustc_span[48482e0f8f724117]::span_encoding::Span, &alloc[a05f3e7fdaf4d80f]::string::String>
  14:        0x11c271261 - rustc_middle[b315a0ebd84f913d]::ty::context::tls::with_context_opt::<rustc_middle[b315a0ebd84f913d]::ty::context::tls::with_opt<rustc_middle[b315a0ebd84f913d]::util::bug::opt_span_bug_fmt<rustc_span[48482e0f8f724117]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  15:        0x11c270f81 - rustc_middle[b315a0ebd84f913d]::util::bug::opt_span_bug_fmt::<rustc_span[48482e0f8f724117]::span_encoding::Span>
  16:        0x11dda095f - rustc_middle[b315a0ebd84f913d]::util::bug::span_bug_fmt::<rustc_span[48482e0f8f724117]::span_encoding::Span>
  17:        0x11c2603d0 - <rustc_mir_build[603c590c528b19b]::build::Builder>::schedule_drop
  18:        0x11c25c768 - <rustc_mir_build[603c590c528b19b]::build::Builder>::bind_and_guard_matched_candidate
  19:        0x11c254b8d - <rustc_mir_build[603c590c528b19b]::build::Builder>::bind_pattern
  20:        0x11c25bd72 - <rustc_mir_build[603c590c528b19b]::build::Builder>::lower_let_expr
  21:        0x11c264033 - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest
  22:        0x11c262a6a - <rustc_mir_build[603c590c528b19b]::build::Builder>::as_temp_inner
  23:        0x11c261d0a - <rustc_mir_build[603c590c528b19b]::build::Builder>::as_operand
  24:        0x11c262096 - <rustc_mir_build[603c590c528b19b]::build::Builder>::as_operand
  25:        0x11c24d08e - <rustc_mir_build[603c590c528b19b]::build::Builder>::as_rvalue
  26:        0x11c262d0f - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest
  27:        0x11c262a6a - <rustc_mir_build[603c590c528b19b]::build::Builder>::as_temp_inner
  28:        0x11c251560 - <rustc_mir_build[603c590c528b19b]::build::Builder>::stmt_expr
  29:        0x11c251764 - <rustc_mir_build[603c590c528b19b]::build::Builder>::stmt_expr
  30:        0x11c246482 - <rustc_mir_build[603c590c528b19b]::build::Builder>::ast_block_stmts
  31:        0x11c269786 - <rustc_mir_build[603c590c528b19b]::build::Builder>::in_scope::<<rustc_mir_build[603c590c528b19b]::build::Builder>::ast_block::{closure#2}::{closure#0}, ()>
  32:        0x11c264c49 - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest
  33:        0x11c26a170 - <rustc_mir_build[603c590c528b19b]::build::Builder>::in_scope::<<rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest::{closure#0}::{closure#0}, ()>
  34:        0x11c266d6d - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest::{closure#0}
  35:        0x11c264536 - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest
  36:        0x11c26a170 - <rustc_mir_build[603c590c528b19b]::build::Builder>::in_scope::<<rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest::{closure#0}::{closure#0}, ()>
  37:        0x11c266d6d - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest::{closure#0}
  38:        0x11c264536 - <rustc_mir_build[603c590c528b19b]::build::Builder>::expr_into_dest
  39:        0x11c242648 - rustc_mir_build[603c590c528b19b]::build::mir_build
  40:        0x11c23fcb2 - rustc_mir_build[603c590c528b19b]::build::mir_built
  41:        0x11c896eba - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::WithOptConstParam<rustc_span[48482e0f8f724117]::def_id::LocalDefId>, &rustc_data_structures[d9a04b93d3448b55]::steal::Steal<rustc_middle[b315a0ebd84f913d]::mir::Body>>>
  42:        0x11c9c2eb5 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_built, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  43:        0x11ca68c97 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::mir_built
  44:        0x11bdf22bc - rustc_mir_transform[908f959bb72ad5af]::check_unsafety::unsafety_check_result
  45:        0x11bdee44b - <rustc_mir_transform[908f959bb72ad5af]::check_unsafety::provide::{closure#0} as core[cfd2f0869b685cd6]::ops::function::FnOnce<(rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt, rustc_span[48482e0f8f724117]::def_id::LocalDefId)>>::call_once
  46:        0x11c8c79e9 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_span[48482e0f8f724117]::def_id::LocalDefId, &rustc_middle[b315a0ebd84f913d]::mir::query::UnsafetyCheckResult>>
  47:        0x11c9b996c - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::unsafety_check_result, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  48:        0x11bd951a1 - rustc_mir_transform[908f959bb72ad5af]::mir_const
  49:        0x11c896eba - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::WithOptConstParam<rustc_span[48482e0f8f724117]::def_id::LocalDefId>, &rustc_data_structures[d9a04b93d3448b55]::steal::Steal<rustc_middle[b315a0ebd84f913d]::mir::Body>>>
  50:        0x11c9c2fe2 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_const, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  51:        0x11ca68cc7 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::mir_const
  52:        0x11bd94143 - rustc_mir_transform[908f959bb72ad5af]::mir_const_qualif
  53:        0x11bd7f144 - <rustc_mir_transform[908f959bb72ad5af]::provide::{closure#0} as core[cfd2f0869b685cd6]::ops::function::FnOnce<(rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt, rustc_span[48482e0f8f724117]::def_id::DefId)>>::call_once
  54:        0x11c8f1e2c - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_span[48482e0f8f724117]::def_id::DefId, rustc_middle[b315a0ebd84f913d]::mir::query::ConstQualifs>>
  55:        0x11c9b35e6 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_const_qualif, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  56:        0x11bd9593e - rustc_mir_transform[908f959bb72ad5af]::mir_promoted
  57:        0x11c8980e0 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::WithOptConstParam<rustc_span[48482e0f8f724117]::def_id::LocalDefId>, (&rustc_data_structures[d9a04b93d3448b55]::steal::Steal<rustc_middle[b315a0ebd84f913d]::mir::Body>, &rustc_data_structures[d9a04b93d3448b55]::steal::Steal<rustc_index[975aea96e92c3aa6]::vec::IndexVec<rustc_middle[b315a0ebd84f913d]::mir::Promoted, rustc_middle[b315a0ebd84f913d]::mir::Body>>)>>
  58:        0x11c9ae8c8 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_promoted, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  59:        0x11ca68e87 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::mir_promoted
  60:        0x11c43f996 - rustc_borrowck[92a4f20c78c2d7a9]::mir_borrowck
  61:        0x11c420685 - <rustc_borrowck[92a4f20c78c2d7a9]::provide::{closure#0} as core[cfd2f0869b685cd6]::ops::function::FnOnce<(rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt, rustc_span[48482e0f8f724117]::def_id::LocalDefId)>>::call_once
  62:        0x11c8c67c9 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_span[48482e0f8f724117]::def_id::LocalDefId, &rustc_middle[b315a0ebd84f913d]::mir::query::BorrowCheckResult>>
  63:        0x11c9ae633 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_borrowck, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  64:        0x11d8d3a62 - <rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt>::mir_borrowck_opt_const_arg
  65:        0x11bd96cac - rustc_mir_transform[908f959bb72ad5af]::mir_drops_elaborated_and_const_checked
  66:        0x11c896eba - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::WithOptConstParam<rustc_span[48482e0f8f724117]::def_id::LocalDefId>, &rustc_data_structures[d9a04b93d3448b55]::steal::Steal<rustc_middle[b315a0ebd84f913d]::mir::Body>>>
  67:        0x11c9c0f82 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  68:        0x11ca68e07 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
  69:        0x11bd96910 - rustc_mir_transform[908f959bb72ad5af]::inner_mir_for_ctfe
  70:        0x11bd96218 - rustc_mir_transform[908f959bb72ad5af]::mir_for_ctfe
  71:        0x11c8fa515 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_span[48482e0f8f724117]::def_id::DefId, &rustc_middle[b315a0ebd84f913d]::mir::Body>>
  72:        0x11c9ae785 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::mir_for_ctfe, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  73:        0x11c72ec91 - <rustc_const_eval[d893f35e951f968e]::const_eval::machine::CompileTimeInterpreter as rustc_const_eval[d893f35e951f968e]::interpret::machine::Machine>::load_mir
  74:        0x11c6830fc - <rustc_const_eval[d893f35e951f968e]::interpret::eval_context::InterpCx<rustc_const_eval[d893f35e951f968e]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  75:        0x11c6db3b3 - rustc_const_eval[d893f35e951f968e]::const_eval::eval_queries::eval_to_allocation_raw_provider
  76:        0x11c88beaf - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::ParamEnvAnd<rustc_middle[b315a0ebd84f913d]::mir::interpret::GlobalId>, core[cfd2f0869b685cd6]::result::Result<rustc_middle[b315a0ebd84f913d]::mir::interpret::value::ConstAlloc, rustc_middle[b315a0ebd84f913d]::mir::interpret::error::ErrorHandled>>>
  77:        0x11c9ba20a - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::eval_to_allocation_raw, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  78:        0x11ca69a71 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::eval_to_allocation_raw
  79:        0x11c68488d - <rustc_const_eval[d893f35e951f968e]::interpret::eval_context::InterpCx<rustc_const_eval[d893f35e951f968e]::const_eval::machine::CompileTimeInterpreter>>::eval_to_allocation
  80:        0x11c691faa - <rustc_const_eval[d893f35e951f968e]::interpret::eval_context::InterpCx<rustc_const_eval[d893f35e951f968e]::const_eval::machine::CompileTimeInterpreter>>::const_to_op
  81:        0x11c6a433f - <rustc_const_eval[d893f35e951f968e]::interpret::eval_context::InterpCx<rustc_const_eval[d893f35e951f968e]::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
  82:        0x11c6db973 - rustc_const_eval[d893f35e951f968e]::const_eval::eval_queries::eval_to_allocation_raw_provider
  83:        0x11c88beaf - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::ParamEnvAnd<rustc_middle[b315a0ebd84f913d]::mir::interpret::GlobalId>, core[cfd2f0869b685cd6]::result::Result<rustc_middle[b315a0ebd84f913d]::mir::interpret::value::ConstAlloc, rustc_middle[b315a0ebd84f913d]::mir::interpret::error::ErrorHandled>>>
  84:        0x11c9ba20a - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::eval_to_allocation_raw, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  85:        0x11ca69a71 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::eval_to_allocation_raw
  86:        0x11c6db05a - rustc_const_eval[d893f35e951f968e]::const_eval::eval_queries::eval_to_allocation_raw_provider
  87:        0x11c88beaf - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::ParamEnvAnd<rustc_middle[b315a0ebd84f913d]::mir::interpret::GlobalId>, core[cfd2f0869b685cd6]::result::Result<rustc_middle[b315a0ebd84f913d]::mir::interpret::value::ConstAlloc, rustc_middle[b315a0ebd84f913d]::mir::interpret::error::ErrorHandled>>>
  88:        0x11c9ba20a - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::eval_to_allocation_raw, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  89:        0x11ca69a71 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::eval_to_allocation_raw
  90:        0x11c6e379a - rustc_const_eval[d893f35e951f968e]::const_eval::eval_to_valtree
  91:        0x11c6b86c3 - <rustc_const_eval[d893f35e951f968e]::provide::{closure#0} as core[cfd2f0869b685cd6]::ops::function::FnOnce<(rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt, rustc_middle[b315a0ebd84f913d]::ty::ParamEnvAnd<rustc_middle[b315a0ebd84f913d]::mir::interpret::GlobalId>)>>::call_once
  92:        0x11c88a73b - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_middle[b315a0ebd84f913d]::ty::ParamEnvAnd<rustc_middle[b315a0ebd84f913d]::mir::interpret::GlobalId>, core[cfd2f0869b685cd6]::result::Result<core[cfd2f0869b685cd6]::option::Option<rustc_middle[b315a0ebd84f913d]::ty::consts::valtree::ValTree>, rustc_middle[b315a0ebd84f913d]::mir::interpret::error::ErrorHandled>>>
  93:        0x11c9b16bd - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::eval_to_valtree, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
  94:        0x11ca69b71 - <rustc_query_impl[44c1f9c305efea75]::Queries as rustc_middle[b315a0ebd84f913d]::ty::query::QueryEngine>::eval_to_valtree
  95:        0x11d8ea447 - <rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  96:        0x11d8e9461 - <rustc_middle[b315a0ebd84f913d]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  97:        0x11d55c655 - <rustc_middle[b315a0ebd84f913d]::ty::consts::Const>::eval
  98:        0x11d568d85 - <rustc_trait_selection[e9a02f98259a9cc7]::traits::project::AssocTypeNormalizer as rustc_middle[b315a0ebd84f913d]::ty::fold::TypeFolder>::fold_const
  99:        0x11d669469 - <rustc_middle[b315a0ebd84f913d]::ty::Ty as rustc_middle[b315a0ebd84f913d]::ty::fold::TypeSuperFoldable>::super_fold_with::<rustc_trait_selection[e9a02f98259a9cc7]::traits::project::AssocTypeNormalizer>
 100:        0x11bbbfa4e - <rustc_trait_selection[e9a02f98259a9cc7]::traits::project::AssocTypeNormalizer>::fold::<rustc_middle[b315a0ebd84f913d]::ty::Ty>
 101:        0x11bbc686c - rustc_trait_selection[e9a02f98259a9cc7]::traits::project::normalize::<rustc_middle[b315a0ebd84f913d]::ty::Ty>
 102:        0x11bb5a3e3 - <rustc_trait_selection[e9a02f98259a9cc7]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[b315a0ebd84f913d]::ty::Ty>
 103:        0x11bbe0410 - rustc_hir_analysis[ad14f4770cb1b48d]::check::wfcheck::check_type_defn
 104:        0x11bbd8628 - rustc_hir_analysis[ad14f4770cb1b48d]::check::wfcheck::check_well_formed
 105:        0x11c8b6555 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_hir[1f62500b68f0e116]::hir_id::OwnerId, ()>>
 106:        0x11c9b4485 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::check_well_formed, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
 107:        0x11bade11b - rustc_data_structures[d9a04b93d3448b55]::sync::par_for_each_in::<&[rustc_hir[1f62500b68f0e116]::hir::ItemId], <rustc_middle[b315a0ebd84f913d]::hir::ModuleItems>::par_items<rustc_hir_analysis[ad14f4770cb1b48d]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
 108:        0x11bbe5441 - rustc_hir_analysis[ad14f4770cb1b48d]::check::wfcheck::check_mod_type_wf
 109:        0x11c8c9e45 - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<rustc_span[48482e0f8f724117]::def_id::LocalDefId, ()>>
 110:        0x11c9b4365 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::check_mod_type_wf, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
 111:        0x11bade21b - rustc_data_structures[d9a04b93d3448b55]::sync::par_for_each_in::<&[rustc_hir[1f62500b68f0e116]::hir_id::OwnerId], <rustc_middle[b315a0ebd84f913d]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[ad14f4770cb1b48d]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
 112:        0x11bb472d0 - <rustc_session[ae5bb785c2cd4c22]::session::Session>::track_errors::<rustc_hir_analysis[ad14f4770cb1b48d]::check_crate::{closure#5}, ()>
 113:        0x11baf0b92 - rustc_hir_analysis[ad14f4770cb1b48d]::check_crate
 114:        0x11919e84a - rustc_interface[a0d981abc9377f30]::passes::analysis
 115:        0x11c947b5c - rustc_query_system[69ea88315c8057f7]::query::plumbing::try_execute_query::<rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt, rustc_query_system[69ea88315c8057f7]::query::caches::DefaultCache<(), core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>>
 116:        0x11c9c1f19 - rustc_query_system[69ea88315c8057f7]::query::plumbing::get_query::<rustc_query_impl[44c1f9c305efea75]::queries::analysis, rustc_query_impl[44c1f9c305efea75]::plumbing::QueryCtxt>
 117:        0x1190737e6 - <rustc_interface[a0d981abc9377f30]::passes::QueryContext>::enter::<rustc_driver[77a613ab63d15aac]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>
 118:        0x1190b7f5d - rustc_span[48482e0f8f724117]::with_source_map::<core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>, rustc_interface[a0d981abc9377f30]::interface::run_compiler<core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>, rustc_driver[77a613ab63d15aac]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
 119:        0x1190a7a7c - <scoped_tls[46b3c18c0a12f0bc]::ScopedKey<rustc_span[48482e0f8f724117]::SessionGlobals>>::set::<rustc_interface[a0d981abc9377f30]::interface::run_compiler<core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>, rustc_driver[77a613ab63d15aac]::run_compiler::{closure#1}>::{closure#0}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>
 120:        0x1190773ca - std[11391ffec397fd56]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a0d981abc9377f30]::util::run_in_thread_pool_with_globals<rustc_interface[a0d981abc9377f30]::interface::run_compiler<core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>, rustc_driver[77a613ab63d15aac]::run_compiler::{closure#1}>::{closure#0}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>
 121:        0x11905d4cb - <<std[11391ffec397fd56]::thread::Builder>::spawn_unchecked_<rustc_interface[a0d981abc9377f30]::util::run_in_thread_pool_with_globals<rustc_interface[a0d981abc9377f30]::interface::run_compiler<core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>, rustc_driver[77a613ab63d15aac]::run_compiler::{closure#1}>::{closure#0}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[cfd2f0869b685cd6]::result::Result<(), rustc_errors[ec87cacb996b1da1]::ErrorGuaranteed>>::{closure#1} as core[cfd2f0869b685cd6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 122:        0x10e5071f7 - std::sys::unix::thread::Thread::new::thread_start::ha121f0b94f5d418a
 123:     0x7ff814d514e1 - __pthread_start

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.67.0-nightly (7eef946fc 2022-11-06) running on x86_64-apple-darwin

query stack during panic:
#0 [mir_built] building MIR for `N`
#1 [unsafety_check_result] unsafety-checking `N`
#2 [mir_const] preparing `N` for borrow checking
#3 [mir_const_qualif] const checking `N`
#4 [mir_promoted] processing MIR for `N`
#5 [mir_borrowck] borrow-checking `N`
#6 [mir_drops_elaborated_and_const_checked] elaborating drops for `N`
#7 [mir_for_ctfe] caching mir of `N` for CTFE
#8 [eval_to_allocation_raw] const-evaluating + checking `N`
#9 [eval_to_allocation_raw] const-evaluating + checking `S::x::{constant#0}`
#10 [eval_to_allocation_raw] const-evaluating + checking `S::x::{constant#0}`
#11 [eval_to_valtree] evaluating type-level constant
#12 [check_well_formed] checking that `S` is well-formed
#13 [check_mod_type_wf] checking that types are well-formed in top-level module
#14 [analysis] running analysis passes on this crate
end of query stack

Regression

Regression in nightly-2021-08-17, maybe from #80357

Version

rustc 1.67.0-nightly (7eef946fc 2022-11-06)
binary: rustc
commit-hash: 7eef946fc0e0eff40e588eab77b09b287accbec3
commit-date: 2022-11-06
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4
@jruderman jruderman added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 8, 2022
@Noratrieb
Copy link
Member

Noratrieb commented Nov 9, 2022

We should not be building MIR for code that is broken like this. No surprise that MIR building can't handle it, it shouldn't.

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 21, 2022
@matthewjasper matthewjasper self-assigned this Aug 25, 2023
@matthewjasper matthewjasper added the F-let_chains `#![feature(let_chains)]` label Sep 11, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 14, 2023
…-naber

Improve invalid let expression handling

- Move all of the checks for valid let expression positions to parsing.
- Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location.
- Suppress some later errors and MIR construction for invalid let expressions.
- Fix a (drop) scope issue that was also responsible for rust-lang#104172.

Fixes rust-lang#104172
Fixes rust-lang#104868
@bors bors closed this as completed in dac91a8 Sep 14, 2023
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 25, 2023
…-naber

Improve invalid let expression handling

- Move all of the checks for valid let expression positions to parsing.
- Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location.
- Suppress some later errors and MIR construction for invalid let expressions.
- Fix a (drop) scope issue that was also responsible for rust-lang#104172.

Fixes rust-lang#104172
Fixes rust-lang#104868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-let_chains `#![feature(let_chains)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants