Skip to content

Doctest syntax highlighting does not work with #[doc] attributes #5016

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

Closed
c410-f3r opened this issue Jun 24, 2020 · 0 comments · Fixed by #8059
Closed

Doctest syntax highlighting does not work with #[doc] attributes #5016

c410-f3r opened this issue Jun 24, 2020 · 0 comments · Fixed by #8059
Labels
E-hard S-actionable Someone could pick this issue up and work on it right now

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented Jun 24, 2020

cfg and friends paired with doc = "..." should trigger syntax highlight if applicable.

/// # Example
///
/// ```rust
/// let _ = example(&[1, 2, 3]);
/// ```
///
/// # Another example
///
#[cfg_attr(feature = "alloc", doc = "```rust")]
#[cfg_attr(not(feature = "alloc"), doc = "```ignore")]
/// let _ = example(&alloc::vec![1, 2, 3]);
/// ```
pub fn example<T>(t: &T) -> &[i32]
where
    T: AsRef<[i32]>
{
  t.as_ref()
}
@c410-f3r c410-f3r changed the title cfg_attr inside doctests doesn't trigger syntax highlight No syntax highlight in doctests Jun 24, 2020
@matklad matklad added the E-hard label Jul 11, 2020
@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 18, 2021
@jonas-schievink jonas-schievink changed the title No syntax highlight in doctests Doctest syntax highlighting does not work with #[doc] attributes Mar 15, 2021
@bors bors bot closed this as completed in 0fbfab3 Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants