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

Bug: ICE upvar self borrowed but not mutably./ #6672

Closed
brightly-salty opened this issue Feb 4, 2021 · 6 comments
Closed

Bug: ICE upvar self borrowed but not mutably./ #6672

brightly-salty opened this issue Feb 4, 2021 · 6 comments
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@brightly-salty
Copy link
Contributor

I recieved this unexpected output when running cargo clippy on a branch of scryer-prolog:

➜  scryer-prolog git:(clippy-warnings) ✗ cargo clippy
    Checking scryer-prolog v0.8.127 (/Users/cadenhaustein/Documents/GitHub/scryer-prolog)
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
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (04caa632 2021-01-30)

query stack during panic:
#0 [mir_borrowck] borrow-checking `machine::loader::<impl machine::Machine>::compile_user_assert`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `scryer-prolog`

To learn more, run the command again with --verbose.
➜  scryer-prolog git:(clippy-warnings) ✗
@giraffate
Copy link
Contributor

Do you mean https://github.com/mthom/scryer-prolog? I can't reproduce the ICE on it. Can you provide a minmal reproduction? FYI I used versions below.

$ rustc -V
rustc 1.51.0-nightly (04caa632d 2021-01-30)
$ cargo clippy -V
clippy 0.1.51 (04caa632 2021-01-30)

@giraffate giraffate added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 5, 2021
@brightly-salty
Copy link
Contributor Author

Yes, that is the repository I'm talking about. I'm not sure what a minimal reproduction would look like. The ICE occurred (and continues to occur) on my branch of scryer-prolog located here https://github.com/brightly-salty/scryer-prolog/tree/clippy-warnings.

@giraffate
Copy link
Contributor

Thanks for more info! I reproduced the ICE on your branch, not master branch.

backtrace
$ RUST_BACKTRACE=full cargo clippy
    Checking scryer-prolog v0.8.127 (/Users/tnakata/workspace/scryer-prolog)
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:        0x10b06514c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd841328aa7dc06cc
   1:        0x10b0c964d - core::fmt::write::hefe95a44532fe6ed
   2:        0x10b057566 - std::io::Write::write_fmt::haeb49d4f9ecd789d
   3:        0x10b069019 - std::panicking::default_hook::{{closure}}::h465a961bccd4d390
   4:        0x10b068ba9 - std::panicking::default_hook::h7e189743c9acab0a
   5:        0x10a8df196 - clippy_driver::ICE_HOOK::{{closure}}::{{closure}}::hffcc4974016a412f
   6:        0x10b0697fe - std::panicking::rust_panic_with_hook::he74e9eac8174d6dd
   7:        0x111db5e71 - std::panicking::begin_panic::{{closure}}::h1a854b08a8e555cf
   8:        0x111db54e9 - std::sys_common::backtrace::__rust_end_short_backtrace::hf1abdc991e575939
   9:        0x1121ed771 - std::panicking::begin_panic::hecd46e606ef09612
  10:        0x111dc6eb3 - rustc_errors::HandlerInner::bug::h066d497cb78aa433
  11:        0x111dc54f7 - rustc_errors::Handler::bug::hbbe34ee08190d52e
  12:        0x111af50d4 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hcb6f3762eadf3759
  13:        0x111ae4e80 - rustc_middle::ty::context::tls::with_opt::hbfca6f1350360576
  14:        0x111af4ffb - rustc_middle::util::bug::opt_span_bug_fmt::h968305499b0e0c93
  15:        0x1121e9e2f - rustc_middle::util::bug::bug_fmt::h5677cca955f8a8e7
  16:        0x1109dd04b - rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::show_mutating_upvar::hb322b9c4f9709e4e
  17:        0x1109d9e16 - rustc_mir::borrow_check::diagnostics::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error::hc7b041ae3de99f2a
  18:        0x1109e94bc - rustc_mir::borrow_check::MirBorrowckCtxt::access_place::h4314fdc54afb3a93
  19:        0x1109e797b - <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::framework::visitor::ResultsVisitor>::visit_statement_before_primary_effect::hf55d038c32a8c29a
  20:        0x11080205b - <rustc_mir::dataflow::framework::direction::Forward as rustc_mir::dataflow::framework::direction::Direction>::visit_results_in_block::h5df776b90c85a1b9
  21:        0x1105a64f9 - rustc_mir::dataflow::framework::visitor::visit_results::hb1708c11114be106
  22:        0x1109e4c68 - rustc_mir::borrow_check::do_mir_borrowck::h2dc5f59581148b4b
  23:        0x1104fe95f - rustc_infer::infer::InferCtxtBuilder::enter::h3266db50977833ec
  24:        0x1109e1421 - rustc_mir::borrow_check::mir_borrowck::h8cdf24d72772d6b9
  25:        0x11099b1d7 - core::ops::function::FnOnce::call_once::h02ef1621e2fc32e1
  26:        0x10d9c051d - 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::h06c7088aeb79dd31
  27:        0x10d9650e1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h88a1e91358267ce4
  28:        0x10d90eff1 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha94e290b224f6b26
  29:        0x10d9c1e9f - rustc_data_structures::stack::ensure_sufficient_stack::h5f4104d60ff4185a
  30:        0x10d9f758d - rustc_query_system::query::plumbing::force_query_with_job::h93e948c3b04cbd35
  31:        0x10d9ed78f - rustc_query_system::query::plumbing::get_query_impl::h60c29221e5f676a8
  32:        0x10d9f4561 - rustc_query_system::query::plumbing::ensure_query_impl::h792f2db8fbdc85f0
  33:        0x10d99b5a2 - rustc_interface::passes::analysis::h8ea409ff1683f2f5
  34:        0x10d8021f2 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::hb634e64b60b99d7c
  35:        0x10d77c791 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h3bb49e028fec11ae
  36:        0x10d7f654e - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd63d3990f4ddd3b5
  37:        0x10d802310 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h17505854bc4f5a47
  38:        0x10d7a6fe9 - rustc_query_system::query::plumbing::force_query_with_job::h16308705307332d5
  39:        0x10d7a30c5 - rustc_query_system::query::plumbing::get_query_impl::h0aff3630147dc518
  40:        0x10d808eaa - rustc_interface::passes::QueryContext::enter::hec3391619f1c0034
  41:        0x10d77ec93 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h5ae1a861e2ef017b
  42:        0x10d7fdede - rustc_span::with_source_map::hb15b187d8726f95a
  43:        0x10d77fed4 - rustc_interface::interface::create_compiler_and_run::h676e33808641f5cb
  44:        0x10d80a713 - std::sys_common::backtrace::__rust_begin_short_backtrace::h17f5da3f25073b11
  45:        0x10d7a99a9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h099c825c1a0d0ef5
  46:        0x10b076a0d - std::sys::unix::thread::Thread::new::thread_start::h23116ad77b076564
  47:     0x7fff6a22b109 - __pthread_start

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.51 (04caa632 2021-01-30)

query stack during panic:
#0 [mir_borrowck] borrow-checking `machine::loader::<impl machine::Machine>::compile_user_assert`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `scryer-prolog`

To learn more, run the command again with --verbose.

@brightly-salty
Copy link
Contributor Author

@giraffate Looks like it might be similar to/a duplicate of rust-lang/rust#81700. I'll keep this issue up until that commit gets into rust-nightly, and then test again. If it works, I'll close the issue. Does that sound good?

@giraffate
Copy link
Contributor

Looks good, thanks!

@giraffate
Copy link
Contributor

I tried again on versions below, ICE doesn't happen. It seems to be fixed, so I'm closing this.

$ rustc -V
rustc 1.52.0-nightly (9778068cb 2021-02-07)
$ cargo clippy -V
clippy 0.1.52 (9778068c 2021-02-07)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants