Skip to content

internal compiler error with const_panic #76577

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

Closed
Pat-Lafon opened this issue Sep 10, 2020 · 1 comment
Closed

internal compiler error with const_panic #76577

Pat-Lafon opened this issue Sep 10, 2020 · 1 comment
Labels
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.

Comments

@Pat-Lafon
Copy link

Pat-Lafon commented Sep 10, 2020

All of the below is from https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=3e260fdade759dfa8b326df7cd3487a3

I would have assumed I would get a type error from this?

Code

<code>
#![feature(const_panic)]

fn main() {
    const _: () = panic!(true);
}

Meta

rustc --version --verbose:

<version>
rustc 1.48.0-nightly (e2be5f568 2020-09-09)
binary: rustc
commit-hash: e2be5f568d1f60365b825530f5b5cb722460591b
commit-date: 2020-09-09
host: x86_64-apple-darwin
release: 1.48.0-nightly
LLVM version: 11.0

Error output

<output>
Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at '`ref_to_mplace` called on non-ptr type', compiler/rustc_mir/src/interpret/place.rs:292:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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.48.0-nightly (e2be5f568 2020-09-09) running on x86_64-unknown-linux-gnu

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

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

error: could not compile `playground`

To learn more, run the command again with --verbose.

Backtrace

<backtrace>Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at '`ref_to_mplace` called on non-ptr type', compiler/rustc_mir/src/interpret/place.rs:292:47
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e2be5f568d1f60365b825530f5b5cb722460591b/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/e2be5f568d1f60365b825530f5b5cb722460591b/library/core/src/panicking.rs:85
   2: core::option::expect_failed
             at /rustc/e2be5f568d1f60365b825530f5b5cb722460591b/library/core/src/option.rs:1213
   3: rustc_mir::interpret::place::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::ref_to_mplace
   4: rustc_mir::interpret::place::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::deref_operand
   5: rustc_mir::const_eval::machine::<impl rustc_mir::interpret::eval_context::InterpCx<rustc_mir::const_eval::machine::CompileTimeInterpreter>>::hook_panic_fn
   6: <rustc_mir::const_eval::machine::CompileTimeInterpreter as rustc_mir::interpret::machine::Machine>::find_mir_or_eval_fn
   7: rustc_mir::interpret::terminator::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_fn_call
   8: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::run
   9: rustc_mir::const_eval::eval_queries::const_eval_raw_provider
  10: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_raw>::compute
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  12: rustc_data_structures::stack::ensure_sufficient_stack
  13: rustc_query_system::query::plumbing::get_query_impl
  14: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  15: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::compute
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::get_query_impl
  19: rustc_mir::const_eval::eval_queries::const_eval_validated_provider
  20: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::const_eval_validated>::compute
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::get_query_impl
  24: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  25: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_poly
  26: <rustc_lint::BuiltinCombinedLateLintPass as rustc_lint::passes::LateLintPass>::check_item
  27: rustc_hir::intravisit::Visitor::visit_nested_item
  28: rustc_hir::intravisit::walk_expr
  29: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
  30: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_nested_body
  31: rustc_hir::intravisit::walk_item
  32: rustc_hir::intravisit::Visitor::visit_nested_item
  33: rustc_hir::intravisit::walk_crate
  34: rustc_lint::late::late_lint_crate
  35: rustc_data_structures::sync::join
  36: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  37: rustc_session::utils::<impl rustc_session::session::Session>::time
  38: rustc_interface::passes::analysis
  39: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  41: rustc_data_structures::stack::ensure_sufficient_stack
  42: rustc_query_system::query::plumbing::get_query_impl
  43: rustc_interface::passes::QueryContext::enter
  44: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  45: rustc_span::with_source_map
  46: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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.48.0-nightly (e2be5f568 2020-09-09) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [const_eval_raw] const-evaluating `main::_`
#1 [const_eval_validated] const-evaluating + checking `main::_`
#2 [const_eval_validated] const-evaluating + checking `main::_`
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `playground`

To learn more, run the command again with --verbose.

@Pat-Lafon Pat-Lafon 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 Sep 10, 2020
@jonas-schievink
Copy link
Contributor

Duplicate of #76013

@jonas-schievink jonas-schievink marked this as a duplicate of #76013 Sep 10, 2020
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. 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

No branches or pull requests

2 participants