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

range end index 4 out of range for slice of length 0 - rust-analyzer macro-error #12780

Closed
aminya opened this issue Jul 17, 2022 · 1 comment
Closed

Comments

@aminya
Copy link

aminya commented Jul 17, 2022

I am getting this strange error from the rust analyzer:

range end index 4 out of range for slice of length 0 rust-analyzer [macro-error](https://rust-analyzer.github.io/manual.html#macro-error)

I just added the #memoize config before a function like this:

#[memoize]
pub fn do_something(path1: PathBuf, path2: PathBuf) -> String {
  // ...
}

This also happens with some other attributes and macros.

Full backtrace:

thread '<unnamed>' panicked at 'range end index 4 out of range for slice of length 0', library\core\src\slice\index.rs:73:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\core\src\panicking.rs:142
   2: core::slice::index::slice_end_index_len_fail_rt
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\core\src\slice\index.rs:73
   3: core::ops::function::FnOnce::call_once<never$ (*)(usize,usize),tuple$<usize,usize> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\core\src\ops\function.rs:248
   4: core::intrinsics::const_eval_select<tuple$<usize,usize>,never$ (*)(usize,usize),never$ (*)(usize,usize),never$>
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\core\src\intrinsics.rs:2695
   5: core::slice::index::slice_end_index_len_fail
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509/library\core\src\slice\index.rs:67
   6: core::slice::index::impl$3::index<u8>
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\core\src\slice\index.rs:304
   7: core::slice::index::impl$0::index
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\core\src\slice\index.rs:18
   8: proc_macro::bridge::rpc::impl$26::decode<tuple$<> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\rpc.rs:38
   9: proc_macro::bridge::rpc::impl$9::decode<tuple$<> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\rpc.rs:169
  10: proc_macro::bridge::client::impl$79::decode<tuple$<> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\client.rs:166
  11: proc_macro::bridge::impl$81::decode<tuple$<>,proc_macro::bridge::client::Span>
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\rpc.rs:57
  12: proc_macro::bridge::rpc::impl$11::decode<tuple$<>,proc_macro::bridge::ExpnGlobals<proc_macro::bridge::client::Span>,tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\rpc.rs:184
  13: proc_macro::bridge::client::run_client::closure$0<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::bridge::client::TokenStream>, 1, 4294967295, Some>,proc_macro::bridge::client:
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\client.rs:409
  14: core::panic::unwind_safe::impl$23::call_once<tuple$<>,proc_macro::bridge::client::run_client::closure_env$0<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::bridge::client::Toke
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\core\src\panic\unwind_safe.rs:271
  15: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<proc_macro::bridge::client::run_client::closure_env$0<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::br
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\std\src\panicking.rs:492
  16: proc_macro2::impl$44::clone
  17: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<proc_macro::bridge::client::run_client::closure_env$0<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::br
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\std\src\panicking.rs:456
  18: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<proc_macro::bridge::client::run_client::closure_env$0<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::bridge
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\std\src\panic.rs:137
  19: proc_macro::bridge::client::run_client<tuple$<proc_macro::bridge::client::TokenStream,proc_macro::bridge::client::TokenStream>,enum$<core::option::Option<proc_macro::bridge::client::TokenStream>, 1, 4294967295, Some>,proc_macro::bridge::client::impl$14::e
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\client.rs:405
  20: proc_macro::bridge::client::impl$14::expand2::closure$0<proc_macro::TokenStream (*)(proc_macro::TokenStream,proc_macro::TokenStream)>
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\client.rs:463
  21: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper<proc_macro::bridge::buffer::Buffer,proc_macro::bridge::client::impl$14::expand2::closure_env$0<proc_macro::TokenStream (*)(proc_macro::TokenStream,proc_macro::TokenStream)> >
             at /rustc/6dba4ed215e7a60f0a2a19c04f3f73691f89c509\library\proc_macro\src\bridge\selfless_reify.rs:64
  22: ZN14proc_macro_srv4abis8abi_1_6310proc_macro6bridge6server271_$LT$impl$u20$proc_macro_srv..abis..abi_1_63..proc_macro..bridge..client..Client$LT$$LP$proc_macro_srv..abis..abi_1_63..proc_macro..TokenStream$C$proc_macro_srv..abis..abi_1_63..proc_macro..Toke
  23: proc_macro_srv::abis::abi_1_63::Abi::expand
  24: proc_macro_srv::abis::Abi::expand
  25: proc_macro_srv::dylib::Expander::expand
  26: proc_macro_srv::ProcMacroSrv::expand
  27: proc_macro_srv::cli::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
rust-analyzer version: 0.4.1129-standalone (766c5f086 2022-07-16)

rustc version: (eg. output of rustc -V) rustc 1.64.0-nightly (6dba4ed21 2022-07-09)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME) default values

@lnicola
Copy link
Member

lnicola commented Jul 17, 2022

Duplicate of #12600, we don't support proc macros on 1.64 nightlies at the moment.

@lnicola lnicola closed this as completed Jul 17, 2022
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

2 participants