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: could not fully normalize `&<MyType as std::ops::Index<MyType>>::Output #88421

Closed
ABouttefeux opened this issue Aug 28, 2021 · 2 comments · Fixed by #122895
Closed

ICE: could not fully normalize `&<MyType as std::ops::Index<MyType>>::Output #88421

ABouttefeux opened this issue Aug 28, 2021 · 2 comments · Fixed by #122895
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been 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.

Comments

@ABouttefeux
Copy link
Contributor

Code

repo github
Sorry I did not found a minimal code yet, I will try a bit more to find one

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (ac50a5335 2021-08-27)
binary: rustc
commit-hash: ac50a53359328a5d7f2f558833e63d59d372e4f7
commit-date: 2021-08-27
host: x86_64-pc-windows-msvc
release: 1.56.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler\rustc_traits\src\normalize_erasing_regions.rs:54:32: could not fully normalize `&<sudoku::grid::Sudoku<SQUARE_SIZE> as std::ops::Index<sudoku::grid::CellPosition<SQUARE_SIZE>>>::Output`
Backtrace


thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1147:9
stack backtrace:
   0:     0x7ff8f7f97ebe - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6b00b2712108694c
   1:     0x7ff8f7fc270a - core::fmt::write::h7e004fee938dc3bd
   2:     0x7ff8f7f8b388 - <std::io::IoSlice as core::fmt::Debug>::fmt::h54e140a5fa3c615c
   3:     0x7ff8f7f9b956 - std::panicking::take_hook::h58e16e4f2d86f1bc
   4:     0x7ff8f7f9b468 - std::panicking::take_hook::h58e16e4f2d86f1bc
   5:     0x7ff8f1288e35 - <tracing_subscriber::fmt::format::json::WriteAdaptor as std::io::Write>::flush::h9f2e1b987cafdd4f
   6:     0x7ff8f7f9c250 - std::panicking::rust_panic_with_hook::h9229e1b31882af1c
   7:     0x7ff8f586ae60 - <rustc_errors::styled_buffer::StyledChar as core::fmt::Debug>::fmt::h94c8a259f157b41b
   8:     0x7ff8f586ade9 - <rustc_errors::styled_buffer::StyledChar as core::fmt::Debug>::fmt::h94c8a259f157b41b
   9:     0x7ff8f5b349d1 - rustc_query_system::query::job::report_cycle::hc18b9b1edf140a65
  10:     0x7ff8f5898c10 - <rustc_errors::json::Diagnostic::from_errors_diagnostic::BufWriter as std::io::Write>::flush::hd123965c617bf938
  11:     0x7ff8f58a0cc5 - rustc_errors::HandlerInner::emit_diagnostic::h793e03cee5f71ce6
  12:     0x7ff8f589e772 - rustc_errors::Handler::bug::h4ae88d4a87e0a336
  13:     0x7ff8f5753c87 - rustc_middle::traits::select::EvaluationResult::is_stack_dependent::h0844dc638e85f719
  14:     0x7ff8f57536f0 - rustc_middle::traits::select::EvaluationResult::is_stack_dependent::h0844dc638e85f719
  15:     0x7ff8f5753698 - rustc_middle::traits::select::EvaluationResult::is_stack_dependent::h0844dc638e85f719
  16:     0x7ff8f5753bb9 - rustc_middle::traits::select::EvaluationResult::is_stack_dependent::h0844dc638e85f719
  17:     0x7ff8f5b31787 - rustc_middle::util::bug::bug_fmt::hf202c2d3ce8ef8a0
  18:     0x7ff8f44baa74 - <&chalk_ir::GenericArg<rustc_middle::traits::chalk::RustInterner> as rustc_traits::chalk::lowering::LowerInto<rustc_middle::ty::subst::GenericArg>>::lower_into::hc2ebc8226c9618cd
  19:     0x7ff8f4599c83 - <rustc_traits::chalk::db::RustIrDatabase as chalk_ir::UnificationDatabase<rustc_middle::traits::chalk::RustInterner>>::adt_variance::hf616762a148fb70e
  20:     0x7ff8f49e61df - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h84310f1d53aae64b
  21:     0x7ff8f4997823 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h84310f1d53aae64b
  22:     0x7ff8f4ab194f - rustc_query_impl::on_disk_cache::__ty_decoder_impl::<impl rustc_serialize::serialize::Decoder for rustc_query_impl::on_disk_cache::CacheDecoder>::error::h23d06995eb6cfeec
  23:     0x7ff8f4678366 - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h467ffd2e0734ab57
  24:     0x7ff8f4a3e67b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h19da6eec48ba9884
  25:     0x7ff8f5651091 - rustc_middle::ty::flags::FlagComputation::for_unevaluated_const::hc73a3b6d731bff72
  26:     0x7ff8f5612f1e - rustc_middle::ty::util::needs_drop_components::hebe752db6906a070
  27:     0x7ff8f55be684 - rustc_middle::ty::inhabitedness::<impl rustc_middle::ty::context::TyCtxt>::is_ty_uninhabited_from::h3b5342db4c7fe350
  28:     0x7ff8f56b928c - rustc_middle::ty::layout::<impl rustc_middle::ty::instance::Instance>::fn_sig_for_fn_abi::h81cb02eac6bf2c1f
  29:     0x7ff8f157ec8e - <rustc_codegen_llvm::builder::Builder as rustc_codegen_ssa::traits::builder::BuilderMethods>::unchecked_umul::h94bfdb69f0bb5214
  30:     0x7ff8f154b2cb - rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn::h18036dc992cd6855
  31:     0x7ff8f15632df - <rustc_codegen_llvm::base::ValueIter as core::iter::traits::iterator::Iterator>::next::hfabb5c09af5de8b3
  32:     0x7ff8f14d4f8e - <rustc_codegen_llvm::llvm_::archive_ro::Child as core::ops::drop::Drop>::drop::hdd17f77e5db02b01
  33:     0x7ff8f152dc66 - <rustc_codegen_llvm::back::lto::ThinLTOKeysMap as core::fmt::Debug>::fmt::h0c51d478f12fbf1b
  34:     0x7ff8f1562bd9 - <rustc_codegen_llvm::base::ValueIter as core::iter::traits::iterator::Iterator>::next::hfabb5c09af5de8b3
  35:     0x7ff8f150368e - <rustc_codegen_llvm::builder::Builder as core::ops::drop::Drop>::drop::h0ff57be597133e74
  36:     0x7ff8f154d9bb - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::hc453fef2a1a5be0a
  37:     0x7ff8f13d1d56 - rustc_interface::queries::Queries::ongoing_codegen::h6eaba3ff4becc117
  38:     0x7ff8f12ddac8 - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::hc7ceaa6abc25db7f
  39:     0x7ff8f12a8275 - rustc_driver::pretty::print_after_hir_lowering::h305824134be04e10
  40:     0x7ff8f12dfa07 - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::hc7ceaa6abc25db7f
  41:     0x7ff8f12b2f50 - <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt::hc7ceaa6abc25db7f
  42:     0x7ff8f12adda8 - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::h17e85dfc411e4143
  43:     0x7ff8f129da0d - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h580e7f1b5da2df06
  44:     0x7ff8f7faa47c - std::sys::windows::thread::Thread::new::h4f56ff2d056f7249
  45:     0x7ff992cd7034 - BaseThreadInitThunk
  46:     0x7ff9948a2651 - RtlUserThreadStart

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.56.0-nightly (ac50a5335 2021-08-27) running on x86_64-pc-windows-msvc

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

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

