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

borrow checker ICE #83316

Closed
donkeyteethUX opened this issue Mar 20, 2021 · 3 comments
Closed

borrow checker ICE #83316

donkeyteethUX opened this issue Mar 20, 2021 · 3 comments
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

@donkeyteethUX
Copy link

Code

This seems to be the problematic function. Obviously the code is not a reproducible example. If I have time I will try to add one. For some small context, channels is a tuple of crossbeam sender & receiver.

    fn listen(&mut self) {
        let run = |nframe: NFrame| -> Result<NFrame> {
            Self::check_kps(&nframe)?;
            self.nframe = nframe;
            self.nframe.generate_bow_set_diridx(&self.sg.bow_vocab);
            self.do_reloc()?;
            Ok(self.nframe.clone()) // todo: can avoid this clone
        };
        loop {
            let nframe = unwrap_or_continue!(self.channels.as_ref().unwrap().1.recv_timeout(Duration::new(1, 0)).ok());
            let result = run(nframe);
            self.channels.as_ref().unwrap().0.send(result.unwrap());
        }
    }

rustc --version --verbose:

rustc 1.51.0-nightly (04caa632d 2021-01-30)
binary: rustc
commit-hash: 04caa632dd10c2bf64b69524c7f9c4c30a436877
commit-date: 2021-01-30
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1

Error output

error: internal compiler error: compiler/rustc_mir/src/borrow_check/diagnostics/mutability_errors.rs:505:22: upvar `self` borrowed, but not mutably

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::ty::context::tls::with_opt
   4: rustc_middle::util::bug::opt_span_bug_fmt
   5: rustc_middle::util::bug::bug_fmt
   6: rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::show_mutating_upvar
   7: rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error
   8: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
   9: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect
  10: <rustc_mir::dataflow::framework::direction::Forward as rustc_mir::dataflow::framework::direction::Direction>::visit_results_in_block
  11: rustc_mir::dataflow::framework::visitor::visit_results
  12: rustc_mir::borrow_check::do_mir_borrowck
  13: rustc_infer::infer::InferCtxtBuilder::enter
  14: rustc_mir::borrow_check::mir_borrowck
  15: core::ops::function::FnOnce::call_once
  16: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
  17: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  18: rustc_data_structures::stack::ensure_sufficient_stack
  19: rustc_query_system::query::plumbing::force_query_with_job
  20: rustc_query_system::query::plumbing::get_query_impl
  21: rustc_query_system::query::plumbing::ensure_query_impl
  22: rustc_interface::passes::analysis
  23: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  25: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
  26: rustc_query_system::query::plumbing::force_query_with_job
  27: rustc_query_system::query::plumbing::get_query_impl
  28: rustc_interface::passes::QueryContext::enter
  29: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  30: rustc_span::with_source_map
  31: rustc_interface::interface::create_compiler_and_run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.51.0-nightly (04caa632d 2021-01-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `systems::relocalize::Relocalizer::listen`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 9 warnings emitted

error: could not compile `atlas`

To learn more, run the command again with --verbose.
@donkeyteethUX donkeyteethUX 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 Mar 20, 2021
@osa1
Copy link
Contributor

osa1 commented Mar 20, 2021

@rustbot label: +A-borrow-checker +E-needs-mcve

@rustbot rustbot added A-borrow-checker Area: The borrow checker E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Mar 20, 2021
@donkeyteethUX
Copy link
Author

Compiler works fine here on the latest nightly. I guess the issue has been fixed, so I won't bother working on a minimal example unless somebody really wants it.

@osa1
Copy link
Contributor

osa1 commented Mar 22, 2021

This is probably a duplicate of #81700 and can be closed as the issue is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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

4 participants