You can download the
rust-src package here (adjust the version number to match the version of Rust you are using): https://static.rust-lang.org/dist/rust-src-1.50.0.tar.gz
That archive contains a
rust-src/lib/rustlib/src directory. You should move the
src directory into the
lib/rustlib directory where your Rust toolchain is installed.
cargo-xbuild has no pre-compiled binaries available for download, so I think the easiest solution is to compile it yourself on a machine with working Cargo/rustup, and then copy it to the machine where you want to run it. Or, if you use a nightly build of Rust, you can use Cargo's
build-std feature instead of
cargo-xbuild relies on Cargo, so you may still run into trouble if you need to use external crates and Cargo cannot download them.
rustfmt-preview component has been renamed to
rustfmt in recent versions of Rust. It can be downloaded from
static.rust-lang.org, but the exact URL depends on your platform and Rust version. This component should not be required for building a kernel module, however. It's just a tool for formatting your source code to match a standard style guide.