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

Request to make a temporary doc change to satisfy the IntelliJ-Rust parser #882

Closed
SaadiSave opened this issue Mar 23, 2022 · 8 comments
Closed

Comments

@SaadiSave
Copy link

Is this bit of code

image

absolutely necessary? If not, intellij-rust/intellij-rust#8589 can be worked around by removing this line (#[doc = concat!("Route `", stringify!($method) ,"` requests to the given handler.")]) from all the *_handler_fn macros, until intellij-rust is fixed. Please consider doing so.

@SaadiSave SaadiSave changed the title Proposal to make a temporary doc change to satisfy the IntelliJ-Rust parser Request to make a temporary doc change to satisfy the IntelliJ-Rust parser Mar 23, 2022
@jplatte
Copy link
Member

jplatte commented Mar 23, 2022

I don't think it's reasonable to remove important parts of the docs to work around an IDE issue. I just tried one way of simplifying the implementation that might have fixed it if it worked, but it didn't work.

@davidpdrsn
Copy link
Member

Yep I agree. I don't wanna remove docs due to IDE bugs.

You're welcome to suggest alternate workarounds.

@jplatte
Copy link
Member

jplatte commented Mar 23, 2022

For the record, what I tried is moving the docs out of the inner macro invocation. This didn't work for two reasons:

  • Apparently putting docs on macro invocations that produce items to document those items doesn't work
  • #[doc = concat!()] seems to somehow need the extra macro layer to function (I observed this in a different project and found on StackOverflow or such that people tend to use a doc_concat! macro for this)

@SaadiSave
Copy link
Author

Yep I agree. I don't wanna remove docs due to IDE bugs.

You're welcome to suggest alternate workarounds.

That's okay. This is not high priority.

For the record, what I tried is moving the docs out of the inner macro invocation. This didn't work for two reasons:

  • Apparently putting docs on macro invocations that produce items to document those items doesn't work
  • #[doc = concat!()] seems to somehow need the extra macro layer to function (I observed this in a different project and found on StackOverflow or such that people tend to use a doc_concat! macro for this)

Is the second option possible? I know that adding a new dependency for something so trivial isn't ideal, but would it be acceptable?

@davidpdrsn
Copy link
Member

I'm not aware of what doc_concat! is. Couldn't find a crate with that name.

@jplatte
Copy link
Member

jplatte commented Mar 23, 2022

It's not a crate, just a macro that's being copy-pasted around. I'm pretty sure it's going to break IntelliJ in the same way. Here's the one I added to Ruma a while ago:

macro_rules! doc_concat {
    ( $( #[doc = $doc:expr] $( $thing:tt )* )* ) => ( $( #[doc = $doc] $( $thing )* )* );
}

The issue I referenced in a comment above it, rust-lang/rust#52607, was apparently closed by rust-lang/rust#78837 but I'm still seeing issues without the macro, not sure what to make of that. There's a small chance it was just my own editor integration (rust-analyzer) that broke, but regardless of that I don't see how we could fix the first issue I mentioned.

@SaadiSave
Copy link
Author

  • #[doc = concat!()] seems to somehow need the extra macro layer to function

Why does rust-analyzer work then?

@jplatte
Copy link
Member

jplatte commented Mar 23, 2022

I don't understand what you mean. Why wouldn't rust-analyzer work?

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

3 participants