rust-lang / rust-lang/rust-analyzer

proc-macro-srv expand panic related with ntest-timeout

Open
#15,589 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer version: 0.4.1654-standalone (c405509f2 2023-09-08)
rustc version: rustc 1.71.1 (eb26296b5 2023-08-03)
vscode version:
Version: 1.82.0 (Universal)
Commit: 8b617bd08fd9e3fc94d14adb8d358b56e3f72314
Date: 2023-09-06T22:09:41.364Z
Electron: 25.8.0
ElectronBuildId: 23503258
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0
relevant settings:

** error logs in language server output **

thread '<unnamed>' panicked at 'Expected identifier!', /home/gftea/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntest_timeout-0.9.0/src/lib.rs:85:52
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
   2: core::panicking::panic_display
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:150:5
   3: core::panicking::panic_str
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:134:5
   4: core::option::expect_failed
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/option.rs:1932:5
   5: core::option::Option<T>::expect
   6: ntest_timeout::check_other_attributes
   7: ntest_timeout::timeout
   8: core::ops::function::Fn::call
   9: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}::{{closure}}
  10: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
  11: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
  12: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
  13: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
  14: std::thread::local::LocalKey<T>::try_with
  15: proc_macro::bridge::client::run_client::{{closure}}
  16: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  17: std::panicking::try::do_call
  18: __rust_try
  19: std::panicking::try
  20: proc_macro::bridge::client::run_client
  21: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}
  22: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
  23: proc_macro::bridge::server::run_server::<proc_macro_srv::abis::abi_sysroot::ra_server::RustAnalyzer, (proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>, proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>), core::option::Option<proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::SameThread>
  24: <proc_macro_srv::dylib::Expander>::expand

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported panic in ntest_timeout-0.9.0/src/lib.rs at check_other_attributes and trace how proc_macro_srv invokes the proc-macro expansion. Reproduce the ntest-timeout case against the reported Rust and rust-analyzer versions, then verify that expansion no longer panics for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.