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 toolchain to 1.73 #4434

Merged
merged 10 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/cross-linux-riscv64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN apt-get update && \
# install rust tools
RUN curl --proto "=https" --tlsv1.2 --retry 3 -sSfL https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup -v toolchain install 1.70
RUN rustup -v toolchain install 1.73
# add docker the manual way
COPY install_docker.sh /
RUN /install_docker.sh
Expand Down Expand Up @@ -61,7 +61,7 @@ ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/riscv64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"

RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.70-x86_64-unknown-linux-gnu
RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.73-x86_64-unknown-linux-gnu

#compile libssl-dev for riscv64!
COPY build_openssl.sh /
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.70"
MSRV: "1.73"

jobs:
run_benchmark:
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Builds
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.70"
MSRV: "1.73"

on:
push:
Expand Down Expand Up @@ -98,11 +98,6 @@ jobs:
with:
toolchain: ${{ env.MSRV }}
target: ${{ matrix.target }}
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2023-05-25"
target: ${{ matrix.metadata.target }}
- uses: Swatinem/rust-cache@v2
if: matrix.use_sccache != true
- name: Install LLVM (macOS Apple Silicon)
Expand Down Expand Up @@ -226,7 +221,6 @@ jobs:
- name: Install Nightly Rust for Headless
uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2023-05-25"
target: ${{ matrix.target }}
components: "rust-src"
- name: Build Minimal Wasmer Headless
Expand All @@ -244,7 +238,6 @@ jobs:
echo "incremental = false" >> Cargo.toml
echo "codegen-units = 1" >> Cargo.toml
echo "rpath = false" >> Cargo.toml
rustup override set nightly-2023-05-25
make build-wasmer-headless-minimal
rustup override unset
- name: Dist
Expand Down Expand Up @@ -278,11 +271,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
target: x86_64-pc-windows-gnu
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2023-05-25"
target: x86_64-pc-windows-gnu
- name: Install Windows-GNU target
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cloudcompiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release cloudcompiler.wasm

env:
RUST_BACKTRACE: 1
MSRV: "1.70"
MSRV: "1.73"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'lib/**'

env:
MSRV: "1.70"
MSRV: "1.73"

jobs:
documentation:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
# Rust, but it's not stable on 1.69 yet. By explicitly setting the protocol we
# can override that behaviour
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.70"
MSRV: "1.73"
NEXTEST_PROFILE: "ci"

jobs:
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2023-05-25"
toolchain: "nightly-2023-10-05"
target: x86_64-unknown-linux-gnu
- run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs`
- name: make test-build-docs-rs-ci
Expand Down Expand Up @@ -369,11 +369,6 @@ jobs:
with:
toolchain: ${{ env.MSRV }}
target: ${{ matrix.metadata.target }}
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly-2023-05-25"
target: ${{ matrix.metadata.target }}
- name: Install Nextest
uses: taiki-e/install-action@nextest
- name: Install Windows-GNU linker
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ edition = "2021"
homepage = "https://wasmer.io/"
license = "MIT"
repository = "https://github.com/wasmerio/wasmer"
rust-version = "1.70"
rust-version = "1.73"
version = "4.2.5"

[workspace.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,10 @@ test-build-docs-rs-ci:
fi; \
printf "*** Building doc for package with manifest $$manifest_path ***\n\n"; \
if [ -z "$$features" ]; then \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly-2023-05-25 doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --no-deps --locked || exit 1; \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly-2023-10-05 doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --no-deps --locked || exit 1; \
else \
printf "Following features are inferred from Cargo.toml: $$features\n\n\n"; \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly-2023-05-25 doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --no-deps --features "$$features" --locked || exit 1; \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly-2023-10-05 doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --no-deps --features "$$features" --locked || exit 1; \
fi; \
done

Expand Down
5 changes: 1 addition & 4 deletions lib/api/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,7 @@ unsafe impl<T: ValueType, M: MemorySize> ValueType for WasmPtr<T, M> {

impl<T: ValueType, M: MemorySize> Clone for WasmPtr<T, M> {
fn clone(&self) -> Self {
Self {
offset: self.offset,
_phantom: PhantomData,
}
*self
}
}

Expand Down
50 changes: 22 additions & 28 deletions lib/api/src/sys/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,35 @@ pub use wasmer_compiler::{
use wasmer_types::Features;
use wasmer_types::{DeserializeError, Target};

/// Returns the default engine for the Sys engine
pub(crate) fn default_engine() -> Engine {
// We store them on a function that returns to make
// sure this function doesn't emit a compile error even if
// more than one compiler is enabled.
#[allow(unreachable_code)]
#[cfg(any(feature = "cranelift", feature = "llvm", feature = "singlepass"))]
fn get_config() -> impl wasmer_compiler::CompilerConfig + 'static {
cfg_if::cfg_if! {
if #[cfg(feature = "cranelift")] {
wasmer_compiler_cranelift::Cranelift::default()
} else if #[cfg(feature = "llvm")] {
wasmer_compiler_llvm::LLVM::default()
} else if #[cfg(feature = "singlepass")] {
wasmer_compiler_singlepass::Singlepass::default()
} else {
compile_error!("No default compiler chosen")
}
/// Get the default config for the sys Engine
#[allow(unreachable_code)]
pub fn get_default_compiler_config() -> Option<Box<dyn wasmer_compiler::CompilerConfig>> {
cfg_if::cfg_if! {
if #[cfg(feature = "cranelift")] {
Some(Box::<wasmer_compiler_cranelift::Cranelift>::default())
} else if #[cfg(feature = "llvm")] {
Some(Box::<wasmer_compiler_llvm::LLVM>::default())
} else if #[cfg(feature = "singlepass")] {
Some(Box::<wasmer_compiler_singlepass::Singlepass>::default())
}
else {
None
}
}
}

/// Returns the default engine for the Sys engine
pub(crate) fn default_engine() -> Engine {
#[allow(unreachable_code, unused_mut)]
fn get_engine() -> Engine {
cfg_if::cfg_if! {
if #[cfg(feature = "compiler")] {
cfg_if::cfg_if! {
if #[cfg(any(feature = "cranelift", feature = "llvm", feature = "singlepass"))]
{
let config = get_config();
EngineBuilder::new(Box::new(config) as Box<dyn wasmer_compiler::CompilerConfig>)
.engine()
} else {
EngineBuilder::headless()
.engine()
}
if let Some(config) = get_default_compiler_config() {
EngineBuilder::new(config)
.engine()
} else {
EngineBuilder::headless()
.engine()
}
} else {
EngineBuilder::headless().engine()
Expand Down
1 change: 0 additions & 1 deletion lib/api/src/sys/externals/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ impl Table {
"cross-`Store` table copies are not supported",
));
}
let store = store;
if dst_table.handle.internal_handle() == src_table.handle.internal_handle() {
let table = dst_table.handle.get_mut(store.objects_mut());
table.copy_within(dst_index, src_index, len)
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub(crate) mod module;
pub(super) mod tunables;
pub(crate) mod typed_function;

pub use crate::sys::engine::NativeEngineExt;
pub use crate::sys::engine::{get_default_compiler_config, NativeEngineExt};
pub use crate::sys::tunables::BaseTunables;
#[cfg(feature = "compiler")]
pub use wasmer_compiler::{
Expand Down
6 changes: 3 additions & 3 deletions lib/c-api/src/wasm_c_api/store.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::engine::wasm_engine_t;
use std::cell::UnsafeCell;
use std::sync::Arc;
use std::rc::Rc;
use wasmer_api::{AsStoreMut, AsStoreRef, Store, StoreMut, StoreRef as BaseStoreRef};

#[derive(Clone)]
pub struct StoreRef {
inner: Arc<UnsafeCell<Store>>,
theduke marked this conversation as resolved.
Show resolved Hide resolved
inner: Rc<UnsafeCell<Store>>,
}

impl StoreRef {
Expand Down Expand Up @@ -38,7 +38,7 @@ pub unsafe extern "C" fn wasm_store_new(

Some(Box::new(wasm_store_t {
inner: StoreRef {
inner: Arc::new(UnsafeCell::new(store)),
inner: Rc::new(UnsafeCell::new(store)),
},
}))
}
Expand Down
10 changes: 4 additions & 6 deletions lib/cli/src/commands/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl PrefixMapCompilation {

fn split_prefix(s: &str) -> Vec<String> {
let regex =
regex::Regex::new(r#"^([a-zA-Z0-9\-_]+)(:([a-zA-Z0-9\.\-_]+))?(:(.+*))?"#).unwrap();
regex::Regex::new(r"^([a-zA-Z0-9\-_]+)(:([a-zA-Z0-9\.\-_]+))?(:(.+*))?").unwrap();
let mut captures = regex
.captures(s.trim())
.map(|c| {
Expand Down Expand Up @@ -1480,11 +1480,9 @@ fn generate_wasmer_main_c(
.iter()
.map(|v| utils::normalize_atom_name(&v.name).to_uppercase())
.map(|uppercase| {
vec![
format!("extern size_t {uppercase}_LENGTH asm(\"{uppercase}_LENGTH\");"),
format!("extern char {uppercase}_DATA asm(\"{uppercase}_DATA\");"),
]
.join("\r\n")
format!(
"extern size_t {uppercase}_LENGTH asm(\"{uppercase}_LENGTH\");\r\nextern char {uppercase}_DATA asm(\"{uppercase}_DATA\");"
)
})
.collect::<Vec<_>>();

Expand Down
2 changes: 1 addition & 1 deletion lib/cli/src/commands/run/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ impl Wasi {
}

if !self.no_tty {
let tty = Arc::new(SysTty::default());
let tty = Arc::new(SysTty);
tty.reset();
rt.set_tty(tty);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl ToString for CompilerType {
}
}

#[cfg(all(feature = "compiler"))]
#[cfg(feature = "compiler")]
impl StoreOptions {
/// Gets the store for the host target, with the compiler name selected
pub fn get_store(&self) -> Result<(Store, CompilerType)> {
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler-singlepass/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2998,7 +2998,7 @@ impl<'a, M: Machine> FuncGen<'a, M> {
self.release_locations_value(stack_depth)?;
self.value_stack.truncate(stack_depth);
self.fp_stack.truncate(fp_depth);
let mut frame = &mut self.control_stack.last_mut().unwrap();
let frame = &mut self.control_stack.last_mut().unwrap();

match frame.if_else {
IfElseState::If(label) => {
Expand Down
Loading
Loading