Skip to content
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

rustdoc: correct unclosed HTML tags as generics #93569

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unicode slicing bug
  • Loading branch information
notriddle committed Feb 2, 2022
commit 0db9e4067038f3c70eb04e86b1bba5b14b172f47
6 changes: 3 additions & 3 deletions src/librustdoc/passes/html_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn extract_path_backwards(text: &str, end_pos: usize) -> Option<usize> {
use rustc_lexer::{is_id_continue, is_id_start};
let mut current_pos = end_pos;
loop {
if current_pos >= 2 && &text[current_pos - 2..current_pos] == "::" {
if current_pos >= 2 && text[..current_pos].ends_with("::") {
current_pos -= 2;
}
let new_pos = text[..current_pos]
Expand Down Expand Up @@ -217,9 +217,9 @@ impl<'a, 'tcx> DocVisitor for InvalidHtmlTagsLinter<'a, 'tcx> {
let mut diag = lint.build(msg);
// If a tag looks like `<this>`, it might actually be a generic.
// We don't try to detect stuff `<like, this>` because that's not valid HTML,
// and we don' try to detect stuff `<like this>` because that's not valid Rust.
// and we don't try to detect stuff `<like this>` because that's not valid Rust.
if let Some(Some(generics_start)) = (is_open_tag
&& &dox[range.end - 1..range.end] == ">")
&& dox[..range.end].ends_with(">"))
.then(|| extract_path_backwards(&dox, range.start))
{
let generics_sp = match super::source_span_for_markdown_range(
Expand Down