Skip to content

Update annotate-snippets#6391

Merged
ytmimi merged 1 commit into
rust-lang:masterfrom
clubby789:annotate-snippets-bump
Jan 15, 2025
Merged

Update annotate-snippets#6391
ytmimi merged 1 commit into
rust-lang:masterfrom
clubby789:annotate-snippets-bump

Conversation

@clubby789

Copy link
Copy Markdown
Contributor

This will allow rust-lang/rust to eliminate a duplicate dependency on two different versions of annotate-snippets. Extracted from #6366

@ytmimi

ytmimi commented Nov 10, 2024

Copy link
Copy Markdown
Contributor

@clubby789 Can you provide an example of what the error output looks like before and after this change?

@clubby789

Copy link
Copy Markdown
Contributor Author

Checking with the deprecated attr warning, there seems to be no difference in output
image
image

@ytmimi ytmimi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming that!

@ytmimi

ytmimi commented Nov 12, 2024

Copy link
Copy Markdown
Contributor

Taking a look at the changelog, these breaking changes stick out to me: Specifically Switched from char spans to byte spans #90, as I'm certain it was the mismatch between bytes and chars that #6084 was trying to fix.

To the best of my knowledge rustfmt has always used byte offsets so before merging I want to test to see if bumping our annotate-snippets dependency fixes anything else.

@ytmimi ytmimi added pr-ready-to-merge Status: PR is largely ready for merge, waiting for secondary review / last nits release-notes Needs an associated changelog entry and removed pr-not-reviewed labels Nov 12, 2024
@klensy

klensy commented Jan 5, 2025

Copy link
Copy Markdown
Contributor

cc me on old bump #6018

Co-authored-by: printfn <printfn@users.noreply.github.com>
@ytmimi ytmimi force-pushed the annotate-snippets-bump branch from 845edb9 to 131cc27 Compare January 15, 2025 00:54
@ytmimi

ytmimi commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

I did some testing. This doesn't solve all the annotate-snippets issues, but it solved some. For example, this input from #5888. I don't think we're any worse off by upgrading to annotate-snippets=v0.11, so let's move forward with this. Thanks again for bumping this dependency.

pub(crate) fn sanity_needs_ocr<T: HasWord + HasRect>(collection: &[T]) -> bool {
    let needs_ocr = collection.is_empty()
    // the presence of 'UNICODE REPLACEMENT CHARACTER'
    || collection.iter().any(|c| c.text().contains('�'))  
    // (yes, empty pages will also be OCR'd)
    || collection_is_void_of_text(collection)
    || is_gibberish(&collection.to_rendered_text());

    #[cfg(debug_assertions)]
    if needs_ocr {
        tracing::trace!(
            "sanity check failed, with text: {:?}",
            collection.to_rendered_text()
        );
    }

    needs_ocr
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants