Skip to content

Hover information doesn't include doc comments created with concat! #17345

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Wilfred opened this issue Jun 4, 2024 · 1 comment
Closed

Hover information doesn't include doc comments created with concat! #17345

Wilfred opened this issue Jun 4, 2024 · 1 comment
Labels
C-bug Category: bug

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Jun 4, 2024

rust-analyzer version: rust-analyzer version: 0.3.1983-standalone (7852a4c 2024-06-02)

rustc version: 1.78.0

code snippet to reproduce:

fn main() {
    let x: usize = 1;
    let _ = x.saturating_add(123);
}

Hovering over saturating_add does not include the example:

Screenshot 2024-06-04 at 1 41 02 PM

This seems to be because the doc comment looks like this: https://github.com/rust-lang/rust/blob/master/library/core/src/num/int_macros.rs#L1599

    /// Saturating integer addition. Computes `self + rhs`, saturating at the numeric
    /// bounds instead of overflowing.
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101);")]
    #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_add(100), ", stringify!($SelfT), "::MAX);")]
    #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_add(-1), ", stringify!($SelfT), "::MIN);")]
    /// ```

Would it be possible to support this in rust-analyzer?

@Wilfred Wilfred added the C-bug Category: bug label Jun 4, 2024
@Veykril
Copy link
Member

Veykril commented Jun 5, 2024

Duplicate of #8092

@Veykril Veykril marked this as a duplicate of #8092 Jun 5, 2024
@Veykril Veykril closed this as completed Jun 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants