Skip to content

internal compiler error: unexpected panic #92265

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

Closed
bwinton opened this issue Dec 24, 2021 · 6 comments
Closed

internal compiler error: unexpected panic #92265

bwinton opened this issue Dec 24, 2021 · 6 comments
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

@bwinton
Copy link

bwinton commented Dec 24, 2021

Apologies for the poor title, but I'm not sure what to put there… 🙂

Code

https://gist.github.com/0f61ed0d930363d807431f16cb055b5a

Meta

rustc 1.58.0-nightly (65c55bf93 2021-11-23)
binary: rustc
commit-hash: 65c55bf931a55e6b1e5ed14ad8623814a7386424
commit-date: 2021-11-23
host: aarch64-apple-darwin
release: 1.58.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 2 but the index is 2', compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:450:53
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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: rustc 1.58.0-nightly (65c55bf93 2021-11-23) running on aarch64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `q24::solve`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `adventofcode`
Backtrace

   Compiling adventofcode v0.1.0 (/Users/bwinton/Programming/advent-of-code)
thread 'rustc' panicked at 'index out of bounds: the len is 2 but the index is 2', compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:450:53
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: <rustc_borrowck::MirBorrowckCtxt>::report_mutability_error
   4: <rustc_borrowck::MirBorrowckCtxt>::access_place
   5: <rustc_borrowck::MirBorrowckCtxt as rustc_mir_dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
   6: <rustc_mir_dataflow::framework::direction::Forward as rustc_mir_dataflow::framework::direction::Direction>::visit_results_in_block::<rustc_borrowck::dataflow::BorrowckAnalyses<rustc_index::bit_set::BitSet<rustc_borrowck::dataflow::BorrowIndex>, rustc_index::bit_set::BitSet<rustc_mir_dataflow::move_paths::MovePathIndex>, rustc_index::bit_set::BitSet<rustc_mir_dataflow::move_paths::InitIndex>>, rustc_borrowck::dataflow::BorrowckAnalyses<rustc_mir_dataflow::framework::engine::Results<rustc_borrowck::dataflow::Borrows>, rustc_mir_dataflow::framework::engine::Results<rustc_mir_dataflow::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow::framework::engine::Results<rustc_mir_dataflow::impls::EverInitializedPlaces>>, rustc_borrowck::MirBorrowckCtxt>
   7: rustc_mir_dataflow::framework::visitor::visit_results::<rustc_borrowck::dataflow::BorrowckAnalyses<rustc_index::bit_set::BitSet<rustc_borrowck::dataflow::BorrowIndex>, rustc_index::bit_set::BitSet<rustc_mir_dataflow::move_paths::MovePathIndex>, rustc_index::bit_set::BitSet<rustc_mir_dataflow::move_paths::InitIndex>>, rustc_borrowck::dataflow::BorrowckAnalyses<rustc_mir_dataflow::framework::engine::Results<rustc_borrowck::dataflow::Borrows>, rustc_mir_dataflow::framework::engine::Results<rustc_mir_dataflow::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow::framework::engine::Results<rustc_mir_dataflow::impls::EverInitializedPlaces>>, core::iter::adapters::map::Map<rustc_middle::mir::traversal::ReversePostorder, rustc_borrowck::do_mir_borrowck::{closure#2}>, rustc_borrowck::MirBorrowckCtxt>
   8: rustc_borrowck::do_mir_borrowck
   9: <rustc_infer::infer::InferCtxtBuilder>::enter::<rustc_middle::mir::query::BorrowCheckResult, rustc_borrowck::mir_borrowck::{closure#0}>
  10: rustc_borrowck::mir_borrowck
  11: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  12: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>
  13: rustc_data_structures::stack::ensure_sufficient_stack::<(&rustc_middle::mir::query::BorrowCheckResult, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>::{closure#3}>
  14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::mir::query::BorrowCheckResult>>
  15: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
  16: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#2}>
  17: rustc_interface::passes::analysis
  18: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
  19: rustc_data_structures::stack::ensure_sufficient_stack::<(core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#3}>
  20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
  21: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  23: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  24: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  25: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
  26: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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: rustc 1.58.0-nightly (65c55bf93 2021-11-23) running on aarch64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `q24::solve`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `adventofcode`
warning: build failed, waiting for other jobs to finish...
error: build failed```

</p>
</details>

@bwinton bwinton 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 Dec 24, 2021
@BGR360
Copy link
Contributor

BGR360 commented Dec 24, 2021

The code you provided in the gist isn't enough to attempt a repro on my end, I'm missing a few things:

error: couldn't read src/data/q24.data: No such file or directory (os error 2)
  --> src/main.rs:14:22
   |
14 | static INPUT: &str = include_str!("data/q24.data");
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find macro `q_impl` in this scope
   --> src/main.rs:300:1
    |
300 | q_impl!("24");
    | ^^^^^^

Is there by any chance a git repo that I can clone and a revision that I can checkout that has the code in the same state it was in when you encountered the ICE?

@bwinton
Copy link
Author

bwinton commented Dec 24, 2021

I'm not pushing the code yet, but I took some time to trim down the sample, and have published a new revision at https://gist.github.com/bwinton/0f61ed0d930363d807431f16cb055b5a that runs on its own and still has the error. If I comment out the level.sort();, it all works correctly (I mean, it gives me a bunch of dead_code warnings, but it compiles cleanly)…

@BGR360
Copy link
Contributor

BGR360 commented Dec 25, 2021

Amazing! That is immensely helpful.

I was able to reproduce, here's the backtrace with RUST_BACKTRACE=full:

Backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 2 but the index is 2', compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:450:53
stack backtrace:
   0:        0x1012819c8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61a7d3e4c5d884f5
   1:        0x1012ca980 - core::fmt::write::h15b38023853d48c8
   2:        0x1012738a0 - std::io::Write::write_fmt::h8d01a6f9467a53cf
   3:        0x1012847cc - std::panicking::default_hook::{{closure}}::h202969861cea2a40
   4:        0x1012843ac - std::panicking::default_hook::h6075a10f4c58af64
   5:        0x10849ba3c - rustc_driver[35b3b9d305ec1a86]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x101284fa0 - std::panicking::rust_panic_with_hook::h0d2ad4d26e65e971
   7:        0x101284ac0 - std::panicking::begin_panic_handler::{{closure}}::h81487f6587d82c75
   8:        0x101281e94 - std::sys_common::backtrace::__rust_end_short_backtrace::hc543c9309bc89e91
   9:        0x101284a28 - _rust_begin_unwind
  10:        0x1012fa170 - core::panicking::panic_fmt::h61e5a76b978edc22
  11:        0x1012fa144 - core::panicking::panic_bounds_check::hbcdb5a8d91c8ce55
  12:        0x10ad8e170 - <rustc_borrowck[6143a6a723f63a46]::MirBorrowckCtxt>::report_mutability_error
  13:        0x10ad95914 - <rustc_borrowck[6143a6a723f63a46]::MirBorrowckCtxt>::access_place
  14:        0x10ad94244 - <rustc_borrowck[6143a6a723f63a46]::MirBorrowckCtxt as rustc_mir_dataflow[2505fbb23d1ca289]::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
  15:        0x10ad2044c - <rustc_mir_dataflow[2505fbb23d1ca289]::framework::direction::Forward as rustc_mir_dataflow[2505fbb23d1ca289]::framework::direction::Direction>::visit_results_in_block::<rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowckAnalyses<rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowIndex>, rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_mir_dataflow[2505fbb23d1ca289]::move_paths::MovePathIndex>, rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_mir_dataflow[2505fbb23d1ca289]::move_paths::InitIndex>>, rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowckAnalyses<rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_borrowck[6143a6a723f63a46]::dataflow::Borrows>, rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_mir_dataflow[2505fbb23d1ca289]::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_mir_dataflow[2505fbb23d1ca289]::impls::EverInitializedPlaces>>, rustc_borrowck[6143a6a723f63a46]::MirBorrowckCtxt>
  16:        0x10acae320 - rustc_mir_dataflow[2505fbb23d1ca289]::framework::visitor::visit_results::<rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowckAnalyses<rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowIndex>, rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_mir_dataflow[2505fbb23d1ca289]::move_paths::MovePathIndex>, rustc_index[64c13988d092f625]::bit_set::BitSet<rustc_mir_dataflow[2505fbb23d1ca289]::move_paths::InitIndex>>, rustc_borrowck[6143a6a723f63a46]::dataflow::BorrowckAnalyses<rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_borrowck[6143a6a723f63a46]::dataflow::Borrows>, rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_mir_dataflow[2505fbb23d1ca289]::impls::MaybeUninitializedPlaces>, rustc_mir_dataflow[2505fbb23d1ca289]::framework::engine::Results<rustc_mir_dataflow[2505fbb23d1ca289]::impls::EverInitializedPlaces>>, core[489ab2277f19021d]::iter::adapters::map::Map<rustc_middle[29c0f47ba1981f7e]::mir::traversal::ReversePostorder, rustc_borrowck[6143a6a723f63a46]::do_mir_borrowck::{closure#2}>, rustc_borrowck[6143a6a723f63a46]::MirBorrowckCtxt>
  17:        0x10ad9ab04 - rustc_borrowck[6143a6a723f63a46]::do_mir_borrowck
  18:        0x10ad0cc44 - <rustc_infer[233d2e4639a00b1a]::infer::InferCtxtBuilder>::enter::<rustc_middle[29c0f47ba1981f7e]::mir::query::BorrowCheckResult, rustc_borrowck[6143a6a723f63a46]::mir_borrowck::{closure#0}>
  19:        0x10ad939c0 - rustc_borrowck[6143a6a723f63a46]::mir_borrowck
  20:        0x10ad75d14 - <rustc_borrowck[6143a6a723f63a46]::provide::{closure#0} as core[489ab2277f19021d]::ops::function::FnOnce<(rustc_middle[29c0f47ba1981f7e]::ty::context::TyCtxt, rustc_span[6eae83f828617b72]::def_id::LocalDefId)>>::call_once
  21:        0x10b118a10 - rustc_query_system[2ed05f00384aea15]::query::plumbing::try_execute_query::<rustc_query_impl[1e8f6af660f906f5]::plumbing::QueryCtxt, rustc_query_system[2ed05f00384aea15]::query::caches::DefaultCache<rustc_span[6eae83f828617b72]::def_id::LocalDefId, &rustc_middle[29c0f47ba1981f7e]::mir::query::BorrowCheckResult>>
  22:        0x10b1a40c4 - rustc_query_system[2ed05f00384aea15]::query::plumbing::get_query::<rustc_query_impl[1e8f6af660f906f5]::queries::mir_borrowck, rustc_query_impl[1e8f6af660f906f5]::plumbing::QueryCtxt>
  23:        0x10863f7e0 - <rustc_session[5f6c487c9c714a47]::session::Session>::time::<(), rustc_interface[3e6b3c7def9e9d82]::passes::analysis::{closure#2}>
  24:        0x1085acbcc - rustc_interface[3e6b3c7def9e9d82]::passes::analysis
  25:        0x10b148548 - rustc_query_system[2ed05f00384aea15]::query::plumbing::try_execute_query::<rustc_query_impl[1e8f6af660f906f5]::plumbing::QueryCtxt, rustc_query_system[2ed05f00384aea15]::query::caches::DefaultCache<(), core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>>
  26:        0x10b1dac04 - rustc_query_system[2ed05f00384aea15]::query::plumbing::get_query::<rustc_query_impl[1e8f6af660f906f5]::queries::analysis, rustc_query_impl[1e8f6af660f906f5]::plumbing::QueryCtxt>
  27:        0x1084fad6c - <rustc_interface[3e6b3c7def9e9d82]::passes::QueryContext>::enter::<rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>
  28:        0x1084df010 - <rustc_interface[3e6b3c7def9e9d82]::interface::Compiler>::enter::<rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}::{closure#2}, core[489ab2277f19021d]::result::Result<core[489ab2277f19021d]::option::Option<rustc_interface[3e6b3c7def9e9d82]::queries::Linker>, rustc_errors[1a053f9350564121]::ErrorReported>>
  29:        0x1084a4608 - rustc_span[6eae83f828617b72]::with_source_map::<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_interface[3e6b3c7def9e9d82]::interface::create_compiler_and_run<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}>::{closure#1}>
  30:        0x1084df898 - rustc_interface[3e6b3c7def9e9d82]::interface::create_compiler_and_run::<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}>
  31:        0x1084affc0 - <scoped_tls[34b11748aea080ce]::ScopedKey<rustc_span[6eae83f828617b72]::SessionGlobals>>::set::<rustc_interface[3e6b3c7def9e9d82]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[3e6b3c7def9e9d82]::interface::run_compiler<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}>::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>::{closure#0}::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>
  32:        0x1084ae02c - std[edbc36b44a871839]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3e6b3c7def9e9d82]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[3e6b3c7def9e9d82]::interface::run_compiler<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}>::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>
  33:        0x108500048 - <<std[edbc36b44a871839]::thread::Builder>::spawn_unchecked<rustc_interface[3e6b3c7def9e9d82]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[3e6b3c7def9e9d82]::interface::run_compiler<core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>, rustc_driver[35b3b9d305ec1a86]::run_compiler::{closure#1}>::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>::{closure#0}, core[489ab2277f19021d]::result::Result<(), rustc_errors[1a053f9350564121]::ErrorReported>>::{closure#1} as core[489ab2277f19021d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:        0x10128e318 - std::sys::unix::thread::Thread::new::thread_start::h02ceb9b16148ae76
  35:        0x1bf9754ec - _pthread_from_mach_thread_np

error: internal compiler error: unexpected panic

note: 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: rustc 1.58.0-nightly (936f2600b 2021-11-22) running on aarch64-apple-darwin

query stack during panic:
#0 [mir_borrowck] borrow-checking `solve`
#1 [analysis] running analysis passes on this crate
end of query stack

This issue does not occur on stable 1.57 nor on beta-1.58:

ben@Bens-MBP issue-92265 % rustc +stable src/error.rs
warning: variable does not need to be mutable
 --> src/error.rs:7:9
  |
7 |     let mut level = levels[i].get(&z).unwrap();
  |         ----^^^^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

error[E0596]: cannot borrow `*level` as mutable, as it is behind a `&` reference
 --> src/error.rs:8:5
  |
7 |     let mut level = levels[i].get(&z).unwrap();
  |         --------- help: consider changing this to be a mutable reference: `&mut Vec<(i128, i128)>`
8 |     level.sort();
  |     ^^^^^^^^^^^^ `level` is a `&` reference, so the data it refers to cannot be borrowed as mutable

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0596`.
ben@Bens-MBP issue-92265 % rustc +beta src/error.rs
warning: variable does not need to be mutable
 --> src/error.rs:7:9
  |
7 |     let mut level = levels[i].get(&z).unwrap();
  |         ----^^^^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

error[E0596]: cannot borrow `*level` as mutable, as it is behind a `&` reference
 --> src/error.rs:8:5
  |
7 |     let mut level = levels[i].get(&z).unwrap();
  |         --------- help: consider changing this to be a mutable reference: `&mut Vec<(i128, i128)>`
8 |     level.sort();
  |     ^^^^^^^^^^^^ `level` is a `&` reference, so the data it refers to cannot be borrowed as mutable

error: aborting due to previous error; 1 warning emitted

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

I'm going to try to bisect to find which revision broke things.

@rustbot label +regression-from-stable-to-nightly

@rustbot rustbot added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 25, 2021
@BGR360
Copy link
Contributor

BGR360 commented Dec 25, 2021

Oh wait, I'm sorry, the beta that I have installed is more recent than your nightly:

ben@Bens-MBP rust % rustc +beta --version -v
rustc 1.58.0-beta.2 (0e07bcb68 2021-12-04)
binary: rustc
commit-hash: 0e07bcb68b82b54c0c4ec6fe076e9d75b02109cf
commit-date: 2021-12-04
host: aarch64-apple-darwin
release: 1.58.0-beta.2
LLVM version: 13.0.0

So it appears this has been fixed. And indeed, doing a quick issue search for mutability_errors.rs, I found: #92172 which links to #91212.

Use rustup to get a more recent nightly and that should fix you.

@rustbot label -regression-from-stable-to-nightly -I-prioritize

@rustbot rustbot removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 25, 2021
@bwinton
Copy link
Author

bwinton commented Dec 25, 2021

That's great to hear!
I might wait until tomorrow, when the Advent of Code ends, just so that I don't have to spend time fixing anything that might have changed since I last upgraded… 😉

@BGR360
Copy link
Contributor

BGR360 commented Dec 25, 2021

Cool. Mind closing the issue?

@bwinton bwinton closed this as completed Dec 25, 2021
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

No branches or pull requests

3 participants