Rust is not clean programming language:
[kreyren@leonid:~]$ cat shell.nix
# NixOS shell configuration to bootstrap the required dependencies
# NOTE(Krey): Uses mozilla's overlay, because nix's upstream is slow
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
with nixpkgs;
stdenv.mkDerivation {
name = "moz_overlay_shell";
buildInputs = [
# NOTE(Krey): Using nightly for 2021 edition
nixpkgs.latest.rustChannels.nightly.rust
];
}
[nix-shell:/tmp]$ cd dirty-rust/
[nix-shell:/tmp/dirty-rust]$ for file in hello1.rs hello2.rs; do printf '%s\n' 'fn main() { println!("Hello, World!"); }' > "$file" && rustc "$file"; done
[nix-shell:/tmp/dirty-rust]$ sha256sum hello{1,2}
469e4a490b1e51356e8c23a3d3bfe72e9feb5cbef895c21f7add5b38ab95efcb hello1
df0f08665258fc13c21e8b2ae28481d1c98aada9fc5920bb2d321bd307a9f3de hello
[kreyren@leonid:/tmp/dirty-rust]$ nix-shell -p diffoscope --run "diffoscope hello{1,2}"
https://gist.githubusercontent.com/Kreyren/66b7acf1332a54960e1b3c1e1ce41b72/raw/d8924bb1197cc9d8922e01b9b17d28b8725995e2/gistfile1.txt
Which makes it unsuitable for mission critical development.
Context
I am trying to define a framework for modular software development on rustlang by defining Kconfig-like handling for feature-gates that are reading a source-independent file governed by a written standard, but the rustc
is making it impossible to develop a test for bit-by-bit cleaness to ensure that the feature gates are not included in assuming it being designed for mission-critical environment (aviation) to avoid random software failure by the feature gate influencing the runtime e.g. airspeed indicator to cause a low altitude aerodynamic stall in the worst case scenario in fly-by-wire aircraft.
Relevant: https://github.com/reitermarkus/cargo-eval/issues/4#issuecomment-899104493