User Tools

Site Tools


general:rust

Rust install from tar.gz

  • Unpack rust-1.XX.X-<arch>-unknown-linux-gnu.tar.gz (after checking gpg signature)
  • Run install.sh –prefix=/usr/local/rust –disable-ldconfig (for minimal install –components=rustc,rust-std-armv7-unknown-linux-gnueabihf,cargo)
  • Make symlinks in /usr/local/bin (if not done previously - maybe avoid rls as emacs defaults to that instead of rust-analyzer)
  • Create /etc/ld.so.conf.d/rust.conf contents: /usr/local/rust/lib
  • Run ldconfig
  • Unpack rustc-1.XX.X-src.tar.gz (after checking gpg signature)
  • mkdir -p /usr/local/rust/lib/rustlib/src/rust
  • cp -dR –preserve=timestamps rustc-1.XX.X-src/library/ /usr/local/rust/lib/rustlib/src/rust/

Compiling Rust code with MSVC

  • Start Rust 1.63 (MSVC) Shell for 32-bit or 64-bit
  • Run the following command to setup the MSVC environment

32-bit

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars32.bat"

64-bit

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"

Rust error handling

Use #[non_exhaustive] for error enums to avoid API breaks when just adding a new type of error.

https://www.youtube.com/watch?v=rAF8mLI0naQ&t=1355s

Using C libraries

Rust guides

Rust memory

general/rust.txt · Last modified: 2022/08/26 12:13 by