Skip to content

Mouseover doc rendering doesn't handle doc attr that uses concat. #12945

Closed
@Lokathor

Description

@Lokathor

I wrote some functions via macro like this:

macro_rules! impl_get_bit {
  ($fn_name:ident, $t:ty) => {
    /// Determines if the `b` bit is set in `u`.
    ///
    /// ## Panics
    #[doc = concat!("* `b` must be less than `",stringify!($t),"::BITS`.")]
    #[inline]
    #[must_use]
    pub const fn $fn_name(b: u32, u: $t) -> bool {
      assert!(b < <$t>::BITS);
      let mask = 1 << b;
      (x & mask) != 0
    }
  };
}

impl_get_bit!(u8_get_bit, u8);
impl_get_bit!(u16_get_bit, u16);
impl_get_bit!(u32_get_bit, u32);
impl_get_bit!(u64_get_bit, u64);
impl_get_bit!(u128_get_bit, u128);

And the rustdoc generated docs will show the bullet point with the type concat'd into the line:

  • b must be less than u8::BITS.

but the RA generated mouseover rendering of the docs just cuts off the last line entirely.

rust-analyzer version: rust-analyzer version: 0.3.1148-standalone (2b472f6 2022-07-31)

rustc version: rustc 1.64.0-nightly (0f4bcadb4 2022-07-30)

relevant settings: I don't believe there's any settings at play here, probably the document renderer just doesn't know how to handle doc=$expression stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions