Those config.toml defaults are only accurate with the default “dev” release channel. For stable/beta/nightly, you’ll still get debuginfo and debuginfo-tools = false, but debuginfo-only-std and debuginfo-lines = true. This results in -Cdebuginfo=1 just for std and its dependencies, which shouldn’t be a problem for memory usage.
For Fedora, the usual packaging policy is to build everything with optimization and debuginfo, overriding upstream defaults as needed. The rpm build will then strip those debug sections into separate files for a foo-debuginfo subpackage, so normal users don’t incur any download/storage cost for this. I believe Debian does similar.
Fedora’s package is here: https://src.fedoraproject.org/rpms/rust/tree/master
I also just looked at Debian’s package, and in config.toml they have:
debuginfo = true
debuginfo-lines = true
debuginfo-only-std = false
FWIW, I think the lines setting is redundant when full debuginfo is already enabled. You could look at a verbose build log to see what -Cdebuginfo level is actually used, where 1 is just lines and 2 is full.
And in their rules:
# Work around low-memory (32-bit) architectures: https://github.com/rust-lang/rust/issues/45854
ifneq (,$(filter $(DEB_BUILD_ARCH), armhf armel mips mipsel powerpc powerpcspe))
sed -i -e '/^debuginfo-only-std = /d' "$@"
endif
Having deleted this setting, it should take the default true for stable. The largest culprits like libsyntax_ext and librustc should be without debuginfo in this case.
However, in Debian’s latest mips log, it looks like those two crates are building at the same time. Maybe that’s still too much for the system to bear? Have you tried with ./x.py build -j1?