rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.11k stars 1.57k forks source link

index out of bound panic in chalk_ir #3865

Closed edwin0cheng closed 4 years ago

edwin0cheng commented 4 years ago

In 2603a9e628d304c8cb8fd08979e2f9c9afeac69e by running:

cargo run --release -p rust-analyzer -- analysis-stats .
Stack track ``` Finished release [optimized] target(s) in 0.25s Running `target\release\rust-analyzer.exe analysis-stats .` thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', C:\Users\Edwin\.cargo\git\checkouts\chalk-7b02fa8caa2cec94\039fc90\chalk-ir\src\lib.rs:1613:10 stack backtrace: 0: backtrace::backtrace::trace_unsynchronized at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66 1: std::sys_common::backtrace::_print_fmt at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:77 2: std::sys_common::backtrace::_print::{{impl}}::fmt at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:59 3: core::fmt::write at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\fmt\mod.rs:1052 4: std::io::Write::write_fmt at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\io\mod.rs:1426 5: std::sys_common::backtrace::_print at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:62 6: std::sys_common::backtrace::print at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\sys_common\backtrace.rs:49 7: std::panicking::default_hook::{{closure}} at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:204 8: std::panicking::default_hook at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:224 9: std::panicking::rust_panic_with_hook at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:472 10: std::panicking::begin_panic_handler at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:380 11: core::panicking::panic_fmt at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\panicking.rs:85 12: core::panicking::panic_bounds_check at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libcore\panicking.rs:63 13: as chalk_ir::fold::SuperFold>::super_fold_with 14: as chalk_ir::fold::SuperFold>::super_fold_with 15: chalk_ir::fold::boring_impls:: for chalk_ir::Parameter>::fold_with 16: as alloc::vec::SpecExtend>::from_iter 17: core::iter::adapters::process_results 18: as chalk_ir::fold::Fold>::fold_with 19: chalk_ir::fold::binder_impls:: for chalk_ir::Binders>::fold_with 20: as core::iter::traits::iterator::Iterator>::next 21: as alloc::vec::SpecExtend>::from_iter 22: as chalk_ir::fold::SuperFold>::super_fold_with 23: chalk_ir::fold::boring_impls:: for chalk_ir::Parameter>::fold_with 24: as alloc::vec::SpecExtend>::from_iter 25: core::iter::adapters::process_results 26: as chalk_ir::fold::Fold>::fold_with 27: as chalk_ir::fold::SuperFold>::super_fold_with 28: as chalk_ir::fold::SuperFold>::super_fold_with 29: as chalk_ir::fold::Fold<_I,_TI>>::fold_with 30: chalk_solve::infer::InferenceTable::from_canonical 31: chalk_engine::logic::>::get_or_create_table_for_ucanonical_goal 32: chalk_engine::forest::Forest::solve 33: ra_hir_ty::traits::trait_solve_query 34: salsa::runtime::Runtime::execute_query_implementation 35: core::ptr::drop_in_place 36: salsa::derived::slot::Slot::read 37: as salsa::plumbing::QueryStorageOps>::try_fetch 38: salsa::QueryTable::get 39: ::trait_solve 40: ra_hir_ty::method_resolution::iterate_method_candidates 41: ra_hir_ty::method_resolution::iterate_method_candidates 42: core::ptr::drop_in_place 43: core::ptr::drop_in_place 44: core::ptr::drop_in_place 45: core::ptr::drop_in_place 46: core::ptr::drop_in_place 47: core::ptr::drop_in_place 48: core::ptr::drop_in_place 49: core::ptr::drop_in_place 50: core::ptr::drop_in_place 51: core::ptr::drop_in_place 52: core::ptr::drop_in_place 53: core::ptr::drop_in_place 54: ra_hir_ty::infer::infer_query 55: salsa::runtime::Runtime::execute_query_implementation 56: core::ptr::drop_in_place 57: salsa::derived::slot::Slot::read 58: as salsa::plumbing::QueryStorageOps>::try_fetch 59: ::infer_query 60: ra_hir_ty::db::infer_wait 61: rust_analyzer::cli::analysis_stats::analysis_stats 62: <::deserialize::UrlVisitor as serde::de::Visitor>::visit_str 63: as alloc::vec::SpecExtend>::from_iter 64: std::rt::lang_start_internal::{{closure}} at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\rt.rs:52 65: std::panicking::try::do_call at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:305 66: panic_unwind::__rust_maybe_catch_panic at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libpanic_unwind\lib.rs:86 67: std::panicking::try at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panicking.rs:281 68: std::panic::catch_unwind at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\panic.rs:394 69: std::rt::lang_start_internal at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447\/src\libstd\rt.rs:51 70: main 71: invoke_main at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78 72: __scrt_common_main_seh at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283 73: BaseThreadInitThunk 74: RtlUserThreadStart note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: process didn't exit successfully: `target\release\rust-analyzer.exe analysis-stats .` (exit code: 101) ```

cc @flodiebold

flodiebold commented 4 years ago

:weary: that means I probably did something wrong with the Binders refactoring that wasn't caught by the tests, and I forgot to run analysis-stats...

edwin0cheng commented 4 years ago

I just knew that in the log of my ra-stats projects 😭

JoshMcguigan commented 4 years ago

cargo run --release -p rust-analyzer -- analysis-stats .

Does it make sense to run this in CI?

matklad commented 4 years ago

@JoshMcguigan good question. The problem is that will double our CI times...

I guess we can run this during our nightly release?

matklad commented 4 years ago

Added analysis-stats to CI. I guess I should probably bite the bullet and write the code that promotes release artifacts from nightly to stable...