query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `&<sudoku::grid::Sudoku<SQUARE_SIZE> as std::ops::Index<sudoku::grid::CellPosition<SQUARE_SIZE>>>::Output`
end of query stack
error: could not compile `sudoku`

@ABouttefeux ABouttefeux 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 Aug 28, 2021
@hellow554
Copy link
Contributor

hellow554 commented Aug 30, 2021

Needs an external crate for it to work! In this case I use a lib.rs and main.rs in the same project. cargo build is also needed.

main.rs:

fn main() {
    ext::Sudoku::<3>::random();
}

lib.rs:

#![feature(const_generics)]
#![feature(const_evaluatable_checked)]

use std::ops::Index;

pub struct CellPossibilities;

pub enum CellState<const SQUARE_SIZE: usize> {
    Empty(Option<CellPossibilities>),
}

pub struct Sudoku<const SQUARE_SIZE: usize>;

impl<const SQUARE_SIZE: usize> Sudoku<SQUARE_SIZE>where
    [CellState<SQUARE_SIZE>; SQUARE_SIZE * SQUARE_SIZE]: Sized,
{
    pub fn random() {
        let CellState::Empty(_) = Self[()];
    }
}

impl<const SQUARE_SIZE: usize> Index<()> for Sudoku<SQUARE_SIZE>
where
    [CellState<SQUARE_SIZE>; SQUARE_SIZE * SQUARE_SIZE]: Sized,
{
    type Output = CellState<SQUARE_SIZE>;

    fn index(&self, _: ()) -> &Self::Output {
        todo!()
    }
}

Regression in nightly-2020-09-25 8b40853...e599b53

@jackh726
Copy link
Member

jackh726 commented Aug 5, 2023

Works fine in latest nightly.

@jackh726 jackh726 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 5, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 22, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 23, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 24, 2024
@bors bors closed this as completed in f44ee8f Mar 24, 2024
RenjiSann pushed a commit to RenjiSann/rust that referenced this issue Mar 25, 2024
RenjiSann pushed a commit to RenjiSann/rust that referenced this issue Mar 25, 2024
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants