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

rust-analyzer crashing after switching to other crate in the same workspace #4451

Closed
Dushistov opened this issue May 13, 2020 · 17 comments
Closed

Comments

@Dushistov
Copy link

Here what I got in

[ERROR rust_analyzer::main_loop] File with cargo diagnostic not found in VFS: foo/target/debug/build/boo-a04cb5b45ec9024d/out/java_glue.rs
Error: LspError { code: -32900, message: "Rust file outside current workspace is not supported yet." }
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.1/src/stdio.rs:29:13
Process rust-analyzer stderr finished

I build rust-analyzer from source rev 1b136aa

@Dushistov
Copy link
Author

Hm, I rebuilt last revision (88d3959) with

$ git diff
diff --git a/Cargo.toml b/Cargo.toml
index c034e2424..2607de619 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ debug = 0
 
 [profile.release]
 incremental = true
-debug = 0 # set this to 1 or 2 to get more useful backtraces in debugger
+debug = 2 # set this to 1 or 2 to get more useful backtraces in debugger
 
 # ideally, we would use `build-override` here, but some crates are also
 # needed at run-time and we end up compiling them twice

but no back trace for some reason:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.1/src/stdio.rs:29:13
stack backtrace:

@Dushistov
Copy link
Author

I bisected. The problem introduced by:

commit 1a2d4e2 (HEAD, refs/bisect/bad)
Author: Laurențiu Nicola
Date: Sun Apr 26 11:23:53 2020 +0300

Add support for incremental text synchronization

cc @lnicola

The problem that after editing source that not belong to crate: src/foo.rs.in (it handled by build script and included via include!(concat!(env!("OUT_DIR"), "/foo.rs")); ) rust-analyzer crashes.
It need several line delete/save/undo delete before next one request cause crash.

Error: thread '<unnamed>LspError' panicked at ' { called `Result::unwrap()` on an `Err` value: "SendError(..)"code', /home/evgeniy/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.1/src/stdio.rs: :29:-1332900
, message: "stack backtrace:
Rust file outside current workspace is not supported yet." }

Have no idea how to move father, because of there is no backtrace (RUST_BACKTRACE=full).
@matklad. is it possible compile rust-analyzer with panic=abort to get core dump, or code somehow depend on catch panic facility?

@lnicola
Copy link
Member

lnicola commented May 15, 2020

There are limitations with handling files outside of the workspace and it's possible that 1a2d4e2 might have made things worse. As a workaround, you can set the RA_NO_INCREMENTAL_SYNC environment variable to 1, which should disable the code introduced in that commit.

Still, I don't think that scenario was well-supported even before my change. Do you have a sample project that exhibits the problem?

@dkasak
Copy link

dkasak commented Jun 9, 2020

Just encountered this. Could the immediate problem be solved by not panicking if this case occurs but simply doing nothing?

@Dushistov
Copy link
Author

@lnicola

Do you have a sample project that exhibits the problem?

Clone Dushistov/flapigen-rs@90f0404

cpp_tests/src/cpp_glue.rs.in

I just tested 4cacedd .
I insesrted new line after this https://github.com/Dushistov/rust_swig/blob/90f0404f2fbd558166910d43728e642b69a542c6/cpp_tests/src/cpp_glue.rs.in#L25 ,
saved and rust-analyzer crashed.

I tried RA_NO_INCREMENTAL_SYNC=1, but crash still here.

@lnicola
Copy link
Member

lnicola commented Jun 9, 2020

I got a couple of panics, but not the one in the original report:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }', crates/ra_proc_macro_srv/src/rustc_server.rs:507:22
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  11: rust_begin_unwind
             at src/libstd/panicking.rs:385
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:86
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1272
  14: <ra_proc_macro_srv::rustc_server::Rustc as ra_proc_macro_srv::proc_macro::bridge::server::Literal>::f32
  15: <ra_proc_macro_srv::proc_macro::bridge::server::Dispatcher<ra_proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as ra_proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch
  16: <ra_proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call
  17: proc_macro::bridge::closure::Closure<A,R>::call
             at src/libproc_macro/bridge/closure.rs:27
  18: proc_macro::bridge::client::Literal::typed_integer::{{closure}}
             at src/libproc_macro/bridge/client.rs:243
  19: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:334
  20: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
             at src/libproc_macro/bridge/client.rs:292
  21: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at src/libproc_macro/bridge/scoped_cell.rs:74
  22: proc_macro::bridge::client::BridgeState::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:290
  23: std::thread::local::LocalKey<T>::try_with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:263
  24: std::thread::local::LocalKey<T>::with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:239
  25: proc_macro::bridge::client::BridgeState::with
             at src/libproc_macro/bridge/client.rs:289
  26: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
             at src/libproc_macro/bridge/client.rs:327
  27: proc_macro::bridge::client::Literal::typed_integer
             at src/libproc_macro/bridge/client.rs:236
  28: proc_macro::Literal::usize_suffixed
             at src/libproc_macro/lib.rs:942
  29: proc_macro2::imp::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/wrapper.rs:749
  30: proc_macro2::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/lib.rs:991
  31: <usize as quote::to_tokens::ToTokens>::to_tokens
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs:133
  32: strum_macros::macros::enum_iter::enum_iter_inner
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/macros/enum_iter.rs:55
  33: strum_macros::enum_iter
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/lib.rs:168
  34: core::ops::function::FnOnce::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
  35: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  36: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:375
  37: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  38: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:74
  39: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  40: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  41: std::thread::local::LocalKey<T>::try_with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
  42: std::thread::local::LocalKey<T>::with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
  43: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  44: proc_macro::bridge::client::run_client::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:368
  45: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
  46: std::panicking::try::do_call
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:297
  47: __rust_try
  48: std::panicking::try
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
  49: std::panic::catch_unwind
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
  50: proc_macro::bridge::client::run_client
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:367
  51: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  52: ra_proc_macro_srv::proc_macro::bridge::server::run_server
  53: ra_proc_macro_srv::dylib::Expander::expand
  54: ra_proc_macro_srv::ProcMacroSrv::expand
  55: ra_proc_macro_srv::cli::run
  56: rust_analyzer::main
  57: std::rt::lang_start::{{closure}}
  58: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  59: std::panicking::try::do_call
             at src/libstd/panicking.rs:297
  60: std::panicking::try
             at src/libstd/panicking.rs:274
  61: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  62: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  63: main
  64: __libc_start_main
  65: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }', crates/ra_proc_macro_srv/src/rustc_server.rs:507:22
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  11: rust_begin_unwind
             at src/libstd/panicking.rs:385
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:86
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1272
  14: <ra_proc_macro_srv::rustc_server::Rustc as ra_proc_macro_srv::proc_macro::bridge::server::Literal>::f32
  15: <ra_proc_macro_srv::proc_macro::bridge::server::Dispatcher<ra_proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as ra_proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch
  16: <ra_proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call
  17: proc_macro::bridge::closure::Closure<A,R>::call
             at src/libproc_macro/bridge/closure.rs:27
  18: proc_macro::bridge::client::Literal::typed_integer::{{closure}}
             at src/libproc_macro/bridge/client.rs:243
  19: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:334
  20: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
             at src/libproc_macro/bridge/client.rs:292
  21: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at src/libproc_macro/bridge/scoped_cell.rs:74
  22: proc_macro::bridge::client::BridgeState::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:290
  23: std::thread::local::LocalKey<T>::try_with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:263
  24: std::thread::local::LocalKey<T>::with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:239
  25: proc_macro::bridge::client::BridgeState::with
             at src/libproc_macro/bridge/client.rs:289
  26: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
             at src/libproc_macro/bridge/client.rs:327
  27: proc_macro::bridge::client::Literal::typed_integer
             at src/libproc_macro/bridge/client.rs:236
  28: proc_macro::Literal::usize_suffixed
             at src/libproc_macro/lib.rs:942
  29: proc_macro2::imp::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/wrapper.rs:749
  30: proc_macro2::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/lib.rs:991
  31: <usize as quote::to_tokens::ToTokens>::to_tokens
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs:133
  32: strum_macros::macros::enum_iter::enum_iter_inner
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/macros/enum_iter.rs:55
  33: strum_macros::enum_iter
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/lib.rs:168
  34: core::ops::function::FnOnce::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
  35: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  36: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:375
  37: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  38: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:74
  39: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  40: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  41: std::thread::local::LocalKey<T>::try_with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
  42: std::thread::local::LocalKey<T>::with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
  43: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  44: proc_macro::bridge::client::run_client::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:368
  45: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
  46: std::panicking::try::do_call
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:297
  47: __rust_try
  48: std::panicking::try
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
  49: std::panic::catch_unwind
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
  50: proc_macro::bridge::client::run_client
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:367
  51: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  52: ra_proc_macro_srv::proc_macro::bridge::server::run_server
  53: ra_proc_macro_srv::dylib::Expander::expand
  54: ra_proc_macro_srv::ProcMacroSrv::expand
  55: ra_proc_macro_srv::cli::run
  56: rust_analyzer::main
  57: std::rt::lang_start::{{closure}}
  58: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  59: std::panicking::try::do_call
             at src/libstd/panicking.rs:297
  60: std::panicking::try
             at src/libstd/panicking.rs:274
  61: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  62: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  63: main
  64: __libc_start_main
  65: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseFloatError { kind: Invalid }', crates/ra_proc_macro_srv/src/rustc_server.rs:507:22
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  11: rust_begin_unwind
             at src/libstd/panicking.rs:385
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:86
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1272
  14: <ra_proc_macro_srv::rustc_server::Rustc as ra_proc_macro_srv::proc_macro::bridge::server::Literal>::f32
  15: <ra_proc_macro_srv::proc_macro::bridge::server::Dispatcher<ra_proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as ra_proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch
  16: <ra_proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call
  17: proc_macro::bridge::closure::Closure<A,R>::call
             at src/libproc_macro/bridge/closure.rs:27
  18: proc_macro::bridge::client::Literal::typed_integer::{{closure}}
             at src/libproc_macro/bridge/client.rs:243
  19: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:334
  20: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
             at src/libproc_macro/bridge/client.rs:292
  21: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at src/libproc_macro/bridge/scoped_cell.rs:74
  22: proc_macro::bridge::client::BridgeState::with::{{closure}}
             at src/libproc_macro/bridge/client.rs:290
  23: std::thread::local::LocalKey<T>::try_with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:263
  24: std::thread::local::LocalKey<T>::with
             at /rustc/826cb062a659f7b719a8a0ab1497a78229318aab/src/libstd/thread/local.rs:239
  25: proc_macro::bridge::client::BridgeState::with
             at src/libproc_macro/bridge/client.rs:289
  26: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
             at src/libproc_macro/bridge/client.rs:327
  27: proc_macro::bridge::client::Literal::typed_integer
             at src/libproc_macro/bridge/client.rs:236
  28: proc_macro::Literal::usize_suffixed
             at src/libproc_macro/lib.rs:942
  29: proc_macro2::imp::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/wrapper.rs:749
  30: proc_macro2::Literal::usize_suffixed
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.18/src/lib.rs:991
  31: <usize as quote::to_tokens::ToTokens>::to_tokens
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.7/src/to_tokens.rs:133
  32: strum_macros::macros::enum_iter::enum_iter_inner
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/macros/enum_iter.rs:55
  33: strum_macros::enum_iter
             at /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/strum_macros-0.18.0/src/lib.rs:168
  34: core::ops::function::FnOnce::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
  35: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  36: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:375
  37: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  38: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:74
  39: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79
  40: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  41: std::thread::local::LocalKey<T>::try_with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
  42: std::thread::local::LocalKey<T>::with
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
  43: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:323
  44: proc_macro::bridge::client::run_client::{{closure}}
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:368
  45: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
  46: std::panicking::try::do_call
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:297
  47: __rust_try
  48: std::panicking::try
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
  49: std::panic::catch_unwind
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
  50: proc_macro::bridge::client::run_client
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:367
  51: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
             at /home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:407
  52: ra_proc_macro_srv::proc_macro::bridge::server::run_server
  53: ra_proc_macro_srv::dylib::Expander::expand
  54: ra_proc_macro_srv::ProcMacroSrv::expand
  55: ra_proc_macro_srv::cli::run
  56: rust_analyzer::main
  57: std::rt::lang_start::{{closure}}
  58: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  59: std::panicking::try::do_call
             at src/libstd/panicking.rs:297
  60: std::panicking::try
             at src/libstd/panicking.rs:274
  61: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  62: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  63: main
  64: __libc_start_main
  65: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

