rustdoc: fix diagnostic with mixed code block styles

This commit is contained in:
Eric Huss 2019-09-07 12:21:32 -07:00
parent ef54f57c5b
commit fb387088e2
3 changed files with 30 additions and 1 deletions

View File

@ -931,7 +931,10 @@ pub fn markdown_links(md: &str) -> Vec<(String, Option<Range<usize>>)> {
is_fenced = true;
previous_offset + fence_idx
}
None => offset,
None => {
is_fenced = false;
offset
}
};
}
}

View File

@ -74,3 +74,11 @@ pub fn empty_rust() {}
///
/// ```
pub fn empty_rust_with_whitespace() {}
/// ```
/// let x = 1;
/// ```
///
/// \____/
///
pub fn indent_after_fenced() {}

View File

@ -201,6 +201,24 @@ help: mark blocks that do not contain Rust code as text
LL | /// ```text
| ^^^^^^^
error: unknown start of token: \
--> <doctest>:1:1
|
1 | \____/
| ^
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:82:9
|
LL | /// \____/
| ^^^^^^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \____/
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|