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

Borrower checker mutability ICE #91335

Closed
rope-hmg opened this issue Nov 28, 2021 · 4 comments
Closed

Borrower checker mutability ICE #91335

rope-hmg opened this issue Nov 28, 2021 · 4 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

@rope-hmg
Copy link

Code

fn main() {
    let id = "This is a &str";

    let bytes = id.as_bytes();
        bytes[2] = 0x2F;
}

Meta

rustc --version --verbose:

rustc 1.58.0-nightly (b426445c6 2021-11-24)
binary: rustc
commit-hash: b426445c60b4faab6e96d2b866164d478680abf6
commit-date: 2021-11-24
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6', 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 (b426445c6 2021-11-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -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 `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `ice-ice-baby`
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6', compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs:450:53
stack backtrace:
   0: rust_begin_unwind
             at /rustc/b426445c60b4faab6e96d2b866164d478680abf6/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/b426445c60b4faab6e96d2b866164d478680abf6/library/core/src/panicking.rs:107:14
   2: core::panicking::panic_bounds_check
             at /rustc/b426445c60b4faab6e96d2b866164d478680abf6/library/core/src/panicking.rs:75:5
   3: <core::option::Option<&rustc_middle::mir::Location>>::map::<rustc_span::span_encoding::Span, <rustc_borrowck::MirBorrowckCtxt>::report_mutability_error::{closure#2}>
   4: <rustc_borrowck::MirBorrowckCtxt>::report_mutability_error
   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_borrowck::do_mir_borrowck
   8: <rustc_infer::infer::InferCtxtBuilder>::enter::<rustc_middle::mir::query::BorrowCheckResult, rustc_borrowck::mir_borrowck::{closure#0}>
   9: rustc_borrowck::mir_borrowck
  10: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
  11: <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>
  12: 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}>
  13: 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>>
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  15: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#2}>
  16: rustc_interface::passes::analysis
  17: <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>>
  18: 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}>
  19: 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>>>
  20: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  21: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  22: <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>>
  23: 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}>
  24: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
  25: <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 (b426445c6 2021-11-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -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 `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `ice-ice-baby`

@rope-hmg rope-hmg 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 Nov 28, 2021
@KamilaBorowska
Copy link
Contributor

KamilaBorowska commented Nov 28, 2021

Appears to be already fixed, as I cannot reproduce this with newest nightly but I can reproduce this with nightly-2021-11-24. Probably a duplicate of #91206.

@rope-hmg
Copy link
Author

I'll update my compiler tonight and check this then thanks.

@BGR360
Copy link
Contributor

BGR360 commented Dec 26, 2021

@rope-hmg any update?

@rope-hmg
Copy link
Author

Yeah, sorry. All seems fine now 😃

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