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: FloatToFloat/FloatToInt cast: source type usize is not a float type #121585

Closed
matthiaskrgr opened this issue Feb 25, 2024 · 1 comment · Fixed by #125451
Closed

ICE: FloatToFloat/FloatToInt cast: source type usize is not a float type #121585

matthiaskrgr opened this issue Feb 25, 2024 · 1 comment · Fixed by #125451
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(generic_const_exprs)]

trait Trait {}

struct HasCastInTraitImpl<const N: usize, const M: u128>;
impl<const O: f64> Trait for HasCastInTraitImpl<O, { O as u128 }> {}

pub fn use_trait_impl() {
    fn assert_impl<T: Trait>() {}

    assert_impl::<HasCastInTraitImpl<13, 13>>();
}

original:

//@ check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

trait Trait {}
pub struct EvaluatableU128<const N: u128>;

struct HasCastInTraitImpl<const N: usize, const M: u128>;
impl<const O: f64> Trait for HasCastInTraitImpl<O, { O as u128 }> {}

pub fn use_trait_impl<const N: usize>() where EvaluatableU128<{N as u128}>:, {
    fn assert_impl<T: Trait>() {}

    assert_impl::<HasCastInTraitImpl<N, { N as u128 }>>();
    assert_impl::<HasCastInTraitImpl<N, { N as _ }>>();
    assert_impl::<HasCastInTraitImpl<12, { 12 as u128 }>>();
    assert_impl::<HasCastInTraitImpl<13, 13>>();
}
pub fn use_trait_impl_2<const N: usize>() where EvaluatableU128<{N as _}>:, {
    fn assert_impl<T: Trait>() {}

    assert_impl::<HasCastInTraitImpl<N, { N as u128 }>>();
    assert_impl::<HasCastInTraitImpl<N, { N as _ }>>();
    assert_impl::<HasCastInTraitImpl<12, { 12 as u128 }>>()const NUM: u8 = xyz();
    assert_impl::<HasCastInTraitImpl<13, 13>>();
}


fn main() {}

Version information

rustc 1.78.0-nightly (2ae1bb671 2024-02-24)
binary: rustc
commit-hash: 2ae1bb671183a072b54ed8ed39abfcd72990a3e7
commit-date: 2024-02-24
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:12:2
   |
12 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs`

error: the constant `O` is not of type `usize`
 --> /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:6:30
  |
6 | impl<const O: f64> Trait for HasCastInTraitImpl<O, { O as u128 }> {}
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `f64`
  |
note: required by a bound in `HasCastInTraitImpl`
 --> /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:5:27
  |
5 | struct HasCastInTraitImpl<const N: usize, const M: u128>;
  |                           ^^^^^^^^^^^^^^ required by this bound in `HasCastInTraitImpl`

error: `f64` is forbidden as the type of a const generic parameter
 --> /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:6:15
  |
6 | impl<const O: f64> Trait for HasCastInTraitImpl<O, { O as u128 }> {}
  |               ^^^
  |
  = note: the only supported types are integers, `bool` and `char`

error: internal compiler error: compiler/rustc_const_eval/src/interpret/cast.rs:190:17: Can't cast 'Float' type into u128

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0:     0x7f325cd8caf6 - std::backtrace_rs::backtrace::libunwind::trace::h78e1beabc241470d
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f325cd8caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::hcf0e3276676937a9
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f325cd8caf6 - std::sys_common::backtrace::_print_fmt::h97e735845ccdd467
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f325cd8caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8e5712cf7013f6fb
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f325cddda7c - core::fmt::rt::Argument::fmt::heb6e69b80afbd30f
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/core/src/fmt/rt.rs:142:9
   5:     0x7f325cddda7c - core::fmt::write::hdc6decd8b058c5bd
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f325cd8142f - std::io::Write::write_fmt::h842bc593311134e9
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/io/mod.rs:1846:15
   7:     0x7f325cd8c8a4 - std::sys_common::backtrace::_print::h943a0b890de28a0e
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f325cd8c8a4 - std::sys_common::backtrace::print::hb82258756379bede
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f325cd8f5eb - std::panicking::default_hook::{{closure}}::h19d49c5a8abcf1fa
  10:     0x7f325cd8f339 - std::panicking::default_hook::h0b641f1f8c9de2bf
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/panicking.rs:292:9
  11:     0x7f325fc8bcdc - std[1167999404bd111b]::panicking::update_hook::<alloc[530719d21e18248f]::boxed::Box<rustc_driver_impl[221cda1307b92b70]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f325cd8fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h9256970e3d77e3fc
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/alloc/src/boxed.rs:2030:9
  13:     0x7f325cd8fd50 - std::panicking::rust_panic_with_hook::hd08646cb5d109a5b
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/panicking.rs:783:13
  14:     0x7f325fcb87f4 - std[1167999404bd111b]::panicking::begin_panic::<rustc_errors[430cc2d97f9a0eb3]::ExplicitBug>::{closure#0}
  15:     0x7f325fcb5446 - std[1167999404bd111b]::sys_common::backtrace::__rust_end_short_backtrace::<std[1167999404bd111b]::panicking::begin_panic<rustc_errors[430cc2d97f9a0eb3]::ExplicitBug>::{closure#0}, !>
  16:     0x7f325fcb0c06 - std[1167999404bd111b]::panicking::begin_panic::<rustc_errors[430cc2d97f9a0eb3]::ExplicitBug>
  17:     0x7f325fcc21e1 - <rustc_errors[430cc2d97f9a0eb3]::diagnostic::BugAbort as rustc_errors[430cc2d97f9a0eb3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f326009a8bc - <rustc_errors[430cc2d97f9a0eb3]::DiagCtxt>::bug::<alloc[530719d21e18248f]::string::String>
  19:     0x7f326013f55b - rustc_middle[2fef699d51b04cde]::util::bug::opt_span_bug_fmt::<rustc_span[dca1c35612e9799e]::span_encoding::Span>::{closure#0}
  20:     0x7f3260122daa - rustc_middle[2fef699d51b04cde]::ty::context::tls::with_opt::<rustc_middle[2fef699d51b04cde]::util::bug::opt_span_bug_fmt<rustc_span[dca1c35612e9799e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f3260122c48 - rustc_middle[2fef699d51b04cde]::ty::context::tls::with_context_opt::<rustc_middle[2fef699d51b04cde]::ty::context::tls::with_opt<rustc_middle[2fef699d51b04cde]::util::bug::opt_span_bug_fmt<rustc_span[dca1c35612e9799e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f325e55e940 - rustc_middle[2fef699d51b04cde]::util::bug::bug_fmt
  23:     0x7f3261ef5e68 - rustc_const_eval[e5663af8bd04b20a]::const_eval::eval_queries::eval_body_using_ecx::{closure#0}
  24:     0x7f3261e76723 - rustc_const_eval[e5663af8bd04b20a]::const_eval::eval_queries::eval_in_interpreter
  25:     0x7f32613f6572 - rustc_const_eval[e5663af8bd04b20a]::const_eval::eval_queries::eval_to_allocation_raw_provider
  26:     0x7f32613f6340 - rustc_query_impl[2d7a486b3b483e50]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d7a486b3b483e50]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 24usize]>>
  27:     0x7f3261a0fed1 - rustc_query_system[cca60478b9b5cf0a]::query::plumbing::try_execute_query::<rustc_query_impl[2d7a486b3b483e50]::DynamicConfig<rustc_query_system[cca60478b9b5cf0a]::query::caches::DefaultCache<rustc_middle[2fef699d51b04cde]::ty::ParamEnvAnd<rustc_middle[2fef699d51b04cde]::mir::interpret::GlobalId>, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[2d7a486b3b483e50]::plumbing::QueryCtxt, false>
  28:     0x7f3261a0faac - rustc_query_impl[2d7a486b3b483e50]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7f3261a119d4 - rustc_const_eval[e5663af8bd04b20a]::const_eval::valtrees::eval_to_valtree
  30:     0x7f3261a117e2 - <rustc_const_eval[e5663af8bd04b20a]::provide::{closure#0} as core[2d5c3c55c032a2b6]::ops::function::FnOnce<(rustc_middle[2fef699d51b04cde]::ty::context::TyCtxt, rustc_middle[2fef699d51b04cde]::ty::ParamEnvAnd<rustc_middle[2fef699d51b04cde]::mir::interpret::GlobalId>)>>::call_once
  31:     0x7f3261a117b6 - rustc_query_impl[2d7a486b3b483e50]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d7a486b3b483e50]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 24usize]>>
  32:     0x7f3261a11773 - <rustc_query_impl[2d7a486b3b483e50]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[2d5c3c55c032a2b6]::ops::function::FnOnce<(rustc_middle[2fef699d51b04cde]::ty::context::TyCtxt, rustc_middle[2fef699d51b04cde]::ty::ParamEnvAnd<rustc_middle[2fef699d51b04cde]::mir::interpret::GlobalId>)>>::call_once
  33:     0x7f3261a0ffac - rustc_query_system[cca60478b9b5cf0a]::query::plumbing::try_execute_query::<rustc_query_impl[2d7a486b3b483e50]::DynamicConfig<rustc_query_system[cca60478b9b5cf0a]::query::caches::DefaultCache<rustc_middle[2fef699d51b04cde]::ty::ParamEnvAnd<rustc_middle[2fef699d51b04cde]::mir::interpret::GlobalId>, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[2d7a486b3b483e50]::plumbing::QueryCtxt, false>
  34:     0x7f3261a0f8ac - rustc_query_impl[2d7a486b3b483e50]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f3261a0f0be - rustc_middle[2fef699d51b04cde]::query::plumbing::query_get_at::<rustc_query_system[cca60478b9b5cf0a]::query::caches::DefaultCache<rustc_middle[2fef699d51b04cde]::ty::ParamEnvAnd<rustc_middle[2fef699d51b04cde]::mir::interpret::GlobalId>, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 24usize]>>>
  36:     0x7f3261a0ed19 - <rustc_middle[2fef699d51b04cde]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  37:     0x7f3261a0e4d4 - <rustc_middle[2fef699d51b04cde]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  38:     0x7f325ff8c889 - <rustc_infer[afeca00818b462f4]::infer::InferCtxt>::const_eval_resolve
  39:     0x7f3262670a2e - rustc_trait_selection[c8b9aadbf50bfac0]::traits::const_evaluatable::is_const_evaluatable.cold.0
  40:     0x7f325e095097 - <rustc_trait_selection[c8b9aadbf50bfac0]::traits::fulfill::FulfillProcessor as rustc_data_structures[40c8b2a1ba3a6075]::obligation_forest::ObligationProcessor>::process_obligation
  41:     0x7f326101bc60 - <rustc_data_structures[40c8b2a1ba3a6075]::obligation_forest::ObligationForest<rustc_trait_selection[c8b9aadbf50bfac0]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[c8b9aadbf50bfac0]::traits::fulfill::FulfillProcessor>
  42:     0x7f3261b20d45 - <rustc_hir_typeck[aabe17c5e1176325]::fn_ctxt::FnCtxt>::check_argument_types
  43:     0x7f32619757c7 - <rustc_hir_typeck[aabe17c5e1176325]::fn_ctxt::FnCtxt>::check_call
  44:     0x7f3261a604e3 - <rustc_hir_typeck[aabe17c5e1176325]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  45:     0x7f32615e3e5b - <rustc_hir_typeck[aabe17c5e1176325]::fn_ctxt::FnCtxt>::check_block_with_expected
  46:     0x7f3261a609c6 - <rustc_hir_typeck[aabe17c5e1176325]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  47:     0x7f3261913288 - rustc_hir_typeck[aabe17c5e1176325]::check::check_fn
  48:     0x7f32611385f1 - rustc_hir_typeck[aabe17c5e1176325]::typeck
  49:     0x7f326113789f - rustc_query_impl[2d7a486b3b483e50]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d7a486b3b483e50]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 8usize]>>
  50:     0x7f32612bf7f0 - rustc_query_system[cca60478b9b5cf0a]::query::plumbing::try_execute_query::<rustc_query_impl[2d7a486b3b483e50]::DynamicConfig<rustc_query_system[cca60478b9b5cf0a]::query::caches::VecCache<rustc_span[dca1c35612e9799e]::def_id::LocalDefId, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2d7a486b3b483e50]::plumbing::QueryCtxt, false>
  51:     0x7f32612bf30c - rustc_query_impl[2d7a486b3b483e50]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7f32619cd512 - <rustc_middle[2fef699d51b04cde]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[f9243b092bfd4bc4]::check_crate::{closure#6}>::{closure#0}
  53:     0x7f32619cbddd - rustc_hir_analysis[f9243b092bfd4bc4]::check_crate
  54:     0x7f3261c0f1af - rustc_interface[3211d57ef7b44dc5]::passes::analysis
  55:     0x7f3261c0ee19 - rustc_query_impl[2d7a486b3b483e50]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2d7a486b3b483e50]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 1usize]>>
  56:     0x7f3261d2b5a5 - rustc_query_system[cca60478b9b5cf0a]::query::plumbing::try_execute_query::<rustc_query_impl[2d7a486b3b483e50]::DynamicConfig<rustc_query_system[cca60478b9b5cf0a]::query::caches::SingleCache<rustc_middle[2fef699d51b04cde]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2d7a486b3b483e50]::plumbing::QueryCtxt, false>
  57:     0x7f3261d2b309 - rustc_query_impl[2d7a486b3b483e50]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  58:     0x7f3261d3a7d6 - rustc_interface[3211d57ef7b44dc5]::interface::run_compiler::<core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>, rustc_driver_impl[221cda1307b92b70]::run_compiler::{closure#0}>::{closure#0}
  59:     0x7f3261fccec5 - std[1167999404bd111b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3211d57ef7b44dc5]::util::run_in_thread_with_globals<rustc_interface[3211d57ef7b44dc5]::util::run_in_thread_pool_with_globals<rustc_interface[3211d57ef7b44dc5]::interface::run_compiler<core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>, rustc_driver_impl[221cda1307b92b70]::run_compiler::{closure#0}>::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>
  60:     0x7f3261fcccf2 - <<std[1167999404bd111b]::thread::Builder>::spawn_unchecked_<rustc_interface[3211d57ef7b44dc5]::util::run_in_thread_with_globals<rustc_interface[3211d57ef7b44dc5]::util::run_in_thread_pool_with_globals<rustc_interface[3211d57ef7b44dc5]::interface::run_compiler<core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>, rustc_driver_impl[221cda1307b92b70]::run_compiler::{closure#0}>::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2d5c3c55c032a2b6]::result::Result<(), rustc_span[dca1c35612e9799e]::ErrorGuaranteed>>::{closure#1} as core[2d5c3c55c032a2b6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  61:     0x7f325cd99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha029642ca6390740
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/alloc/src/boxed.rs:2016:9
  62:     0x7f325cd99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf1943d8b8c84814b
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/alloc/src/boxed.rs:2016:9
  63:     0x7f325cd99725 - std::sys::pal::unix::thread::Thread::new::thread_start::h01e9562ca32060df
                               at /rustc/2ae1bb671183a072b54ed8ed39abfcd72990a3e7/library/std/src/sys/pal/unix/thread.rs:108:17
  64:     0x7f325cb8055a - <unknown>
  65:     0x7f325cbfda3c - <unknown>
  66:                0x0 - <unknown>

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.78.0-nightly (2ae1bb671 2024-02-24) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at /tmp/icemaker_global_tempdir.VPrjJPuc2PMX/rustc_testrunner_tmpdir_reporting.xXOE8jUXEYZD/mvce.rs:6:1: 6:66>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
#2 [typeck] type-checking `use_trait_impl`
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr 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. C-bug Category: This is a bug. labels Feb 25, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 25, 2024
@matthiaskrgr
Copy link
Member Author

#120847 cc @oli-obk

@oli-obk oli-obk added requires-nightly This issue requires a nightly compiler in some way. F-generic_const_exprs `#![feature(generic_const_exprs)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 25, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: Can't cast 'Float' type into u128 ICE: FloatToFloat/FloatToInt cast: source type usize is not a float type Mar 9, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@bors bors closed this as completed in 7ea507e May 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 25, 2024
Rollup merge of rust-lang#125451 - oli-obk:const_type_mismatch, r=compiler-errors

Fail relating constants of different types

fixes rust-lang#121585
fixes rust-lang#121858
fixes rust-lang#124151

I gave this several attempts before, but we lost too many important diagnostics until I managed to make compilation never bail out early. We have reached this point, so now we can finally fix all those ICEs by bubbling up an error instead of continueing when we encounter a bug.
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-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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