diff --git a/crates/compiler/src/compile.rs b/crates/compiler/src/compile.rs index 9263248..475594d 100644 --- a/crates/compiler/src/compile.rs +++ b/crates/compiler/src/compile.rs @@ -49,3 +49,6 @@ //! translation—the benefits of not having to manually perform this additional //! work far outweighs that downside. If we _do_ need any additional control, we //! can always modify this process at a later date. + +#[cfg(test)] +mod test {} diff --git a/crates/rust-test-input/src/lib.rs b/crates/rust-test-input/src/lib.rs index b93cf3f..95b24a4 100644 --- a/crates/rust-test-input/src/lib.rs +++ b/crates/rust-test-input/src/lib.rs @@ -1,14 +1,6 @@ +#![no_std] + +/// Adds two numbers together. pub fn add(left: u64, right: u64) -> u64 { left + right } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/docs/Getting LLVM IR Output.md b/docs/Getting LLVM IR Output.md index efc8fea..793be15 100644 --- a/docs/Getting LLVM IR Output.md +++ b/docs/Getting LLVM IR Output.md @@ -8,9 +8,9 @@ this project. ## Rust `rustc` will emit LLVM IR when passed the `--emit=llvm-ir` flag, and LLVM bytecode when passed the -`--emit=llvm-bc`. This will output `.ll` files into the `target` directory corresponding to your -compiled file. For more information, see the -[`rustc` developer guide](https://rustc-dev-guide.rust-lang.org/backend/debugging.html). +`--emit=llvm-bc`. This will output `.ll` (or `.bc`) files into the `target` directory corresponding +to your compiled file (usually in `build-type/deps/crate-name-hash.ll`). For more information, see +the [`rustc` developer guide](https://rustc-dev-guide.rust-lang.org/backend/debugging.html). - This can be passed to the correct compiler when using cargo by calling `cargo rustc -- --emit=llvm-ir`. diff --git a/flake.nix b/flake.nix index a383321..554a6c8 100644 --- a/flake.nix +++ b/flake.nix @@ -18,15 +18,22 @@ flake-utils.lib.eachDefaultSystem (system: let # We grab our expected rust version from the Cargo.toml. - rustVersion = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.rust-version; + rustVersion = (lib.importTOML ./Cargo.toml).workspace.package.rust-version; # Then we set up our libraries for building this thing. pkgs = nixpkgs.legacyPackages.${system}; inherit (pkgs) lib; fenixLib = fenix.packages.${system}; + toolchainHash = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo="; fenixStable = fenixLib.fromToolchainName { name = rustVersion; - sha256 = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo="; + sha256 = toolchainHash; + }; + + # A target of the same version for our temporary "source" ABI + fenixAarch64 = fenixLib.targets.aarch64-unknown-none-softfloat.toolchainOf { + channel = rustVersion; + sha256 = toolchainHash; }; # As we want nightly Rustfmt, we have to build a custom toolchain. @@ -40,6 +47,7 @@ "rust-std" "rustc" ]) + fenixAarch64.rust-std ]; # The crane library configures the Rust toolchain, along with the components we expect it