I've spent the last two days looking at a case where adding an unnecessary
.into() makes the compiler generate more assembly.
I tried putting #[inline(always)] on the two relevant trait impls and it made my code smaller but the case I was looking at earlier still didn't inline.
Today I tried to make a minimal reproduction of it but it is too flaky for that. I am currently at a point where adding a feature flag to Cargo.toml makes it work properly, even if the flag is not used. It also stopped reproducing on stable at some point in the minimization process but continued to work on nightly and my own stage2.
Is this a bug? I thought inline(always) was supposed to force inlining, which should result in no code being generated.
always === "try really hard". It doesn't actually mean always, sadly.
Jake Goulding said:
always=== "try really hard". It doesn't actually mean always, sadly.
ok, that explains it somewhat
But maybe my changes should be merged? At least inlining the trivial case of From is always good. I'm less sure about the Into based on From
I don't see any particular reason not to, so it seems worth opening a PR and getting smarter people than me to look at it.
Ok, will do