Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust #2761

Merged
merged 33 commits into from
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c69d092
Update rustc, fix some of the warnings
osa1 Sep 1, 2021
41c7a93
Stop using xargo
osa1 Sep 1, 2021
9c0bb84
Fix formatting
osa1 Sep 1, 2021
655d5e3
More syntactic noise to work around unaligned ref warnings
osa1 Sep 2, 2021
64ee19d
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Sep 10, 2021
e131e61
Revert "More syntactic noise to work around unaligned ref warnings"
osa1 Sep 10, 2021
5aa4d24
Revert more changes
osa1 Sep 10, 2021
6b1bee6
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Oct 2, 2021
be1eb43
WIP: Start manually vendoring deps
osa1 Oct 4, 2021
72b936a
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Oct 7, 2021
c1cd9cd
Generate package checksums of vendored packages
osa1 Oct 7, 2021
2daa267
Remove custom vendoring, will be copying an existing solution
osa1 Oct 26, 2021
2b5008a
Copy existing solution for vendoring compiler deps
osa1 Oct 26, 2021
84ebcec
Fixups
osa1 Oct 26, 2021
8c51912
Fixups
osa1 Oct 26, 2021
ce28765
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Oct 26, 2021
ee50ae3
Remove unused script
osa1 Oct 26, 2021
b9a8632
Revert "Remove unused script"
osa1 Oct 26, 2021
890b363
Bump rustc again
osa1 Oct 26, 2021
545f735
Add libiconv as dep on Darwin
osa1 Oct 26, 2021
229bbce
Remove unused script?
osa1 Oct 29, 2021
80ce43f
Remove copied scripts, implement in Rust
osa1 Oct 30, 2021
74bf016
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Oct 30, 2021
cefe4dc
Update rts/README.md
osa1 Oct 30, 2021
2aa4eaa
Update rts/README.md
osa1 Oct 30, 2021
bac4043
Revert accidental change
osa1 Oct 30, 2021
1bc1eee
Revert more changes to keep diff as small as possible
osa1 Oct 30, 2021
570bf88
Remove redundant .gitignore
osa1 Oct 30, 2021
2d8e01d
Update cargo-vendor-tools authors
osa1 Oct 30, 2021
91096be
Minor rewording in vendor-rust-std-deps help
osa1 Oct 30, 2021
3bae8cf
More comments
osa1 Oct 30, 2021
9fc26e7
Merge remote-tracking branch 'origin/master' into osa1/update_rustc
osa1 Oct 30, 2021
7a56781
Remove commented-out deps, redundant nix functions, unused dep
osa1 Oct 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ let
llvmPackages_12.bintools
rustc-nightly
cargo-nightly
xargo
wasmtime
rust-bindgen
rustfmt
Expand Down Expand Up @@ -173,7 +172,6 @@ rec {
buildInputs = rtsBuildInputs;

preBuild = ''
export XARGO_HOME=$PWD/xargo-home
export CARGO_HOME=$PWD/cargo-home

# this replicates logic from nixpkgs’ pkgs/build-support/rust/default.nix
Expand Down Expand Up @@ -441,7 +439,6 @@ rec {

filecheck = nixpkgs.linkFarm "FileCheck"
[ { name = "bin/FileCheck"; path = "${nixpkgs.llvm}/bin/FileCheck";} ];
inherit (nixpkgs) xargo;

# gitMinimal is used by nix/gitSource.nix; building it here warms the nix cache
inherit (nixpkgs) gitMinimal;
Expand Down
3 changes: 1 addition & 2 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let
# Rust nightly
(self: super: let
moz_overlay = import self.sources.nixpkgs-mozilla self super;
rust-channel = moz_overlay.rustChannelOf { date = "2020-07-22"; channel = "nightly"; };
rust-channel = moz_overlay.rustChannelOf { date = "2021-08-29"; channel = "nightly"; };
in rec {
rustc-nightly = rust-channel.rust.override {
targets = [
Expand All @@ -67,7 +67,6 @@ let
rustc = rustc-nightly;
cargo = cargo-nightly;
};
xargo = self.callPackage ./xargo.nix {};
})

# wasm-profiler
Expand Down
31 changes: 0 additions & 31 deletions nix/xargo.nix

This file was deleted.

5 changes: 2 additions & 3 deletions rts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ $(TOMMATH_BINDINGS_RS): | _build


$(RTS_RUST_WASM_A): $(TOMMATH_BINDINGS_RS) $(RTS_RUST_FILES) $(RTS_CARGO_FILES) | _build/wasm
cd motoko-rts && xargo build --release --target=wasm32-unknown-emscripten
cd motoko-rts && cargo build --release --target=wasm32-unknown-emscripten -Zbuild-std=core,alloc
cp motoko-rts/target/wasm32-unknown-emscripten/release/libmotoko_rts.a $@

$(RTS_RUST_DEBUG_WASM_A): $(TOMMATH_BINDINGS_RS) $(RTS_RUST_FILES) $(RTS_CARGO_FILES) | _build/wasm
cd motoko-rts && xargo build --target=wasm32-unknown-emscripten
cd motoko-rts && cargo build --target=wasm32-unknown-emscripten -Zbuild-std=core,alloc
cp motoko-rts/target/wasm32-unknown-emscripten/debug/libmotoko_rts.a $@

#
Expand Down Expand Up @@ -268,5 +268,4 @@ clean:
mo-rts-debug.wasm \
motoko-rts/target \
motoko-rts-tests/target \
motoko-rts/xargo-home \
motoko-rts/cargo-home
9 changes: 3 additions & 6 deletions rts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ See `motoko-rts/src/bigint.rs` for the technical details.
Rust build
----------

The Rust parts are built from `motoko-rts`, using `xargo` and `cargo`.
The Rust parts are built from `motoko-rts`, using `cargo`.

To build this in nix, we need pre-fetch some dependencies (currently
`compiler_builtins` and `libc`). This works in `nix-build` by:

* Adding`compiler_builtins` as a dependency in `Cargo.toml` (even though not
needed), so that it shows up with a hash in `Cargo.lock`
To build this in nix, we need pre-fetch some dependencies (currently `libc`).
This works in `nix-build` by:

* Building a directory with vendored sources in `default.nix` (see `rustDeps`)

Expand Down
9 changes: 2 additions & 7 deletions rts/motoko-rts-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rts/motoko-rts-tests/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(ptr_offset_from, map_first_last, clamp)]
#![feature(map_first_last)]

mod bigint;
mod bitmap;
Expand Down
7 changes: 1 addition & 6 deletions rts/motoko-rts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions rts/motoko-rts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ libc = { version = "0.2.81", default_features = false }
motoko-rts-macros = { path = "../motoko-rts-macros" }
static_assertions = "1.1.0"

# Added here so that it ends up in Cargo.lock, so that nix will pre-fetch it
[dependencies.compiler_builtins]
version = "0.1.39"
# Without this feature we get dozens of duplicate symbol errors when generating
# the final shared .wasm file:
#
# wasm-ld: error: duplicate symbol: __multi3
# >>> defined in _build/wasm/libmotoko_rts.a(compiler_builtins-d709bd899857aa61.compiler_builtins.3abndchk-cgu.0.rcgu.o)
# >>> defined in _build/wasm/libmotoko_rts.a(compiler_builtins-06d1ead628e1f468.compiler_builtins.6moz1ltd-cgu.0.rcgu.o)
#
# It seems like we're linking multiple versions of compiler_builtins in the same
# shared library, which we should fix at some point. TODO
features = ["mangled-names"]

[profile.dev]
panic = "abort"

Expand Down
6 changes: 0 additions & 6 deletions rts/motoko-rts/Xargo.toml

This file was deleted.

4 changes: 0 additions & 4 deletions rts/motoko-rts/native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ libc = { version = "0.2.73", default_features = false }
motoko-rts-macros = { path = "../../motoko-rts-macros" }
static_assertions = "1.1.0"

[dependencies.compiler_builtins]
version = "0.1.39"
features = ["mangled-names"]

[profile.dev]
panic = "abort"

Expand Down
8 changes: 1 addition & 7 deletions rts/motoko-rts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

#![no_std]
// TODO (osa): Some of these are stabilized, we need to update rustc
#![feature(
arbitrary_self_types,
assoc_char_funcs,
core_intrinsics,
panic_info_message,
ptr_offset_from
)]
#![feature(arbitrary_self_types, core_intrinsics, panic_info_message)]

#[macro_use]
mod print;
Expand Down