Closed
Description
rust-analyzer version: b824588 2021-05-17 stable
After rustup update
and maybe a new version of ra I get this error: 'proc macro returned error: proc-macro panicked: range end index 8 out of range for slice of length 0'.
stack backtrace:
thread 'main' panicked at 'range end index 8 out of range for slice of length 0', crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs:135:1
stack backtrace:
0: rust_begin_unwind
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14
2: core::slice::index::slice_end_index_len_fail
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/slice/index.rs:41:5
3: <proc_macro_srv::proc_macro::bridge::server::Dispatcher<proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch
4: <proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call
5: proc_macro::bridge::closure::Closure<A,R>::call
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/closure.rs:27:18
6: proc_macro::bridge::client::Literal::integer::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:244:25
7: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:336:47
8: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:293:17
9: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/scoped_cell.rs:75:9
10: proc_macro::bridge::client::BridgeState::with::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:291:13
11: std::thread::local::LocalKey<T>::try_with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/thread/local.rs:400:16
12: std::thread::local::LocalKey<T>::with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/thread/local.rs:376:9
13: proc_macro::bridge::client::BridgeState::with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:290:9
14: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:329:9
15: proc_macro::bridge::client::Literal::integer
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:237:17
16: proc_macro::Literal::i64_unsuffixed
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/lib.rs:1006:21
17: proc_macro2::imp::Literal::i64_unsuffixed
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.27/src/wrapper.rs:798:56
18: proc_macro2::Literal::i64_unsuffixed
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.27/src/lib.rs:1045:41
19: syn::expr::printing::<impl quote::to_tokens::ToTokens for syn::expr::Index>::to_tokens
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.72/src/expr.rs:3287:27
20: derive_more::add_helpers::tuple_exprs
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/derive_more-0.99.14/src/add_helpers.rs:11:20
21: derive_more::add_assign_like::expand
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/derive_more-0.99.14/src/add_assign_like.rs:21:17
22: derive_more::add_assign_derive
at /home/nick/.cargo/registry/src/github.com-1ecc6299db9ec823/derive_more-0.99.14/src/lib.rs:280:29
23: core::ops::function::FnOnce::call_once
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/core/src/ops/function.rs:227:5
24: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:410:40
25: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:377:26
26: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/scoped_cell.rs:80:33
27: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/scoped_cell.rs:75:9
28: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/scoped_cell.rs:80:9
29: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:325:35
30: std::thread::local::LocalKey<T>::try_with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/thread/local.rs:400:16
31: std::thread::local::LocalKey<T>::with
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/thread/local.rs:376:9
32: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:325:9
33: proc_macro::bridge::client::run_client::{{closure}}
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:370:9
34: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/panic.rs:346:9
35: std::panicking::try::do_call
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/panicking.rs:401:40
36: __rust_try
37: std::panicking::try
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/panicking.rs:365:19
38: std::panic::catch_unwind
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/std/src/panic.rs:433:14
39: proc_macro::bridge::client::run_client
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:369:5
40: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
at /rustc/5dc8789e300930751a78996da0fa906be5a344a2/library/proc_macro/src/bridge/client.rs:410:13
41: proc_macro_srv::proc_macro::bridge::server::<impl proc_macro_srv::proc_macro::bridge::client::Client<fn(proc_macro_srv::proc_macro::bridge::client::TokenStream) .> proc_macro_srv::proc_macro::bridge::client::TokenStream>>::run
42: proc_macro_srv::cli::run
43: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread panicked while processing panic. aborting.
[ERROR proc_macro_api::process] proc macro server crashed, server process state: Ok(Some(ExitStatus(ExitStatus(132)))), server request error: Os { code: 32, kind: BrokenPipe, message: "Broken pipe"
Here's a minimal example: https://github.com/NickNick/ra-proc-macro-panic-derivemore-from
For me it looks like this:
... but runs fine:
nick@fusrodah /m/d/c/ra-proc-macro (main)> cargo r
warning: field is never read: `leg`
--> src/main.rs:4:5
|
4 | leg: &'a str,
| ^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: 1 warning emitted
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/ra-proc-macro`
Hello, world!