Skip to content

3d vector compiler bug #115203

Closed
Closed

Description

@gadzbi123

Code

fn main() {
    let sides: Vec<_> = Vec::from([[[0, 1], [2, 3]], [[4, 5], [6, 7]]]);
    let mut side = sides.iter();
    while let Some(points) = side.next() {
        match &points[..] {
            [p1, p2] => match [p1[..], p2[..]] {
                [[x1, y1], [x2, y2]] => {}
                _ => (),
            },
            _ => (),
        }
    }
}

Meta

Bug persists in nighly and beta version as well as 1.72 stable.
rustc --version --verbose:

rustc 1.72.0 (5680fa18f 2023-08-23)
binary: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-pc-windows-msvc
release: 1.72.0
LLVM version: 16.0.5

Error output

error[E0161]: cannot move a value of type `[i32]`
  --> advent\src\main.rs:55:32
   |
55 |             [p1, p2] => match [p1[..], p2[..]] {
   |                                ^^^^^^ the size of `[i32]` cannot be statically determined

error[E0161]: cannot move a value of type `[i32]`
  --> advent\src\main.rs:55:40
   |
55 |             [p1, p2] => match [p1[..], p2[..]] {
   |                                        ^^^^^^ the size of `[i32]` cannot be statically determined

error[E0508]: cannot move out of type `[i32]`, a non-copy slice
  --> advent\src\main.rs:55:32
   |
55 |             [p1, p2] => match [p1[..], p2[..]] {
   |                                ^^^^^^
   |                                |
   |                                cannot move out of here
   |                                move occurs because value has type `[i32]`, which does not implement the `Copy` trait

error[E0508]: cannot move out of type `[i32]`, a non-copy slice
  --> advent\src\main.rs:55:40
   |
55 |             [p1, p2] => match [p1[..], p2[..]] {
   |                                        ^^^^^^
   |                                        |
   |                                        cannot move out of here
   |                                        move occurs because value has type `[i32]`, which does not implement the `Copy` trait

thread 'rustc' panicked at /rustc/58eefc33adf769a1abe12ad94b3e6811185b4ce5\compiler\rustc_const_eval\src\interpret\projection.rs:54:9:
assertion failed: layout.is_sized()

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

warning: the ICE couldn't be written to `G:\programing\rust\adventOfRust2021\rustc-ice-2023-08-25T06:30:50.7890072Z-12864.txt`: The filename, directory name, or volume label syntax is incorrect. (os error 123)


note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#1 [analysis] running analysis passes on this crate
end of query stack
Some errors have detailed explanations: E0161, E0508.
Backtrace

stack backtrace:
0: 0x7ff8045a7c1a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hee39371e3afa4cac
1: 0x7ff8045dc60b - core::fmt::write::h784b30e5a150ff2a
2: 0x7ff80459d2e1 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h3f167a4d9752f39a
3: 0x7ff8045a799a - std::sys_common::backtrace::lock::h9a1e39803fc5b76e
4: 0x7ff8045ab2c3 - std::panicking::panic_hook_with_disk_dump::h1e385a540d361b4b
5: 0x7ff8045aae6b - std::panicking::panic_hook_with_disk_dump::h1e385a540d361b4b
6: 0x7fffe741c9d0 - rustc_driver_impl[d4e615167d320efa]::ice_path
7: 0x7ff8045abc7e - std::panicking::rust_panic_with_hook::h002d10abbdeacf8c
8: 0x7ff8045ab99a - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h591fe4f43155d48c
9: 0x7ff8045a88d9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hee39371e3afa4cac
10: 0x7ff8045ab6e0 - rust_begin_unwind
11: 0x7ff804611895 - core::panicking::panic_fmt::hbce22f0544c0bed4
12: 0x7ff804611942 - core::panicking::panic::h1ba68580d5d60f4d
13: 0x7fffe5ea62e5 - <rustc_mir_transform[2645dc67277a86ad]::elaborate_box_derefs::ElaborateBoxDerefVisitor as rustc_middle[d78655e0e9e137c2]::mir::visit::MutVisitor>::visit_place
14: 0x7fffe5eae3b6 - <rustc_mir_transform[2645dc67277a86ad]::elaborate_box_derefs::ElaborateBoxDerefVisitor as rustc_middle[d78655e0e9e137c2]::mir::visit::MutVisitor>::visit_place
15: 0x7fffe684bd18 - <rustc_mir_transform[2645dc67277a86ad]::remove_zsts::Replacer as rustc_middle[d78655e0e9e137c2]::mir::visit::MutVisitor>::visit_operand
16: 0x7fffe67f7c07 - <rustc_mir_transform[2645dc67277a86ad]::const_prop_lint::ConstPropagator as rustc_middle[d78655e0e9e137c2]::mir::visit::Visitor>::visit_basic_block_data
17: 0x7fffe67f66bf - <rustc_mir_transform[2645dc67277a86ad]::const_prop_lint::ConstProp as rustc_mir_transform[2645dc67277a86ad]::pass_manager::MirLint>::run_lint
18: 0x7fffe678b2a6 - <rustc_mir_transform[2645dc67277a86ad]::simplify_comparison_integral::SimplifyComparisonIntegral as rustc_middle[d78655e0e9e137c2]::mir::MirPass>::run_pass
19: 0x7fffe6d98acf - <rustc_query_impl[57d29b735ebd9d25]::plumbing::QueryCtxt as rustc_query_system[8f5a974417d62c95]::query::QueryContext>::load_side_effects
20: 0x7fffe6dde3cf - <rustc_query_impl[57d29b735ebd9d25]::plumbing::QueryCtxt as rustc_query_system[8f5a974417d62c95]::query::QueryContext>::load_side_effects
21: 0x7fffe6e5d362 - <rustc_query_impl[57d29b735ebd9d25]::plumbing::QueryCtxt as rustc_query_system[8f5a974417d62c95]::query::QueryContext>::load_side_effects
22: 0x7fffe6135f32 - rustc_query_impl[57d29b735ebd9d25]::profiling_support::alloc_self_profile_query_strings
23: 0x7fffe64bc29f - once_cell[3c15e2ee3bc16d65]::imp::initialize_or_wait
24: 0x7fffe365a850 - rustc_interface[c3ab73a2be863b1d]::passes::analysis
25: 0x7fffe6094add - rustc_query_impl[57d29b735ebd9d25]::profiling_support::alloc_self_profile_query_strings
26: 0x7fffe605b1e9 - <windows_sys[47e41ba1c594b9f4]::Windows::Win32::System::Diagnostics::Debug::MINIDUMP_HEADER as core[79da6043770374cc]::clone::Clone>::clone
27: 0x7fffe60c4865 - rustc_query_impl[57d29b735ebd9d25]::profiling_support::alloc_self_profile_query_strings
28: 0x7fffe60e3cc7 - rustc_query_impl[57d29b735ebd9d25]::profiling_support::alloc_self_profile_query_strings
29: 0x7fffe613361c - rustc_query_impl[57d29b735ebd9d25]::profiling_support::alloc_self_profile_query_strings
30: 0x7fffe361cb41 - rustc_driver_impl[d4e615167d320efa]::args::arg_expand_all
31: 0x7fffe3626b13 - rustc_driver_impl[d4e615167d320efa]::args::arg_expand_all
32: 0x7fffe363c895 - <rustc_middle[d78655e0e9e137c2]::ty::SymbolName as core[79da6043770374cc]::fmt::Display>::fmt
33: 0x7fffe363d696 - <rustc_middle[d78655e0e9e137c2]::ty::SymbolName as core[79da6043770374cc]::fmt::Display>::fmt
34: 0x7ff8045bee9c - std::sys::windows::thread::Thread::new::h9f737b48628a624d
35: 0x7ff86b517614 - BaseThreadInitThunk
36: 0x7ff86c8626b1 - RtlUserThreadStart

Activity

  1. added
    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.
    on Aug 25, 2023
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 25, 2023
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 25, 2023
  4. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 25, 2023
  5. matthiaskrgr commented on Aug 25, 2023

    @matthiaskrgr
    Member

    This is a compile error (1.70) -> error + ice (1.71) regression

  6. matthiaskrgr commented on Aug 25, 2023

    @matthiaskrgr
    Member

    Regression in nightly-2023-05-04

    found 7 bors merge commits in the specified range
    commit[0] 2023-05-02: Auto merge of #111028 - compiler-errors:attr-query-no-caching, r=cjgillot
    commit[1] 2023-05-02: Auto merge of #109729 - fortanix:raoul/bugfix_libtest_json_synchronization, r=pietroalbini
    commit[2] 2023-05-03: Auto merge of #110579 - nnethercote:restrict-From-for-Diagnostics, r=davidtwco
    commit[3] 2023-05-03: Auto merge of #111107 - weihanglo:update-cargo, r=weihanglo
    commit[4] 2023-05-03: Auto merge of #110846 - jdno:reduce-builder-sizes, r=pietroalbini
    commit[5] 2023-05-03: Auto merge of #110865 - cuviper:ct-ng-1.25, r=pietroalbini
    commit[6] 2023-05-03: Auto merge of #111153 - Dylan-DPC:rollup-0pq0hh3, r=Dylan-DPC
    validated commits found, specifying toolchains

    checking the start range to verify it passes
    installing a368898
    rust-std-nightly-x86_64-unknown-linux-gnu: 30.04 MB / 30.04 MB [=========================] 100.00 % 4.88 MB/s testing...
    RESULT: a368898, ===> Yes

  7. apiraino commented on Aug 29, 2023

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-medium

  8. added and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Aug 29, 2023
  9. added a commit that references this issue on Sep 8, 2023
    60327bb
  10. added a commit that references this issue on Sep 8, 2023
    7d9f4bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions