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

ICE on borrow check check_loans on stable #63932

Closed
mark-i-m opened this issue Aug 27, 2019 · 9 comments
Closed

ICE on borrow check check_loans on stable #63932

mark-i-m opened this issue Aug 27, 2019 · 9 comments
Labels
A-borrow-checker Area: The borrow checker 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

@mark-i-m
Copy link
Member

I don't know how to minimize this...

$ RUST_BACKTRACE=1 cargo run
   Compiling baguetteland v0.1.0 (/nobackup/baguetteland)
thread 'rustc' panicked at 'assertion failed: self.bccx.region_scope_tree.scopes_intersect(old_loan.kill_scope,
                                             new_loan.kill_scope)', src/librustc_borrowck/borrowck/check_loans.rs:493:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::begin_panic
   9: rustc_borrowck::borrowck::check_loans::CheckLoanCtxt::report_error_if_loans_conflict
  10: rustc_borrowck::dataflow::DataFlowContext<O>::each_bit_on_entry
  11: <rustc_borrowck::borrowck::check_loans::CheckLoanCtxt as rustc::middle::expr_use_visitor::Delegate>::borrow
  12: rustc::middle::expr_use_visitor::ExprUseVisitor::borrow_expr
  13: rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr
  14: rustc::middle::expr_use_visitor::ExprUseVisitor::consume_expr
  15: rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr
  16: rustc::middle::expr_use_visitor::ExprUseVisitor::borrow_expr
  17: rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr
  18: rustc::middle::expr_use_visitor::ExprUseVisitor::consume_expr
  19: rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr
  20: rustc::middle::expr_use_visitor::ExprUseVisitor::consume_expr
  21: rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr
  22: rustc::middle::expr_use_visitor::ExprUseVisitor::consume_expr
  23: rustc_borrowck::borrowck::check_loans::check_loans
  24: rustc_borrowck::borrowck::borrowck
  25: rustc::ty::query::__query_compute::borrowck
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::borrowck>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: rustc_mir::borrow_check::do_mir_borrowck
  30: rustc::ty::context::GlobalCtxt::enter_local
  31: rustc_mir::borrow_check::mir_borrowck
  32: rustc::ty::query::__query_compute::mir_borrowck
  33: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  34: rustc::dep_graph::graph::DepGraph::with_task_impl
  35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  36: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  37: rustc::util::common::time
  38: rustc_interface::passes::analysis
  39: rustc::ty::query::__query_compute::analysis
  40: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  41: rustc::dep_graph::graph::DepGraph::with_task_impl
  42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  43: rustc::ty::context::tls::enter_global
  44: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  45: rustc_interface::passes::create_global_ctxt::{{closure}}
  46: rustc_interface::interface::run_compiler_in_existing_thread_pool
  47: std::thread::local::LocalKey<T>::with
  48: scoped_tls::ScopedKey<T>::set
  49: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [borrowck] processing `main`
#1 [mir_borrowck] processing `main`
#2 [analysis] running analysis passes on this crate
end of query stack

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.37.0 (eae3437df 2019-08-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `baguetteland`.

To learn more, run the command again with --verbose.
@memoryruins
Copy link
Contributor

Does the ICE occur on nightly?
Based on the failed assert, it might have already been fixed by #62233

@Centril Centril added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-borrow-checker Area: The borrow checker labels Aug 27, 2019
@Centril
Copy link
Contributor

Centril commented Aug 27, 2019

cc @matthewjasper

@mark-i-m
Copy link
Member Author

struct Inventory;

impl Inventory {
    pub fn index(&self) -> &bool {
        &true
    }
}

fn main() {
    let game_state = Inventory;

    loop {
        match game_state {
            ref inventory if *inventory.index() => {}
            ref inventory if *inventory.index() => {}
            ref mut inventory => {}
        }
    }
}

Minimal reproduction on stable...

@mark-i-m
Copy link
Member Author

It does not appear to happen on a recent nightly:

$ rustc +nightly --version
rustc 1.39.0-nightly (f7af19c27 2019-08-15)

@mark-i-m
Copy link
Member Author

@Centril
Copy link
Contributor

Centril commented Aug 27, 2019

It doesn't appear on beta either.

Ostensibly we could do a point release but I'm thinking that's unlikely as this only makes an ICE into an error.

@mark-i-m
Copy link
Member Author

It seems like it would be ok to just let the beta promote... Perhaps we can wait and see. If more people run into this, it might be worth fixing. Otherwise, I would just wait it out.

@jonas-schievink jonas-schievink changed the title ICE on borrow check check_lones on stable ICE on borrow check check_loans on stable Aug 27, 2019
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Aug 27, 2019
@varkor varkor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 28, 2019
@mati865
Copy link
Contributor

mati865 commented Aug 28, 2019

@varkor the test was added in pr that fixed this bug: #62233

@varkor varkor removed the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 28, 2019
@nikomatsakis
Copy link
Contributor

Check-in from compiler triage:

This bug exists on stable but has been fixed on beta/nightly and is not considered high priority. I'm going to close the issue as fixed for now. Thanks for the report!

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. 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

7 participants