Skip to content

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

Closed
@Wilfred

Description

@Wilfred

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions