You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://github.com/core-error/core-error/blob/335e1da/src/typeinfo.rs#L46 So while testing the crate, I found out that the implementation of TypeInfo using Any bound instead of 'static causes warnings in the downstream crates if they try to use core_error::Error as a trait object. Specifically, it triggers where_clauses_object_safety. The reason to use Any instead of 'static is that rustc versions older than 1.13.0 had a Reflect bound on the TypeId::of function.
The warning is over-eager: our usage is legit, since Any is implemented on every 'static type. But unfortunately, the compiler doesn't see it, and triggers the warning. This wouldn't be a problem if it triggered the warning within core-error, but it triggers it downstream, in each crate that tries to turn to use a &dyn Error.
I temporarily added a quick n dirty patch that changes implementation based on the compiler version, but that's seriously not great. I'm thinking of dropping support of anything older than 1.13.0 in no_std. That release is 3 years old now. If someone needs it, they can open an issue.
EDIT: I removed the workaround and changed MSRV to 1.13.0 when using no-default-feature. Please upvote this issue if you need this crate to work on older versions. Worth noting that the only rust versions affected are 1.6.0 to 1.12.1. Versions older than 1.6.0 didn't support no_std.
The text was updated successfully, but these errors were encountered:
See #11. We'd like to avoid having too many hacks in this crate to
support old outdated versions. There's no reason to believe that anyone
using this crate would be stuck on such an old version of rustc, so
let's just assume nobody is for now.
roblabla
changed the title
Don't trigger where_clauses_object_safety, drop version older than 1.13.0
Find a way to support versions older than 1.13.0
Nov 22, 2019
https://github.com/core-error/core-error/blob/335e1da/src/typeinfo.rs#L46 So while testing the crate, I found out that the implementation of TypeInfo using
Any
bound instead of'static
causes warnings in the downstream crates if they try to usecore_error::Error
as a trait object. Specifically, it triggers where_clauses_object_safety. The reason to useAny
instead of'static
is that rustc versions older than 1.13.0 had aReflect
bound on theTypeId::of
function.The warning is over-eager: our usage is legit, since
Any
is implemented on every'static
type. But unfortunately, the compiler doesn't see it, and triggers the warning. This wouldn't be a problem if it triggered the warning within core-error, but it triggers it downstream, in each crate that tries to turn to use a&dyn Error
.I temporarily added a quick n dirty patch that changes implementation based on the compiler version, but that's seriously not great. I'm thinking of dropping support of anything older than 1.13.0 in no_std. That release is 3 years old now. If someone needs it, they can open an issue.
EDIT: I removed the workaround and changed MSRV to 1.13.0 when using no-default-feature. Please upvote this issue if you need this crate to work on older versions. Worth noting that the only rust versions affected are 1.6.0 to 1.12.1. Versions older than 1.6.0 didn't support no_std.
The text was updated successfully, but these errors were encountered: