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

Crashes when open a project using displaydoc and multi-line comments. #15840

Closed
sirius-cc-wu opened this issue Nov 6, 2023 · 3 comments
Closed
Labels
C-bug Category: bug

Comments

@sirius-cc-wu
Copy link

rust-analyzer 1.69.0 (84c898d 2023-04-16)
rustc 1.69.0 (84c898d65 2023-04-16)

When open https://github.com/nyurik/automotive_diag with VScode, the rust-analyzer extension crashes.

thread '<unnamed>' panicked at 'Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive.', /home/ccwu/.cargo/registry/src/github.com-1ecc6299db9ec823/displaydoc-0.2.4/src/attr.rs:78:13
stack backtrace:
   0: std::panicking::begin_panic
   1: displaydoc::attr::AttrsHelper::display
   2: displaydoc::attr::AttrsHelper::display_with_input
   3: displaydoc::expand::impl_enum::{{closure}}
   4: core::iter::adapters::map::map_try_fold::{{closure}}
   5: core::iter::traits::iterator::Iterator::try_fold
   6: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
   7: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
   8: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
   9: alloc::vec::Vec<T,A>::extend_desugared
  10: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
  12: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  13: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
  14: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
  15: core::iter::adapters::try_process
  16: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
  17: core::iter::traits::iterator::Iterator::collect
  18: displaydoc::expand::impl_enum
  19: displaydoc::expand::derive
  20: displaydoc::derive_error
  21: core::ops::function::Fn::call
  22: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}::{{closure}}
  23: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
  24: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
  25: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
  26: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
  27: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
  28: std::thread::local::LocalKey<T>::try_with
  29: std::thread::local::LocalKey<T>::with
  30: proc_macro::bridge::client::run_client::{{closure}}
  31: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  32: std::panicking::try::do_call
  33: __rust_try
  34: std::panicking::try
  35: std::panic::catch_unwind
  36: proc_macro::bridge::client::run_client
  37: proc_macro::bridge::client::Client<proc_macro::TokenStream,proc_macro::TokenStream>::expand1::{{closure}}
  38: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
  39: 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>, 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>
  40: <proc_macro_srv::abis::abi_sysroot::Abi>::expand
  41: <proc_macro_srv::dylib::Expander>::expand
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@nyurik
Copy link
Contributor

nyurik commented Nov 7, 2023

The error is visible in the output tab under Rust Analyzer Language Server

@lnicola
Copy link
Member

lnicola commented Nov 8, 2023

Can't reproduce. EDIT: yes, I can. Are you actually using the VS Code extension with rust-analyzer installed using rustup? That requires setting rust-analyzer.server.path.

@lnicola
Copy link
Member

lnicola commented Nov 8, 2023

This is probably a duplicate of #10110. It's not rust-analyzer that crashes, but rather the displaydoc. rust-analyzer itself works fine, but won't be able to expand that derive macro because we're stripping the #[ignore_extra_doc_attributes].

It's unlikely to be fixed soon, but you can use either use single-line comments on UdsCommand::InputOutputControlByIdentifier and any other, or set rust-analyzer.cargo.features and rust-analyzer.cargo.noDefaultFeatures to disable the display feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants