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: underline_start >= 0 && underline_end >= 0 #131762

Open
matthiaskrgr opened this issue Oct 15, 2024 · 3 comments
Open

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

matthiaskrgr opened this issue Oct 15, 2024 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-generic_assert `#![feature(generic_assert)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

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`.

@matthiaskrgr matthiaskrgr 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 Oct 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 15, 2024
@matthiaskrgr matthiaskrgr added the A-diagnostics Area: Messages for errors, warnings, and lints label Oct 15, 2024
@matthiaskrgr
Copy link
Member Author

this bisects to #123168 🤔

@fmease
Copy link
Member

fmease commented Oct 15, 2024

this bisects to #123168 🤔

retry with size_ofstd::mem::size_of

@fmease fmease added the F-generic_assert `#![feature(generic_assert)]` label Oct 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 20, 2024
@matthiaskrgr
Copy link
Member Author

#![feature(generic_assert)]
use std::mem::size_of;
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)))
}

=> Regression in nightly-2024-04-28
ending github query because we found starting sha: 4d570ee
get_commits_between returning commits, len: 10
commit[0] 2024-04-26: Auto merge of #123909 - dtolnay:utf8chunks, r=joboet
commit[1] 2024-04-26: Auto merge of #3517 - RalfJung:env-vars, r=RalfJung
commit[2] 2024-04-26: Auto merge of #124296 - cuviper:dist-cargo-tests, r=onur-ozkan
commit[3] 2024-04-27: Auto merge of #124424 - jhpratt:rollup-o3ngkjy, r=jhpratt
commit[4] 2024-04-27: Auto merge of #124416 - weihanglo:update-cargo, r=weihanglo
commit[5] 2024-04-27: Auto merge of #124428 - matthiaskrgr:rollup-sk5z4z8, r=matthiaskrgr
commit[6] 2024-04-27: Auto merge of #124430 - RalfJung:miri, r=RalfJung
commit[7] 2024-04-27: Auto merge of #124432 - zetanumbers:non_copy_into_raw_with_alloc, r=Nilstrieb
commit[8] 2024-04-27: Auto merge of #124405 - RalfJung:miri-core-alloc-tests, r=clubby789
commit[9] 2024-04-27: Auto merge of #124448 - matthiaskrgr:rollup-iloy9vz, r=matthiaskrgr
ERROR: no CI builds available between 4d570ee and aed2187 within last 167 days

maybe #124370 ?

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. F-generic_assert `#![feature(generic_assert)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

No branches or pull requests

4 participants