Skip to content

conflicting errors: index out of bounds #127915

Closed

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

extern  {
    fn rust_interesting_average(_: i64, ...) -> f64;
}

fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
    unsafe {
        rust_interesting_average(
            6, a a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g,
        ) as i64
    }
}


original:

#[link(name = "rust_test_helpers", kind = "static")]
extern "rust_test_helpers" {
    fn rust_interesting_average(_: i64, ...) -> f64;
}

fn test<T, U>(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 {
    unsafe {
        rust_interesting_average(
            6, a a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g,
        ) as i64
    }
}

fn main() {
    assert_eq!(test(10, 20, 30, 40, 50, 60_i64, 60.0_f64), 70);
}

Version information

rustc 1.81.0-nightly (52f3c71c8 2024-07-18)
binary: rustc
commit-hash: 52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6
commit-date: 2024-07-18
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

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

Program output

error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `a`
  --> /tmp/icemaker_global_tempdir.QGzNG6bn8yYA/rustc_testrunner_tmpdir_reporting.SLkJ1snnTB0j/mvce.rs:10:18
   |
10 |             6, a a as f64, b, b as f64, f, c as f64, d, d as f64, e, e as f64, f, g,
   |                 -^ expected one of 8 possible tokens
   |                 |
   |                 help: missing `,`

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

thread 'rustc' panicked at compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs:460:25:
index out of bounds: the len is 1 but the index is 5
stack backtrace:
   0:     0x7c15380393e5 - std::backtrace_rs::backtrace::libunwind::trace::hc272dcb5eaa8302d
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7c15380393e5 - std::backtrace_rs::backtrace::trace_unsynchronized::h691a0ef10f8dc9a8
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7c15380393e5 - std::sys::backtrace::_print_fmt::ha47904fbec98bf60
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/sys/backtrace.rs:65:5
   3:     0x7c15380393e5 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h0e7a639705968ce6
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/sys/backtrace.rs:40:26
   4:     0x7c1538088e3b - core::fmt::rt::Argument::fmt::h4d320f08a40785a8
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/core/src/fmt/rt.rs:173:76
   5:     0x7c1538088e3b - core::fmt::write::hd7ed7bd021505a5c
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/core/src/fmt/mod.rs:1182:21
   6:     0x7c153802df4f - std::io::Write::write_fmt::hd51bd05baef3855c
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/io/mod.rs:1827:15
   7:     0x7c153803bbd1 - std::sys::backtrace::BacktraceLock::print::h680bd12acab7503d
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/sys/backtrace.rs:43:9
   8:     0x7c153803bbd1 - std::panicking::default_hook::{{closure}}::h0ef49fd74d19887c
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/panicking.rs:269:22
   9:     0x7c153803b8ac - std::panicking::default_hook::h90696ad068a27ec2
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/panicking.rs:296:9
  10:     0x7c153441c48a - std[3252865f4bda34c5]::panicking::update_hook::<alloc[da3b8f8ba9a896aa]::boxed::Box<rustc_driver_impl[f13dd90190e9dbe1]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x7c153803c59f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::haab09738ddd9b211
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/alloc/src/boxed.rs:2084:9
  12:     0x7c153803c59f - std::panicking::rust_panic_with_hook::hffc45dfe647fb2c9
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/panicking.rs:808:13
  13:     0x7c153803c1c7 - std::panicking::begin_panic_handler::{{closure}}::h6813f3683084058d
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/panicking.rs:674:13
  14:     0x7c15380398a9 - std::sys::backtrace::__rust_end_short_backtrace::h13725c19e23f5561
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/sys/backtrace.rs:168:18
  15:     0x7c153803be54 - rust_begin_unwind
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/panicking.rs:665:5
  16:     0x7c15380853f3 - core::panicking::panic_fmt::h41c1b797812051d9
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/core/src/panicking.rs:74:14
  17:     0x7c15380855e7 - core::panicking::panic_bounds_check::hc662a6db3764f3f1
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/core/src/panicking.rs:276:5
  18:     0x7c15341d9838 - <rustc_borrowck[77751704c041c5e5]::MirBorrowckCtxt>::suggest_ref_or_clone
  19:     0x7c15341d323d - <rustc_borrowck[77751704c041c5e5]::MirBorrowckCtxt>::report_use_of_moved_or_uninitialized
  20:     0x7c1535b5902f - <rustc_borrowck[77751704c041c5e5]::MirBorrowckCtxt>::consume_operand
  21:     0x7c1536a1e288 - rustc_borrowck[77751704c041c5e5]::do_mir_borrowck
  22:     0x7c15369ddd02 - rustc_query_impl[a7dfaff16252b164]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a7dfaff16252b164]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd9bfa5285b6d2e6]::query::erase::Erased<[u8; 8usize]>>
  23:     0x7c1535c8c3f3 - rustc_query_system[d599853b3d31bcb6]::query::plumbing::try_execute_query::<rustc_query_impl[a7dfaff16252b164]::DynamicConfig<rustc_query_system[d599853b3d31bcb6]::query::caches::VecCache<rustc_span[dacc065a687a0f9e]::def_id::LocalDefId, rustc_middle[dd9bfa5285b6d2e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a7dfaff16252b164]::plumbing::QueryCtxt, false>
  24:     0x7c1535c8be4d - rustc_query_impl[a7dfaff16252b164]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7c1535e6fa61 - rustc_interface[dbb229baa21df1c0]::passes::analysis
  26:     0x7c1535e6ec47 - rustc_query_impl[a7dfaff16252b164]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a7dfaff16252b164]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd9bfa5285b6d2e6]::query::erase::Erased<[u8; 1usize]>>
  27:     0x7c15368ec225 - rustc_query_system[d599853b3d31bcb6]::query::plumbing::try_execute_query::<rustc_query_impl[a7dfaff16252b164]::DynamicConfig<rustc_query_system[d599853b3d31bcb6]::query::caches::SingleCache<rustc_middle[dd9bfa5285b6d2e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a7dfaff16252b164]::plumbing::QueryCtxt, false>
  28:     0x7c15368ebf8f - rustc_query_impl[a7dfaff16252b164]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7c153680a345 - rustc_interface[dbb229baa21df1c0]::interface::run_compiler::<core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>, rustc_driver_impl[f13dd90190e9dbe1]::run_compiler::{closure#0}>::{closure#1}
  30:     0x7c15367a3189 - std[3252865f4bda34c5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dbb229baa21df1c0]::util::run_in_thread_with_globals<rustc_interface[dbb229baa21df1c0]::util::run_in_thread_pool_with_globals<rustc_interface[dbb229baa21df1c0]::interface::run_compiler<core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>, rustc_driver_impl[f13dd90190e9dbe1]::run_compiler::{closure#0}>::{closure#1}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>::{closure#0}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>
  31:     0x7c15367a2f3a - <<std[3252865f4bda34c5]::thread::Builder>::spawn_unchecked_<rustc_interface[dbb229baa21df1c0]::util::run_in_thread_with_globals<rustc_interface[dbb229baa21df1c0]::util::run_in_thread_pool_with_globals<rustc_interface[dbb229baa21df1c0]::interface::run_compiler<core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>, rustc_driver_impl[f13dd90190e9dbe1]::run_compiler::{closure#0}>::{closure#1}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>::{closure#0}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[67e71a49bc1f0e88]::result::Result<(), rustc_span[dacc065a687a0f9e]::ErrorGuaranteed>>::{closure#2} as core[67e71a49bc1f0e88]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7c15380465fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h779e14e1cec4b93e
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/alloc/src/boxed.rs:2070:9
  33:     0x7c15380465fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h93db42a0f7517b09
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/alloc/src/boxed.rs:2070:9
  34:     0x7c15380465fb - std::sys::pal::unix::thread::Thread::new::thread_start::h450a1bf9a7dd864a
                               at /rustc/52f3c71c8dc4aaed71e3035995fcbdd6d78c98c6/library/std/src/sys/pal/unix/thread.rs:108:17
  35:     0x7c1537ddaded - <unknown>
  36:     0x7c1537e5e0dc - <unknown>
  37:                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: rustc 1.81.0-nightly (52f3c71c8 2024-07-18) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `test`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

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

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Jul 18, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 18, 2024
  3. matthiaskrgr commented on Jul 18, 2024

    @matthiaskrgr
    MemberAuthor

    bisects to #127579 cc @surechen

  4. surechen commented on Jul 19, 2024

    @surechen
    Contributor

    bisects to #127579 cc @surechen

    Thank you. @rustbot claim

  5. added a commit that references this issue on Jul 19, 2024
    9747a2c
  6. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 19, 2024
  7. added a commit that references this issue on Jul 19, 2024
    5dbe933
  8. added a commit that references this issue on Jul 20, 2024
    767b3cb
  9. added a commit that references this issue on Jul 20, 2024
    5c2870e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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