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 const generics. #83288

Closed
krsnik02 opened this issue Mar 19, 2021 · 2 comments · Fixed by #90023
Closed

ICE with const generics. #83288

krsnik02 opened this issue Mar 19, 2021 · 2 comments · Fixed by #90023
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@krsnik02
Copy link

Code

#![allow(incomplete_features)]
#![feature(const_generics, const_evaluatable_checked)]

use std::{marker::PhantomData, ops::Mul};

pub enum Nil {}
pub struct Cons<T, L> {
    _phantom: PhantomData<(T, L)>,
}

pub trait Indices<const N: usize> {
    const RANK: usize;
    const NUM_ELEMS: usize;
}

impl<const N: usize> Indices<N> for Nil {
    const RANK: usize = 0;
    const NUM_ELEMS: usize = 1;
}

impl<T, I: Indices<N>, const N: usize> Indices<N> for Cons<T, I> {
    const RANK: usize = I::RANK + 1;
    const NUM_ELEMS: usize = I::NUM_ELEMS * N;
}

pub trait Concat<J> {
    type Output;
}

impl<J> Concat<J> for Nil {
    type Output = J;
}

impl<T, I, J> Concat<J> for Cons<T, I>
where
    I: Concat<J>,
{
    type Output = Cons<T, <I as Concat<J>>::Output>;
}

pub struct Tensor<I: Indices<N>, const N: usize>
where
    [u8; I::NUM_ELEMS]: Sized,
{
    pub data: [u8; I::NUM_ELEMS],
    _phantom: PhantomData<I>,
}

impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N>
where
    I: Concat<J>,
    <I as Concat<J>>::Output: Indices<N>,
    [u8; I::NUM_ELEMS]: Sized,
    [u8; J::NUM_ELEMS]: Sized,
    [u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
{
    type Output = Tensor<<I as Concat<J>>::Output, N>;

    fn mul(self, rhs: Tensor<J, N>) -> Self::Output {
        Tensor {
            data: [0u8; <I as Concat<J>>::Output::NUM_ELEMS],
            _phantom: PhantomData,
        }
    }
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (1705a7d64 2021-03-18)
binary: rustc
commit-hash: 1705a7d64b833d1c4b69958b0627bd054e6d764b
commit-date: 2021-03-18
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

error: internal compiler error: compiler\rustc_infer\src\infer\freshen.rs:247:17: unexpected const Const { ty: usize, val: Bound(DebruijnIndex(0), 1) }

thread 'rustc' panicked at 'Box<Any>', /rustc/1705a7d64b833d1c4b69958b0627bd054e6d764b\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 (1705a7d64 2021-03-18) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
thread 'rustc' panicked at 'substs of instance DefId(0:18 ~ error_minimal[71ac]::Indices::NUM_ELEMS) not normalized for codegen: [^0, Const { ty: usize, val: Bound(DebruijnIndex(0), 1) }]', compiler\rustc_middle\src\ty\instance.rs:284:9
stack backtrace:
   0:     0x7fffec1381fe - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h62553bb33d269d2e
   1:     0x7fffec1634cc - core::fmt::write::h187a24ff0c56237d
   2:     0x7fffec12bc58 - <std::io::IoSlice as core::fmt::Debug>::fmt::h7a51133a1941366b
   3:     0x7fffec13c3fd - std::panicking::take_hook::ha7af702674468c4c
   4:     0x7fffec13bec9 - std::panicking::take_hook::ha7af702674468c4c
   5:     0x7fffc0c8dd87 - rustc_driver::report_ice::hf10dc2c8fa4042ab
   6:     0x7fffec13cc55 - std::panicking::rust_panic_with_hook::hffdabf0e02906eb3
   7:     0x7fffec13c7c1 - rust_begin_unwind
   8:     0x7fffec138b1f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h62553bb33d269d2e
   9:     0x7fffec13c719 - rust_begin_unwind
  10:     0x7fffec194fdc - std::panicking::begin_panic_fmt::h5f113f8f74763d19
  11:     0x7fffc4be94ef - rustc_middle::ty::instance::Instance::new::hc3cef614036b2c39
  12:     0x7fffc398ed38 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  13:     0x7fffc39bf0ea - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  14:     0x7fffc3abc14d - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  15:     0x7fffc3aa161f - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  16:     0x7fffc384b604 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  17:     0x7fffc397e2e0 - rustc_query_impl::Queries::new::h5ac540c8d5d50c7d
  18:     0x7fffc38ab8de - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  19:     0x7fffc0e79cca - rustc_interface::interface::try_print_query_stack::hbf6433552c26b342
  20:     0x7fffc0c8e75a - rustc_driver::report_ice::hf10dc2c8fa4042ab
  21:     0x7fffec13cc55 - std::panicking::rust_panic_with_hook::hffdabf0e02906eb3
  22:     0x7fffc4dc16e0 - <rustc_errors::snippet::Style as core::fmt::Debug>::fmt::h4ab63545b00d3235
  23:     0x7fffc4dc1689 - <rustc_errors::snippet::Style as core::fmt::Debug>::fmt::h4ab63545b00d3235
  24:     0x7fffc506e751 - rustc_query_system::query::job::report_cycle::h78ff372fa02cb0ad
  25:     0x7fffc4db0710 - <rustc_feature::builtin_attrs::AttributeType as core::fmt::Debug>::fmt::h4d81e9bb6564882a
  26:     0x7fffc4db7245 - rustc_errors::HandlerInner::err_count::h836eba26b76f283e
  27:     0x7fffc4db4de2 - rustc_errors::Handler::bug::h64fb55725578e531
  28:     0x7fffc4c90758 - <<rustc_middle::mir::query::GeneratorLayout as core::fmt::Debug>::fmt::GenVariantPrinter as core::fmt::Debug>::fmt::h4d26f75eae0c6dce
  29:     0x7fffc4c8b0f0 - <<rustc_middle::mir::query::GeneratorLayout as core::fmt::Debug>::fmt::GenVariantPrinter as core::fmt::Debug>::fmt::h4d26f75eae0c6dce
  30:     0x7fffc4c8b098 - <<rustc_middle::mir::query::GeneratorLayout as core::fmt::Debug>::fmt::GenVariantPrinter as core::fmt::Debug>::fmt::h4d26f75eae0c6dce
  31:     0x7fffc4c90689 - <<rustc_middle::mir::query::GeneratorLayout as core::fmt::Debug>::fmt::GenVariantPrinter as core::fmt::Debug>::fmt::h4d26f75eae0c6dce
  32:     0x7fffc5068c87 - rustc_middle::util::bug::bug_fmt::hf44d9914e298ce88
  33:     0x7fffc4a6c5df - <rustc_infer::infer::freshen::TypeFreshener as rustc_middle::ty::fold::TypeFolder>::fold_const::h70d4da4bb2ed7cff
  34:     0x7fffc488a9ac - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::outlives_bounds::InferCtxtExt>::implied_outlives_bounds::h0691bd3491f937ef
  35:     0x7fffc48e9aef - rustc_trait_selection::traits::select::SelectionContext::select::h6b9a2f2d2cbbd0ad
  36:     0x7fffc4843a5c - unicode_normalization::__test_api::stream_safe::hec73581812109e2f
  37:     0x7fffc48c58dc - rustc_trait_selection::traits::codegen::codegen_fulfill_obligation::h0d96f7a6392f349b
  38:     0x7fffc3869115 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  39:     0x7fffc3a59db1 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
  40:     0x7fffc39e733c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  41:     0x7fffc3ac7a06 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  42:     0x7fffc3810644 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  43:     0x7fffc3752e53 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  44:     0x7fffc39850ff - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  45:     0x7fffc2f75d8f - rustc_ty_utils::instance::provide::h91ad6dda14455b8a
  46:     0x7fffc2f7488a - rustc_ty_utils::instance::provide::h91ad6dda14455b8a
  47:     0x7fffc386cad2 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  48:     0x7fffc3a59db1 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
  49:     0x7fffc39ecf64 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  50:     0x7fffc3ac5d19 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  51:     0x7fffc381e3e7 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  52:     0x7fffc372972a - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  53:     0x7fffc398aa9b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  54:     0x7fffc4bf91a5 - rustc_middle::ty::instance::Instance::resolve_opt_const_arg::h2fbedb89e5a40f5c
  55:     0x7fffc4b41f5d - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::ha35c09a1b9fc26e8
  56:     0x7fffc48912d9 - <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::h2dbd9eee120ca947
  57:     0x7fffc3007f49 - <&chalk_ir::GenericArg<rustc_middle::traits::chalk::RustInterner> as rustc_traits::chalk::lowering::LowerInto<rustc_middle::ty::subst::GenericArg>>::lower_into::h5e5650c88d8a441f
  58:     0x7fffc2ff49de - <&chalk_ir::GenericArg<rustc_middle::traits::chalk::RustInterner> as rustc_traits::chalk::lowering::LowerInto<rustc_middle::ty::subst::GenericArg>>::lower_into::h5e5650c88d8a441f
  59:     0x7fffc3014041 - <&chalk_ir::GenericArg<rustc_middle::traits::chalk::RustInterner> as rustc_traits::chalk::lowering::LowerInto<rustc_middle::ty::subst::GenericArg>>::lower_into::h5e5650c88d8a441f
  60:     0x7fffc3a5f0f2 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
  61:     0x7fffc3a04329 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  62:     0x7fffc3aec74c - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  63:     0x7fffc3810da5 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  64:     0x7fffc377fae6 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  65:     0x7fffc39898ae - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  66:     0x7fffc4be3334 - <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_const::h2e1cc4fdbf5f546f
  67:     0x7fffc3f82f6b - <rustc_mir::transform::dest_prop::CandidateAssignment as core::fmt::Debug>::fmt::hcd44057c79686343
  68:     0x7fffc3edff19 - rustc_mir::interpret::eval_context::mir_assign_valid_types::heb0415135c8d8910
  69:     0x7fffc3cbb8f4 - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::hd3896ab4362499cf
  70:     0x7fffc3868073 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  71:     0x7fffc3a5e8c9 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
  72:     0x7fffc39ee6c5 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  73:     0x7fffc3ae7828 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  74:     0x7fffc37ec052 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  75:     0x7fffc37a7c6b - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  76:     0x7fffc398370b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  77:     0x7fffc3cb9ac7 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h9ba80fa852bd7017
  78:     0x7fffc38680c3 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  79:     0x7fffc3a5e8c9 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
  80:     0x7fffc39e1071 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  81:     0x7fffc3ad5928 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
  82:     0x7fffc37fdc7f - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  83:     0x7fffc3721b36 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  84:     0x7fffc398384b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
  85:     0x7fffc4b14145 - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::h519a17aa44786a0b
  86:     0x7fffc4b41fbb - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::ha35c09a1b9fc26e8
  87:     0x7fffc49d3722 - rustc_infer::infer::InferCtxt::const_eval_resolve::h7838daedbf188b80
  88:     0x7fffc4913e4b - <rustc_trait_selection::traits::query::type_op::implied_outlives_bounds::ImpliedOutlivesBounds as core::fmt::Debug>::fmt::h4ebed88350c915bc
  89:     0x7fffc48ea09e - rustc_trait_selection::traits::select::SelectionContext::select::h6b9a2f2d2cbbd0ad
  90:     0x7fffc48d9963 - rustc_trait_selection::traits::select::SelectionContext::evaluate_root_obligation::h3ab8c20ee9b0762d
  91:     0x7fffc4851542 - unicode_normalization::__test_api::stream_safe::hec73581812109e2f
  92:     0x7fffc48d7f49 - <rustc_trait_selection::traits::TraitQueryMode as core::fmt::Debug>::fmt::h06becf8f1acbff30
  93:     0x7fffc48d5a1b - <rustc_trait_selection::traits::TraitQueryMode as core::fmt::Debug>::fmt::h06becf8f1acbff30
  94:     0x7fffc48b7268 - <rustc_trait_selection::traits::structural_match::NonStructuralMatchTy as core::fmt::Debug>::fmt::hc989979773fb9e44
  95:     0x7fffc48fbbf7 - <rustc_trait_selection::traits::select::ProvisionalEvaluation as core::fmt::Debug>::fmt::h913e1987ab901c59
  96:     0x7fffc48dfa69 - <rustc_trait_selection::traits::select::TraitObligationStack as core::fmt::Debug>::fmt::hdd71438164bf3d0e
  97:     0x7fffc48e9b3b - rustc_trait_selection::traits::select::SelectionContext::select::h6b9a2f2d2cbbd0ad
  98:     0x7fffc4891741 - <rustc_trait_selection::traits::fulfill::PendingPredicateObligation as core::fmt::Debug>::fmt::h9f4e701b86dd4ab5
  99:     0x7fffc488fc32 - rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations::he26b786ab43b4c32
 100:     0x7fffc48b7d4a - <rustc_trait_selection::traits::structural_match::NonStructuralMatchTy as core::fmt::Debug>::fmt::hc989979773fb9e44
 101:     0x7fffc488ed1c - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible::hfc985bcc52011be6
 102:     0x7fffc32dc9cf - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::resolve_vars_with_obligations::h47c1103350ccd067
 103:     0x7fffc32cc878 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h807e0fa5bb42956a
 104:     0x7fffc32c9caf - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h807e0fa5bb42956a
 105:     0x7fffc32ed6d9 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_no_value::h018b701bc4fa5ea5
 106:     0x7fffc32c9caf - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h807e0fa5bb42956a
 107:     0x7fffc32d6f04 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h807e0fa5bb42956a
 108:     0x7fffc34bc981 - rustc_typeck::check::check::check_wf_new::h22f4726fa1485181
 109:     0x7fffc343ba08 - <rustc_typeck::astconv::ConvertedBindingKind as core::fmt::Debug>::fmt::h2a7010a4ff5b2e0c
 110:     0x7fffc349ab81 - <rustc_typeck::check::fixup_opaque_types::FixupFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty::h78d3acd8dc861f09
 111:     0x7fffc3a59239 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
 112:     0x7fffc39e2e59 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 113:     0x7fffc3ad16d8 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
 114:     0x7fffc38175ca - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 115:     0x7fffc3747d18 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 116:     0x7fffc3982d02 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 117:     0x7fffc33acc1b - <rustc_typeck::bounds::Bounds as core::fmt::Debug>::fmt::hf626ecdc20bf1ae1
 118:     0x7fffc34a19d3 - <rustc_typeck::check::CheckItemTypesVisitor as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h6f609dad89ba15c2
 119:     0x7fffc3a590b9 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
 120:     0x7fffc39e822f - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 121:     0x7fffc3ae31da - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
 122:     0x7fffc380d13b - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 123:     0x7fffc3761a2b - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 124:     0x7fffc3982c42 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 125:     0x7fffc33adfe9 - <rustc_typeck::bounds::Bounds as core::fmt::Debug>::fmt::hf626ecdc20bf1ae1
 126:     0x7fffc33d85f7 - rustc_typeck::check_crate::h590ac54a0ff66e8b
 127:     0x7fffc0de5e1e - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h56a035dfcc96ba3e
 128:     0x7fffc3a5afc9 - <rustc_middle::mir::interpret::GlobalId as rustc_query_impl::keys::Key>::default_span::ha2db6bdf82aefc30
 129:     0x7fffc39e45d6 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 130:     0x7fffc3adfff7 - <rustc_middle::ty::adt::AdtSizedConstraint as rustc_query_impl::values::Value>::from_cycle_error::hed12d773cab654cb
 131:     0x7fffc380ebfa - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 132:     0x7fffc378262e - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
 133:     0x7fffc397ec52 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::h61e7dd19d3d37c47
 134:     0x7fffc0cfb5c9 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h9b0a6d32e855aaf2
 135:     0x7fffc0ca6eeb - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::h212ff9ef21bfb491
 136:     0x7fffc0c904ec - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h6a63f46718527831
 137:     0x7fffc0ca8127 - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::h212ff9ef21bfb491
 138:     0x7fffc0c98594 - rustc_driver::pretty::print_after_hir_lowering::hd7a7d74f80bde00c
 139:     0x7fffc0caa07f - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::h212ff9ef21bfb491
 140:     0x7fffc0cc954d - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::h212ff9ef21bfb491
 141:     0x7fffec14bcfa - std::sys::windows::thread::Thread::new::h485ded1a10d2ce17
 142:     0x7ff85b497034 - BaseThreadInitThunk
 143:     0x7ff85cb42651 - RtlUserThreadStart

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.52.0-nightly (1705a7d64 2021-03-18) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `error-minimal`

Caused by:
  process didn't exit successfully: `rustc --crate-name error_minimal --edition=2018 'src\lib.rs' --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=5e1ca44ee68d6aa4 -C extra-filename=-5e1ca44ee68d6aa4 --out-dir 'C:\Users\ghart\error-minimal\target\debug\deps' -C 'incremental=C:\Users\ghart\error-minimal\target\debug\incremental' -L 'dependency=C:\Users\ghart\error-minimal\target\debug\deps'` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)
@krsnik02 krsnik02 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 Mar 19, 2021
@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Mar 19, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Mar 19, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 19, 2021
@TopologicallySpeaking
Copy link

I ran into what I believe is the same issue. For what it's worth, I found this much shorter example:

#![allow(incomplete_features)]
#![feature(const_generics, const_evaluatable_checked)]

struct Foo<'a> {
    _r: &'a u8,
}

trait FooTrait {
    const FOO_LEN: usize;

    fn foo_fun(&self, expr: [u8; Self::FOO_LEN]);
}

impl<'a> FooTrait for Foo<'a> {
    const FOO_LEN: usize = 1;

    fn foo_fun(&self, _expr: [u8; 1]) {
        unimplemented!()
    }
}

@TopologicallySpeaking
Copy link

Unfortunately, the code I provided a few months ago is not the same error. I know that because my code now compiles on nightly, but the code in the original issue does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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