Skip to content

chore(deps): bump annotate-snippets to 0.11.5#6903

Merged
ytmimi merged 1 commit into
rust-lang:mainfrom
shulaoda:05-22-chore_deps_bump_annotate-snippets_to_0.11.5
May 22, 2026
Merged

chore(deps): bump annotate-snippets to 0.11.5#6903
ytmimi merged 1 commit into
rust-lang:mainfrom
shulaoda:05-22-chore_deps_bump_annotate-snippets_to_0.11.5

Conversation

@shulaoda
Copy link
Copy Markdown
Contributor

@shulaoda shulaoda commented May 22, 2026

Summary

Cargo.lock-only bump of annotate-snippets from 0.11.4 to 0.11.5. The Cargo.toml requirement stays at "0.11" (semver-compatible), so no API adaptation and no breaking change. Prerequisite for #6902 to cover the full reproducer in #6850.

Why this is needed

The reproducer in #6850 (a 120-snowman string literal triggering LineOverflow with error_on_unformatted) trips two independent col-vs-byte bugs. The rustfmt-side one is fixed in #6902; the second hides in annotate-snippets 0.11.4 itself, in its long-line truncation path at src/renderer/display_list.rs:351–373:

let mut taken = 0;
let code: String = text.chars().skip(left).take_while(|ch| {
    let next = unicode_width::UnicodeWidthChar::width(*ch).unwrap_or(1);
    if taken + next > right - left { return false; }
    taken += next;          // taken is visual width
    true
}).collect();
if self.margin.was_cut_right(line_len) {
    code[..taken.saturating_sub(3)].fmt(f)?;  // ← taken used as byte index
    "...".fmt(f)?;
}

Same class of bug as the one #6902 fixes on the rustfmt side: taken accumulates unicode_width (visual columns) but code[..taken.saturating_sub(3)] is a byte slice on a UTF-8 String. On multibyte content the boundary falls inside a codepoint and panics with end byte index N is not a char boundary at display_list.rs:369.

Before #6902, the rustfmt-side bug fired first and masked this one. Once #6902 starts feeding annotate-snippets correct byte ranges, the issue's full reproducer hits this upstream panic instead.

annotate-snippets fixed this in 0.11.5 (release notes: Fix unicode handling in margin-based rendering). Because Cargo.toml already declares annotate-snippets = "0.11", the bump is just a cargo update -p annotate-snippetsCargo.lock change only.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label May 22, 2026
@ytmimi
Copy link
Copy Markdown
Contributor

ytmimi commented May 22, 2026

Are there any notable changes from 0.11.4 -> 0.11.5 that would impact formatting?

@ytmimi ytmimi self-assigned this May 22, 2026
@shulaoda
Copy link
Copy Markdown
Contributor Author

Are there any notable changes from 0.11.4 -> 0.11.5 that would impact formatting?

I tested it locally and didn’t notice any notable formatting changes. Realistically, I wouldn’t expect this update to introduce any diffs apart from diagnostics-related changes.

@ytmimi
Copy link
Copy Markdown
Contributor

ytmimi commented May 22, 2026

I think it would be helpful if you added similar context to this PR description about the 0.11.4 annotate_snippet bug that you mentioned in #6902

@ytmimi
Copy link
Copy Markdown
Contributor

ytmimi commented May 22, 2026

Just to be safe I'm running the Diff-Check

@shulaoda
Copy link
Copy Markdown
Contributor Author

I think it would be helpful if you added similar context to this PR description about the 0.11.4 annotate_snippet bug that you mentioned in #6902

done!

@ytmimi ytmimi merged commit 7991944 into rust-lang:main May 22, 2026
26 checks passed
@rustbot rustbot added release-notes Needs an associated changelog entry and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels May 22, 2026
@shulaoda shulaoda deleted the 05-22-chore_deps_bump_annotate-snippets_to_0.11.5 branch May 22, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes Needs an associated changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants