Suppose the compiler would not know that a and b are of the same length. Then it would need to bound check both the iterator over a and b (assuming a certain implementation of zip), right? Otherwise, just one check would be enough.
Note that you're making the compiler's life more difficult here by writing this over Vecs, as well as making your function less general. Write it taking slices instead (since you don't use the ownership in here) and it becomes much more obvious that there's only the panic from the assert, no other checks: https://rust.godbolt.org/z/9bMc7oTxE.
Hey, looks like we both love to think about low level optimizations and how exactly the compiler generates assembly.
Most if not all questions about generated machine code could be answered by the following ways - at least that's how I do it myself.
--
As already mentioned by scotmcm a few things you can answer yourself using godbolt.org
Here is a hotlink to a Rust helloworld snippet with compiler arguments to emulate cargo building for release and also my native CPU.
Adjust as needed.
Keep in mind that, as mentioned before, just looking at what the compiler generates out of context (just a snippet) might not be the same as what the compiler generates for the full project.
Depending on many factors (for example LTO enabled) the compiler will spit out vastly different ASM.
--
Another useful thing to check out could be cargo-show-asm.
I have not used it myself in real world scenario yet, but found it while searching for an answer of a problem in the same vein as yours.
My short test before sending this message was very promising - I think it is a very neat tool which you will value in the future.
From what I know there is/was another crate with a very similar name, which was abandoned - this one is maintained.
--
The only other way you can be 100% sure as to what is generated, is to compile it fully and then let it be analyzed by something like Ghidra.
Hope this is useful for your low level endeavors
--
Edit: I realized the real question of your's was about the WHY it is optimized away - oops.
Will leave this message here since it is still useful and might come in handy to verify your assumptions yourself by modifying your code and retesting.