What to use in swift instead of const references?

BTW, instead of malloc I should have written calloc to get zero initialised memory.

I know it could break in theory, could you provide an example when it breaks in practice?
That's a genuine question, I'd really like to see the difference in asm in godbolt, etc to know this stuff better.