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

conflicting errors: index out of bounds #127915

Closed
matthiaskrgr opened this issue Jul 18, 2024 · 2 comments · Fixed by #127948
Closed

conflicting errors: index out of bounds #127915

matthiaskrgr opened this issue Jul 18, 2024 · 2 comments · Fixed by #127948
Assignees
Labels
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.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 18, 2024

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

@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 Jul 18, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 18, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #127579 cc @surechen

@surechen
Copy link
Contributor

bisects to #127579 cc @surechen

Thank you. @rustbot claim

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 19, 2024
tgross35 added a commit to tgross35/rust that referenced this issue Jul 19, 2024
…rors

fixes panic error `index out of bounds` in conflicting error

fixes rust-lang#127915
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 20, 2024
…rors

fixes panic error `index out of bounds` in conflicting error

fixes rust-lang#127915
@bors bors closed this as completed in 9747a2c Jul 20, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 20, 2024
Rollup merge of rust-lang#127948 - surechen:fix_127915, r=compiler-errors

fixes panic error `index out of bounds` in conflicting error

fixes rust-lang#127915
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. 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.

4 participants