3 ms·
One serious issue there is that this would no longer be in libcore.
by steveklabnik 6y ago
One serious issue there is that this would no longer be in libcore.
- masklinn 6y agoCouldn't libcore export the current version and std re-export the aliased version with a default? The prelude lives in and uses std, and I don't see people who want exceptions using no_std anyway.
- steveklabnik 6y agoI was thinking no, but I guess you could do something like https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7c19e5e077d082eaf56061675cc4d887 https://play.rust-lang.org/?version=stable&mode=debug&editio...
- masklinn 6y agoYou'd probably need to use the "default type parameter" feature for the alias otherwise std's Result is a breaking change and you have to use core's result to provide a custom error type, which I think would be a step back. It's what anyhow does: pub type Result<T, E = Error> = core::result::Result<T, E>; That way you can still use `Result<i32, MyCustomError>`. I don't know if there are limitations or issues with this approach though.