Properly handle doc attributes in doc-comment highlight injection

This commit is contained in:
Lukas Wirth 2021-03-16 21:05:07 +01:00
parent 3daa302cd3
commit c766492d26
5 changed files with 84 additions and 8 deletions

View file

@ -541,6 +541,22 @@ macro_rules! noop {
$expr
}
}
/// ```rust
/// let _ = example(&[1, 2, 3]);
/// ```
///
/// ```
/// loop {}
#[cfg_attr(not(feature = "false"), doc = "loop {}")]
#[doc = "loop {}"]
/// ```
///
#[cfg_attr(feature = "alloc", doc = "```rust")]
#[cfg_attr(not(feature = "alloc"), doc = "```ignore")]
/// let _ = example(&alloc::vec![1, 2, 3]);
/// ```
pub fn mix_and_match() {}
"#
.trim(),
expect_file!["./test_data/highlight_doctest.html"],