willcrichton / flowistry

Flowistry is an IDE plugin for Rust that helps you focus on relevant code.
https://marketplace.visualstudio.com/items?itemName=wcrichton.flowistry
MIT License
1.88k stars 44 forks source link

Panic on Vec::sort_by_key() #54

Closed burjui closed 2 years ago

burjui commented 2 years ago

In the following program

fn main() {
    let mut v: Vec<&str> = vec![];
    v.sort_by_key(|x| x.len());
}

clicking on the sort_by_key method causes a panic with flowistry v0.5.25

Flowistry could not run because your project failed to build with error:
thread 'rustc' panicked at 'internal error: entered unreachable code: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0) })', crates/flowistry/src/mir/aliases.rs:645:12
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `rust-playground`
With backtrace enabled:
Flowistry could not run because your project failed to build with error:
thread 'rustc' panicked at 'internal error: entered unreachable code: ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0) })', crates/flowistry/src/mir/aliases.rs:645:12
stack backtrace:
   0: rust_begin_unwind
             at /rustc/b2eed72a6fbf254e7d44942eaa121fcbed05d3fb/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/b2eed72a6fbf254e7d44942eaa121fcbed05d3fb/library/core/src/panicking.rs:142:14
   2: ::visit_region
   3: rustc_middle::ty::structural_impls::::super_visit_with
   4: ::visit_ty
   5: rustc_middle::ty::structural_impls::::super_visit_with
   6: ::visit_ty
   7: rustc_middle::ty::structural_impls::::super_visit_with
   8: ::visit_ty
   9: rustc_middle::ty::structural_impls::::super_visit_with
  10: ::visit_ty
  11: flowistry::mir::aliases::Aliases::collect_loans
  12: flowistry::cached::Cache::get
  13: flowistry::infoflow::analysis::FlowAnalysis::transfer_function::{{closure}}
  14: flowistry::infoflow::analysis::FlowAnalysis::transfer_function
  15: rustc_middle::mir::visit::Visitor::visit_statement
  16: flowistry::mir::engine::iterate_to_fixpoint
  17: std::thread::local::LocalKey::with
  18: flowistry::infoflow::compute_flow
  19: ::analyze
  20: rustc_interface::passes::QueryContext::enter
  21:  as rustc_driver::Callbacks>::after_parsing
  22: ::enter::, rustc_errors::ErrorGuaranteed>>
  23: rustc_span::with_source_map::, rustc_interface::interface::create_compiler_and_run, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  24: rustc_interface::interface::create_compiler_and_run::, rustc_driver::run_compiler::{closure#1}>
  25: >::set::, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: could not compile `rust-playground`
willcrichton commented 2 years ago

Thanks for the report @burjui. I'll ship a release with the patch today.