mirror of
https://github.com/oxalica/rust-overlay.git
synced 2025-10-05 15:52:54 +02:00
{rust-bin,example}: remove WASI target workaround and fix example
The un-versioned `wasm32-wasi` target is removed in favor of `wasm32-wasip?` since Rust 1.84. Examples are updated. The nixpkgs patch for WASI target name remapping is merged in 24.11. We can also safely remove the workaround.
This commit is contained in:
@@ -27,7 +27,6 @@ in {
|
||||
distRoot = import ./lib/dist-root.nix;
|
||||
} // import ./lib/rust-bin.nix {
|
||||
inherit lib manifests;
|
||||
inherit (final.rust) toRustTarget;
|
||||
inherit (rust-bin) nightly;
|
||||
pkgs = final;
|
||||
};
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# This Makefile is expected to be run inside nix-shell.
|
||||
|
||||
CARGO_FLAGS := --target wasm32-wasi
|
||||
CARGO_FLAGS := --target wasm32-wasip1
|
||||
|
||||
.PHONY: all
|
||||
all: Cargo.toml Cargo.lock src/main.rs
|
||||
|
@@ -2,6 +2,15 @@
|
||||
(import <nixpkgs> {
|
||||
crossSystem = {
|
||||
config = "wasm32-wasi";
|
||||
|
||||
# NB. Rust use a different naming convention for target platforms and
|
||||
# differentiates multiple version of WASI specification by using "wasip?".
|
||||
# If this line is omitted, `wasm32-wasip1` (WASI 0.1) is assumed.
|
||||
# See: <https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html>
|
||||
#
|
||||
# If you changed this, also update `CARGO_TARGET_*_RUNNER` below.
|
||||
rust.rustcTarget = "wasm32-wasip1";
|
||||
|
||||
# Nixpkgs currently only supports LLVM lld linker for wasm32-wasi.
|
||||
useLLVM = true;
|
||||
};
|
||||
@@ -16,7 +25,8 @@ mkShellNoCC {
|
||||
|
||||
# This is optional for wasm32-like targets, since rustc will automatically use
|
||||
# the bundled `lld` for linking.
|
||||
# CARGO_TARGET_WASM32_WASI_LINKER = "${stdenv.cc.targetPrefix}cc";
|
||||
CARGO_TARGET_WASM32_WASI_RUNNER = "wasmtime";
|
||||
# CARGO_TARGET_WASM32_WASIP1_LINKER =
|
||||
|
||||
CARGO_TARGET_WASM32_WASIP1_RUNNER = "wasmtime run";
|
||||
}) {}
|
||||
|
||||
|
@@ -29,7 +29,6 @@
|
||||
pkgs:
|
||||
lib.fix (rust-bin: import ./lib/rust-bin.nix {
|
||||
inherit lib pkgs;
|
||||
inherit (pkgs.rust) toRustTarget;
|
||||
inherit (rust-bin) nightly;
|
||||
manifests = mkManifests distRoot;
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
toRustTarget,
|
||||
manifests,
|
||||
nightly,
|
||||
}:
|
||||
@@ -23,21 +22,15 @@ let
|
||||
(filter (name: set.${name} == null)
|
||||
(attrNames set));
|
||||
|
||||
# FIXME: https://github.com/NixOS/nixpkgs/pull/146274
|
||||
toRustTarget' = platform:
|
||||
if platform.isWasi then
|
||||
"${platform.parsed.cpu.name}-wasi"
|
||||
else
|
||||
platform.rust.rustcTarget or (toRustTarget platform);
|
||||
toRustTarget = platform: platform.rust.rustcTarget;
|
||||
|
||||
# The platform where `rustc` is running.
|
||||
rustHostPlatform = toRustTarget' stdenv.hostPlatform;
|
||||
rustHostPlatform = toRustTarget stdenv.hostPlatform;
|
||||
# The platform of binary which `rustc` produces.
|
||||
rustTargetPlatform = toRustTarget' stdenv.targetPlatform;
|
||||
rustTargetPlatform = toRustTarget stdenv.targetPlatform;
|
||||
|
||||
mkComponentSet = callPackage ./mk-component-set.nix {
|
||||
inherit removeNulls;
|
||||
toRustTarget = toRustTarget';
|
||||
inherit removeNulls toRustTarget;
|
||||
};
|
||||
|
||||
mkAggregated = callPackage ./mk-aggregated.nix {};
|
||||
|
Reference in New Issue
Block a user