Closed link2xt closed 3 months ago
Okay I looked into this a bit closer, and I'm going to consider this new compilation failure intended behaviour. Before #371 derive_more would put bounds on all the types that were formatted as Debug
. But that was actually causing a problem here: Deriving Debug
would succeed, but there would be a bound there that would always be false. So a Debug
implementation was derived that was never applicable. This was also mentioned in: https://github.com/n0-computer/iroh/pull/2578. A minimal example of this issue is this:
use derive_more::Debug;
struct NoDebug<'a> {
a: &'a f64,
}
#[derive(Debug)]
struct SomeType<'a> {
no_debug: NoDebug<'a>,
}
fn main() {}
This now throws an error. Which seems like good behaviour to me. Because then the user will either also derive Debug
for NoDebug
or they can add #[debug(skip)]
to the no_debug
field of SomeType
. I've created #393 to encode this intentional compilation failure in a compile_fail
test.
Yeah I think I agree with the changes made in #371.
It's unfortunate that a derive_more = "1.0.0-beta.6"
dependency broke our users, but tbh, it's on us for not pinning the version bound (=1.0.0-beta.6
) while it's a beta version.
Our "work around" is honestly how it should've been from the start: We had a bunch of #[derive(Debug)]
on structs that had fields that just didn't have Debug
implemented (without #[debug(skip)]
or the like). I'm glad that leads to errors now instead of working silently (until one wants to use the debug impl).
Change https://github.com/deltachat/deltachat-core-rust/pull/5850 caused problems compiling https://github.com/n0-computer/iroh/
To reproduce, clone https://github.com/n0-computer/iroh/, checkout commit 29d2e82a577ebc8cb4029c0df0138fe662031d5c, go into
iroh-net
folder, runcargo update -p derive_more
(it is pinned to v1.0.0-beta.6 in Cargo.lock) and runcargo check
.Compilation fails with this error:
iroh devs worked around the problem in PR https://github.com/n0-computer/iroh/pull/2578, but this does not look like an actual fix.