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

0.11.0: Parser iterator item no longer implements Borrow? #891

Open
chriskrycho opened this issue May 16, 2024 · 2 comments
Open

0.11.0: Parser iterator item no longer implements Borrow? #891

chriskrycho opened this issue May 16, 2024 · 2 comments

Comments

@chriskrycho
Copy link

chriskrycho commented May 16, 2024

I use pulldown-cmark-to-cmark in a couple places, and it has a signature like so:

pub fn cmark<'a, I, E, F>(events: I, mut formatter: F) -> Result<State<'a>, fmt::Error>
where
    I: Iterator<Item = E>,
    E: Borrow<Event<'a>>,
    F: fmt::Write,
{
    ///
}

This was fine in 0.10.3, but no longer works with 0.11.0, because the item yielded by the iterator apparently no longer implements Borrow<Event<'a>>.

If this was intentional, that seems fine—the library will just need to update to account for the change! If so, would you be so kind as to document it as a breaking change in the release notes? 🙏🏼 (I poked around through the history a little but haven’t yet isolated where the change happened—only spent about five minutes doing that though.)

If it was unintentional, I am happy to help get a commit in so the items implement Borrow once again. (I am not blocked on this—I am just using 0.10.3 for the moment—but I do also have the time to contribute, so let me know!)

@ollpu
Copy link
Collaborator

ollpu commented May 17, 2024

As far as I can see, Borrow<Event> is still implemented for Event.

Is this because pulldown-cmark-to-cmark depends on v0.10.3, but you're trying to provide Events from the new version? If so, the library just needs an update.

I.e. the bound is really E: Borrow<pulldown_cmark{0.10}::Event> and you get a misleading error.

@chriskrycho
Copy link
Author

Ah, interesting. That may well be, in which case the compiler error was (understandably!) misleading. I will patch the library on Monday and see if that is all it is! Thanks!

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

No branches or pull requests

2 participants