cc @edwin0cheng

@Dushistov
Copy link
Author

I got a couple of panics, but not the one in the original report:

May be number of threads matter? I run this on machine with 16 real cores and 32 logic one.

@lnicola
Copy link
Member

lnicola commented Jun 9, 2020

Mine is 4C8T. By the way, did you enable the proc macro and build script support?

@Dushistov
Copy link
Author

Dushistov commented Jun 9, 2020

did you enable the proc macro and build script support?

I suppose no. I heard about these options, but have no time to look at how to configure them in emacs. So all of them should have default values.

@edwin0cheng
Copy link
Member

I think it is #4676 ?

@dkasak
Copy link

dkasak commented Jun 9, 2020

I doubt it will be of much help, but I'm this is the error I'm getting (in nvim, using LanguageClient-neovim):

Error: LspErrorthread ' { <unnamed>code' panicked at ': called `Result::unwrap()` on an `Err` value: "SendError(..)"-', 32900/build/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.2/src/stdio.rs,
:message29: :"13Rust file outside current workspace is not supported yet.
" }
stack backtrace:
thread 'Error: <unnamed>LspError' panicked at ' { called `Result::unwrap()` on an `Err` value: "SendError(..)"code', : /build/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.2/src/stdio.rs-:3290029, :message13: 
"Rust file outside current workspace is not supported yet.stack backtrace:
" }

This seems to happen spontaneously, without me opening a new file at all. I'm just working on the code, periodically doing go-to-definition. At some point I'll notice it died because I get a [LC] sending on a disconnected channel message from LanguageClient-neovim when I try to do another go-to-definition.

This is on the 2020-06-08 release. If it matters, it's in a Rust project which is a workspace composed of several subprojects.

@zoechi
Copy link
Contributor

zoechi commented Jun 26, 2020

I get the same error as #4451 (comment)
when I enable lsp-rust-analyzer-proc-macro-enable in Emacs lsp-mode

@matklad
Copy link
Member

matklad commented Jun 26, 2020

The "Rust file outside current workspace is not supported yet." should be fixed now. The proc-macro one seems unrelated.

@dkasak
Copy link

dkasak commented Jul 1, 2020

@matklad I'm still getting that error regularly and then rust-analyzer stops working. This is with the 2020-06-29 release.

@matklad
Copy link
Member

matklad commented Jul 1, 2020

@dkasak that's strage, as we no longer have "Rust file outside current workspace is not supported yet" string in the codebase. So, either our release process is broken and we've relased some very old code, or you might not be using the version you think you use.

@matklad
Copy link
Member

matklad commented Jul 1, 2020

@dkasak
Copy link

dkasak commented Jul 1, 2020

Indeed, thanks for the hint... I just saw the new VFS commit. I was running the previous release accidentally.

So I can finally start using rust-analyzer again, I feel like I've recovered a superpower. 😄 Thanks!

@matklad matklad closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants