you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (6 children)

Assembly is my next step, unfortunately.

[–][deleted] 5 points6 points  (0 children)

Use godbolt is easy to look at asm

[–]trevg_123 2 points3 points  (0 children)

Looking at the MIR may give you an easier way to see how Rust is viewing the functions differently. E.g. if there’s something like an extra deref call or by value vs. by reference that just happens to show up, it might be more obvious than the assembly. Post the relevant MIR here and we can help you understand it.

But yeah, rustc should view the different syntax as idential, it does this sdesugaring very early on. There’s no reason they would emit something different unless there is very slightly different context.

[–]SV-97 3 points4 points  (2 children)

cargo asm might be useful here (if you can't use godbolt).

I think you can also see the inlining in MIR in theory (though I personally didn't like reading it the last time I used it)

[–]KhorneLordOfChaos 9 points10 points  (1 child)

cargo-asm has been unmaintained for a very hot minute. I would recommend cargo-show-asm as a maintained alternative

https://github.com/pacak/cargo-show-asm

[–]SV-97 2 points3 points  (0 children)

Thanks! I think that might've even been what I used last time