Skip to content

ICE: underline_start >= 0 && underline_end >= 0 #131762

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(generic_assert)]
struct FloatWrapper(f64);

fn main() {
    assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(size_of::<u8>, size_of::<u16>, size_of::<usize> as fn() -> usize)))
}

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (9322d183f 2024-10-14)
binary: rustc
commit-hash: 9322d183f45e0fd5a509820874cc5ff27744a479
commit-date: 2024-10-14
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

Error output

error[E0061]: this struct takes 1 argument but 3 arguments were supplied
 --> a.rs:5:63
  |
5 |     assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(size_of::<u8>, size_of::<u16>, size_of::<usize> as fn() -> usize)))
  |                                                               ^^^^^^^^^^^^                --------------  --------------------------------- unexpected argument #3 of type `fn() -> usize`
  |                                                                                           |
  |                                                                                           unexpected argument #2 of type `fn() -> usize {std::mem::size_of::<u16>}`
  |
note: expected `f64`, found fn item
 --> a.rs:5:5
  |
5 |     assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(size_of::<u8>, size_of::<u16>, size_of::<usize> as fn() -> usize)))
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: expected type `f64`
          found fn item `fn() -> usize {std::mem::size_of::<u8>}`
note: tuple struct defined here
 --> a.rs:2:8
  |
2 | struct FloatWrapper(f64);
  |        ^^^^^^^^^^^^
  = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
Backtrace

thread 'rustc' panicked at compiler/rustc_errors/src/emitter.rs:2074:21:
assertion failed: underline_start >= 0 && underline_end >= 0
stack backtrace:
   0:     0x7439ed035e8a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9d42d62719d070d7
   1:     0x7439ed8038ca - core::fmt::write::he7a421eb4c9a9d75
   2:     0x7439eea24e11 - std::io::Write::write_fmt::h567af23beaa18959
   3:     0x7439ed035ce2 - std::sys::backtrace::BacktraceLock::print::h0f6e88707316b8f0
   4:     0x7439ed0381c6 - std::panicking::default_hook::{{closure}}::h51c0a9b7a1b27603
   5:     0x7439ed038010 - std::panicking::default_hook::h97535dc250d97546
   6:     0x7439ec07ff1f - std[c5cfba72dffabd2d]::panicking::update_hook::<alloc[4954ba58ed17d890]::boxed::Box<rustc_driver_impl[a8f60622b3234adb]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7439ed0388d8 - std::panicking::rust_panic_with_hook::h43f7938156b6bea8
   8:     0x7439ed038676 - std::panicking::begin_panic_handler::{{closure}}::hdd2070c285bd1cc7
   9:     0x7439ed036339 - std::sys::backtrace::__rust_end_short_backtrace::hfdc9b232972de0bd
  10:     0x7439ed03836c - rust_begin_unwind
  11:     0x7439ea9edb00 - core::panicking::panic_fmt::h283601b5555cf015
  12:     0x7439ea59e6bc - core::panicking::panic::hd6ba05c5efd2c5a1
  13:     0x7439ee4bcbf0 - <rustc_errors[de2df449d029e931]::emitter::HumanEmitter>::emit_messages_default
  14:     0x7439ee4aff87 - <rustc_errors[de2df449d029e931]::emitter::HumanEmitter as rustc_errors[de2df449d029e931]::emitter::Emitter>::emit_diagnostic
  15:     0x7439ee4ccc4f - <rustc_errors[de2df449d029e931]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  16:     0x7439ee4f7e2c - rustc_interface[fc73b2d9c9b6253e]::callbacks::track_diagnostic::<core[7b8e24222d1ccc75]::option::Option<rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>
  17:     0x7439ee4f6965 - <rustc_errors[de2df449d029e931]::DiagCtxtInner>::emit_diagnostic
  18:     0x7439ee4f681f - <rustc_errors[de2df449d029e931]::DiagCtxtHandle>::emit_diagnostic
  19:     0x7439ee9f884b - <rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed as rustc_errors[de2df449d029e931]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  20:     0x7439ec3b1733 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::report_arg_errors
  21:     0x7439e9fb7139 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::confirm_builtin_call
  22:     0x7439ee283639 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7439ed8cacc7 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_overloaded_binop
  24:     0x7439ee285882 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7439ed8ca467 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_overloaded_binop
  26:     0x7439ee285882 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7439ee286b58 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7439e9fb013f - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::confirm_builtin_call
  29:     0x7439ee283639 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7439ee285fb2 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31:     0x7439ee285a43 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7439ee27ddca - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_block_with_expected
  33:     0x7439ee283f68 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  34:     0x7439ee27ddca - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_block_with_expected
  35:     0x7439ee283f68 - <rustc_hir_typeck[14722519427fb7a4]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36:     0x7439ee24dd84 - rustc_hir_typeck[14722519427fb7a4]::check::check_fn
  37:     0x7439ee242257 - rustc_hir_typeck[14722519427fb7a4]::typeck
  38:     0x7439ee241bd3 - rustc_query_impl[d7a38008b76d7199]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d7a38008b76d7199]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7cb4f182f827e3bf]::query::erase::Erased<[u8; 8usize]>>
  39:     0x7439edc6cf3a - rustc_query_system[65a76ee4bff6a1cf]::query::plumbing::try_execute_query::<rustc_query_impl[d7a38008b76d7199]::DynamicConfig<rustc_query_system[65a76ee4bff6a1cf]::query::caches::VecCache<rustc_span[fc5c94e8eafc8ab3]::def_id::LocalDefId, rustc_middle[7cb4f182f827e3bf]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d7a38008b76d7199]::plumbing::QueryCtxt, false>
  40:     0x7439edc6bc8d - rustc_query_impl[d7a38008b76d7199]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7439edc6b907 - <rustc_middle[7cb4f182f827e3bf]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[d2a803a74dc0eae7]::check_crate::{closure#4}>::{closure#0}
  42:     0x7439edc6981b - rustc_hir_analysis[d2a803a74dc0eae7]::check_crate
  43:     0x7439edc66257 - rustc_interface[fc73b2d9c9b6253e]::passes::run_required_analyses
  44:     0x7439ee67e99e - rustc_interface[fc73b2d9c9b6253e]::passes::analysis
  45:     0x7439ee67e971 - rustc_query_impl[d7a38008b76d7199]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d7a38008b76d7199]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7cb4f182f827e3bf]::query::erase::Erased<[u8; 1usize]>>
  46:     0x7439ee6d7bee - rustc_query_system[65a76ee4bff6a1cf]::query::plumbing::try_execute_query::<rustc_query_impl[d7a38008b76d7199]::DynamicConfig<rustc_query_system[65a76ee4bff6a1cf]::query::caches::SingleCache<rustc_middle[7cb4f182f827e3bf]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[d7a38008b76d7199]::plumbing::QueryCtxt, false>
  47:     0x7439ee6d78cf - rustc_query_impl[d7a38008b76d7199]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7439ee5818de - rustc_interface[fc73b2d9c9b6253e]::interface::run_compiler::<core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>, rustc_driver_impl[a8f60622b3234adb]::run_compiler::{closure#0}>::{closure#1}
  49:     0x7439ee630294 - std[c5cfba72dffabd2d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fc73b2d9c9b6253e]::util::run_in_thread_with_globals<rustc_interface[fc73b2d9c9b6253e]::util::run_in_thread_pool_with_globals<rustc_interface[fc73b2d9c9b6253e]::interface::run_compiler<core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>, rustc_driver_impl[a8f60622b3234adb]::run_compiler::{closure#0}>::{closure#1}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>::{closure#0}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>
  50:     0x7439ee6306a8 - <<std[c5cfba72dffabd2d]::thread::Builder>::spawn_unchecked_<rustc_interface[fc73b2d9c9b6253e]::util::run_in_thread_with_globals<rustc_interface[fc73b2d9c9b6253e]::util::run_in_thread_pool_with_globals<rustc_interface[fc73b2d9c9b6253e]::interface::run_compiler<core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>, rustc_driver_impl[a8f60622b3234adb]::run_compiler::{closure#0}>::{closure#1}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>::{closure#0}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7b8e24222d1ccc75]::result::Result<(), rustc_span[fc5c94e8eafc8ab3]::ErrorGuaranteed>>::{closure#1} as core[7b8e24222d1ccc75]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7439ee63116b - std::sys::pal::unix::thread::Thread::new::thread_start::h1588e535d4be38db
  52:     0x7439efd8a39d - <unknown>
  53:     0x7439efe0f49c - <unknown>
  54:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2024-10-15T21_38_35-464516.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.F-generic_assert`#![feature(generic_assert)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions