zesterer / ariadne

A fancy diagnostics & error reporting crate
https://crates.io/crates/ariadne
MIT License
1.79k stars 78 forks source link

feat: Use RPITIT instead of Box<dyn ...> #121

Closed mlgiraud closed 3 weeks ago

mlgiraud commented 4 months ago

Just a small PR to replace Box<dyn ...> with RPITIT, since it is now stable. I believe this is what your todo in the trait was for?

mlgiraud commented 4 months ago

Maybe it would also make sense to return a type that implements the Error trait, instead of something that just implements Debug?

mlgiraud commented 4 months ago

Another question maybe: Why does the fetch function have to take a mutable reference to self? Shouldn't this be an immutable function?

EDIT: This makes it practically impossible to have the parser borrow data from an input cache, and also pass the input cache to the write function for the error report, since this would require a mutable borrow of the input cache, when the input cache is already borrowed read only for the parsed data.

mlgiraud commented 3 weeks ago

@zesterer Any updates on this?

zesterer commented 3 weeks ago

Thanks for the PR. Sorry, it got lost in my notifications. I think this is a positive change, although I'm surprised it's been stable for so long already: I'm used to things like this being nightly-only for a while!