I am facing very unusual issue with raspberry pi.
Everything was working fine but until last 3 days code is not compiling in raspberry pi.
I format & fresh install raspbian os with rust(1.79) using rustup from shell.
The issue is when I run cargo build --release after all of the dependencies build when it comes to application build its consuming all the CPU & RAM & Swap & making the RPI hang but RPI not crashing nor the build giving any error but its stuck there for hours.
Make sure you don't have LTO enabled. Maybe even explicitly disable the thinlto that is used by default.
2GB RAM for a "huge project" is very tight, so it's possible that the new compiler or LLVM version started using more RAM, and the Pi is dying a swap death.
Setting up cross-compilation is a hassle, but with a machine that slow, you'll most likely still save time by switching to cross-compilation. Debian x86 to Debian arm is not too hard.