Skip to content

Conversation

@Zollerboy1
Copy link
Contributor

This PR changes the lifetime returned from DefaultExpected::into_owned to be generic.

This follows the pattern of other into_owned methods in the crate, like RichPattern::into_owned or RichReason::into_owned.

The current implementation has a fixed 'static lifetime return, which doesn't work for me because I have tokens with a non-static lifetime.
My current workaround is to reimplement into_owned, which is awkward because of DefaultExpected's #[non_exhaustive]-ness:

match e {
    DefaultExpected::Token(t) => DefaultExpected::Token(t.into_owned()),
    DefaultExpected::Any => DefaultExpected::Any,
    DefaultExpected::SomethingElse => DefaultExpected::SomethingElse,
    DefaultExpected::EndOfInput => DefaultExpected::EndOfInput,
    _ => panic!("Unexpected expected kind"),
}

@zesterer
Copy link
Owner

zesterer commented Feb 5, 2026

Thanks, nice catch!

@zesterer zesterer merged commit 639f586 into zesterer:main Feb 5, 2026
4 checks passed
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.

2 participants