chumsky icon indicating copy to clipboard operation
chumsky copied to clipboard

make `Rich` compare spans instead of all members for `Eq`

Open alex-s168 opened this issue 7 months ago • 4 comments

from the current code:

#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Rich<'a, T, S = SimpleSpan<usize>> {
    span: S,
    reason: Box<RichReason<'a, T>>,
    context: Vec<(RichPattern<'a, T>, S)>,
}

this is annoying because T might not always implement Eq and PartialEq

for example proc_macro2::TokenTree doesn't

alex-s168 avatar May 29 '25 13:05 alex-s168

actually there is another problem: LabelError needs PartialEq on tokens too...

alex-s168 avatar Jun 01 '25 08:06 alex-s168

Is there something specific you need PartialEq for?

zesterer avatar Jun 01 '25 21:06 zesterer

Is there something specific you need PartialEq for?

No, but LabelError needs PartialEq on tokens

alex-s168 avatar Jun 02 '25 07:06 alex-s168

I am happy to accept a PR for this change!

zesterer avatar Jun 11 '25 09:06 zesterer