Stream: t-lang

Topic: str / String impling Error


Jane Lusby (Apr 30 2020 at 14:09, on Zulip):

disclaimer: not advocating for this

Jane Lusby (Apr 30 2020 at 14:09, on Zulip):

but is there any technical reason why &str and/or String don't impl std::error::Error?

Jane Lusby (Apr 30 2020 at 14:09, on Zulip):

I know that they can be converted to Box<dyn Error> but that's really not the same thing

Jane Lusby (Apr 30 2020 at 14:10, on Zulip):

you cant use them as a source or coerce them to &dyn Errors

Jane Lusby (Apr 30 2020 at 14:11, on Zulip):

Someone asked me recently and the only things I could think of were "Maybe lifetimes maybe coherence maybe it's just too spooky"

kennytm (Apr 30 2020 at 14:20, on Zulip):

the reason for String: !Error is purely philosophical, not technical. https://github.com/rust-lang/rust/pull/23979#issuecomment-89079584

Jane Lusby (Apr 30 2020 at 14:43, on Zulip):

Makes sense, I imagine using Result<String, String> would be rather error prone

Last update: Jun 05 2020 at 23:10UTC