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: this MPlaceTy must come from try_as_mplace being used on a zst #77320

Closed
chengniansun opened this issue Sep 29, 2020 · 4 comments · Fixed by #77360
Closed

ICE: this MPlaceTy must come from try_as_mplace being used on a zst #77320

chengniansun opened this issue Sep 29, 2020 · 4 comments · Fixed by #77360
Assignees
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-patterns Relating to patterns and pattern matching C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

Code

const FOO: isize = 10;
const ZST: &() = std::mem::transmute(FOO);
fn main() {
    match &() {
        ZST => 9,
    };
}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (7f7a1cbfd 2020-09-27)
binary: rustc
commit-hash: 7f7a1cbfd3b55daee191247770627afab09eece2
commit-date: 2020-09-27
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

Error output

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `10`,
 right: `1`: this MPlaceTy must come from `try_as_mplace` being used on a zst, so we know what
                 value this integer address must have', compiler/rustc_mir/src/const_eval/eval_queries.rs:150:13
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 (7f7a1cbfd 2020-09-27) running on x86_64-unknown-linux-gnu
Backtrace

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `10`,
 right: `1`: this MPlaceTy must come from `try_as_mplace` being used on a zst, so we know what
                 value this integer address must have', compiler/rustc_mir/src/const_eval/eval_queries.rs:150:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:483
   1: std::panicking::begin_panic_fmt
             at /rustc/7f7a1cbfd3b55daee191247770627afab09eece2/library/std/src/panicking.rs:437
   2: rustc_mir::const_eval::eval_queries::op_to_const::{{closure}}
   3: rustc_mir::const_eval::eval_queries::op_to_const
   4: core::ops::function::FnOnce::call_once
   5: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::deref_const>::compute
   6: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
   7: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
   8: rustc_query_system::query::plumbing::get_query_impl
   9: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::recur
  10: rustc_infer::infer::InferCtxtBuilder::enter
  11: rustc_mir_build::thir::pattern::PatCtxt::lower_path
  12: rustc_mir_build::thir::pattern::PatCtxt::lower_pattern
  13: rustc_mir_build::thir::pattern::check_match::MatchVisitor::lower_pattern
  14: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  15: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  16: rustc_hir::intravisit::walk_expr
  17: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  18: rustc_mir_build::thir::pattern::check_match::check_match
  19: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_match>::compute
  20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_query_system::query::plumbing::get_query_impl
  23: rustc_query_system::query::plumbing::ensure_query_impl
  24: rustc_session::utils::<impl rustc_session::session::Session>::time
  25: rustc_interface::passes::analysis
  26: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  27: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  28: rustc_data_structures::stack::ensure_sufficient_stack
  29: rustc_query_system::query::plumbing::get_query_impl
  30: rustc_interface::passes::QueryContext::enter
  31: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  32: rustc_span::with_source_map
  33: rustc_interface::interface::create_compiler_and_run
  34: 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 (7f7a1cbfd 2020-09-27) running on x86_64-unknown-linux-gnu

query stack during panic:

NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses

@chengniansun chengniansun 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 29, 2020
@jyn514 jyn514 added A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Sep 29, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 29, 2020
@jyn514
Copy link
Member

jyn514 commented Sep 29, 2020

playground

@jyn514 jyn514 added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Sep 29, 2020
@camelid
Copy link
Member

camelid commented Sep 29, 2020

Assigning P-medium and removing I-prioritize as discussed as part of the prioritization working group procedure.

@camelid camelid added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 29, 2020
@camelid
Copy link
Member

camelid commented Sep 29, 2020

searched nightlies: from nightly-2020-09-16 to nightly-2020-09-29
regressed nightly: nightly-2020-09-27
searched commits: from 043f6d7 to 623fb90
regressed commit: fd15e61

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-apple-darwin
Reproduce with:

cargo bisect-rustc --regress=ice --start=2020-09-16 

@camelid
Copy link
Member

camelid commented Sep 29, 2020

Cc @oli-obk

@camelid camelid added A-patterns Relating to patterns and pattern matching and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Sep 29, 2020
@jyn514 jyn514 changed the title ICE: thread 'rustc' panicked at 'assertion failed: (left == right) ICE: this MPlaceTy must come from try_as_mplace being used on a zst Sep 29, 2020
@oli-obk oli-obk self-assigned this Sep 29, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Sep 30, 2020
@bors bors closed this as completed in cc1513b Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-patterns Relating to patterns and pattern matching C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

6 participants