unsafe {} literally means "shut up compiler I know what I'm doing and this code doesn't have any UB". In this case you lied to the compiler, there's no guarantee that the compiler will gives you meaningful result back.
When you use unsafe, you're taking on the responsibility of upholding the language invariants and giving up the safety afforded by having the compiler prove them. If you don't uphold them, it's undefined behavior (UB).
When you dereference a raw pointer and turn it into a borrow, rust creates a new lifetime that's detached from any original constraints, so you're able to do anything with it, even without transmute. Even this would compile: