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 with inline-const in match referencing const-generic parameter #82518

Closed
Nemo157 opened this issue Feb 25, 2021 · 1 comment · Fixed by #88088
Closed

ICE with inline-const in match referencing const-generic parameter #82518

Nemo157 opened this issue Feb 25, 2021 · 1 comment · Fixed by #88088
Assignees
Labels
C-bug Category: This is a bug. F-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Nemo157
Copy link
Member

Nemo157 commented Feb 25, 2021

I tried this code:

#![feature(inline_const)]

fn foo<const V: usize>() {
  match 0 {
    const { V } => {},
    _ => {},
  }
}
error: internal compiler error: /rustc/a8486b64b0c87dabd045453b6c81500015d122d6/compiler/rustc_middle/src/ty/consts.rs:193:32: expected bits of usize, got Const {
    ty: usize,
    val: Param(
        V/#0,
    ),
}

thread 'rustc' panicked at 'Box<Any>', /rustc/a8486b64b0c87dabd045453b6c81500015d122d6/library/std/src/panic.rs:59:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.52.0-nightly (a8486b64b 2021-02-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [mir_built] building MIR for `foo`
#1 [unsafety_check_result] unsafety-checking `foo`
end of query stack
error: aborting due to previous error; 1 warning emitted

error: could not compile `playground`

Meta

Backtrace

thread 'rustc' panicked at 'Box<Any>', /rustc/a8486b64b0c87dabd045453b6c81500015d122d6/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: indexmap::map::core::Entry<K,V>::or_insert_with
   8: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::match_simplified_candidates
   9: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::match_candidates::{{closure}}
  10: rustc_mir_build::build::matches::<impl rustc_mir_build::build::Builder>::lower_match_tree
  11: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  12: rustc_mir_build::build::scope::<impl rustc_mir_build::build::Builder>::in_scope
  13: rustc_data_structures::stack::ensure_sufficient_stack
  14: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  15: rustc_mir_build::build::block::<impl rustc_mir_build::build::Builder>::ast_block_stmts
  16: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  17: rustc_mir_build::build::scope::<impl rustc_mir_build::build::Builder>::in_scope
  18: rustc_data_structures::stack::ensure_sufficient_stack
  19: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  20: rustc_mir_build::build::scope::<impl rustc_mir_build::build::Builder>::in_scope
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_mir_build::build::expr::into::<impl rustc_mir_build::build::Builder>::into_expr
  23: rustc_mir_build::build::construct_fn
  24: rustc_infer::infer::InferCtxtBuilder::enter
  25: rustc_mir_build::build::mir_built
  26: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  27: rustc_data_structures::stack::ensure_sufficient_stack
  28: rustc_query_system::query::plumbing::force_query_with_job
  29: rustc_query_system::query::plumbing::get_query_impl
  30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_built
  31: rustc_mir::transform::check_unsafety::unsafety_check_result
  32: core::ops::function::FnOnce::call_once
  33: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  34: rustc_data_structures::stack::ensure_sufficient_stack
  35: rustc_query_system::query::plumbing::force_query_with_job
  36: rustc_query_system::query::plumbing::get_query_impl
  37: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::unsafety_check_result
  38: rustc_mir::transform::mir_const
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_data_structures::stack::ensure_sufficient_stack
  41: rustc_query_system::query::plumbing::force_query_with_job
  42: rustc_query_system::query::plumbing::get_query_impl
  43: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
  44: rustc_mir::transform::mir_promoted
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_data_structures::stack::ensure_sufficient_stack
  47: rustc_query_system::query::plumbing::force_query_with_job
  48: rustc_query_system::query::plumbing::get_query_impl
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_promoted
  50: rustc_mir::borrow_check::mir_borrowck
  51: core::ops::function::FnOnce::call_once
  52: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  53: rustc_data_structures::stack::ensure_sufficient_stack
  54: rustc_query_system::query::plumbing::force_query_with_job
  55: rustc_query_system::query::plumbing::get_query_impl
  56: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  57: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  58: rustc_interface::passes::analysis
  59: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  60: rustc_data_structures::stack::ensure_sufficient_stack
  61: rustc_query_system::query::plumbing::force_query_with_job
  62: rustc_query_system::query::plumbing::get_query_impl
  63: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  64: rustc_interface::passes::QueryContext::enter
  65: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  66: rustc_span::with_source_map
  67: rustc_interface::interface::create_compiler_and_run
  68: scoped_tls::ScopedKey<T>::set

@Nemo157 Nemo157 added C-bug Category: This is a bug. F-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) requires-nightly This issue requires a nightly compiler in some way. labels Feb 25, 2021
@JohnTitor JohnTitor added 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 Mar 1, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Mar 5, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 6, 2021
@nbdd0121
Copy link
Contributor

@rustbot claim

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-inline_const Inline constants (aka: const blocks, const expressions, anonymous constants) glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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