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 version #1739

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
5 changes: 5 additions & 0 deletions examples-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ repository = "https://github.com/0xmozak/mozak-vm"
version = "0.1.0"

[features]
bss-tester = []
empty = []
fibonacci = []
inputtape = []
inputtapebin = []
memory-access = []
min-max = []
mozak-sort = []
Expand All @@ -21,4 +23,7 @@ rkyv-serialization = []
sha2 = []
static-mem-access = []
token = []
# Not sure whether token, tokenbin, wallet and walletbin should all be here, or whether we forget cleaning them up in recent renames?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether token, tokenbin, wallet and walletbin should all be here, or whether we forget cleaning them up in recent renames?

@supragya You recently did some renames / cleanups here. Do you have an opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those should be needed for testing I hope?

tokenbin = []
wallet = []
walletbin = []
47 changes: 20 additions & 27 deletions examples-builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,28 @@ const CRATES: &[Crate] = &[
const CARGO_MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");

fn build_elf(dest: &mut File, crate_path: &str, elf_path: &str, glob_name: &str, uses_std: bool) {
// Use a dummy array for clippy, since not building the elf is faster than
// building the elf
if cfg!(feature = "cargo-clippy") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Daniel-Aaron-Bloom The new version's linter doesn't like this. Do you know whether this ever worked (and perhaps how to repair it)?

writeln!(dest, r#"pub const {glob_name}: &[u8] = &[];"#)
let args = if uses_std {
vec!["build", "--release", "--features=std"]
} else {
let args = if uses_std {
vec!["build", "--release", "--features=std"]
} else {
vec!["build", "--release"]
};
let output = Command::new("cargo")
.args(args)
.current_dir(crate_path)
.env_clear()
.envs(std::env::vars().filter(|x| !x.0.starts_with("CARGO_")))
.output()
.expect("cargo command failed to run");
if !output.status.success() {
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
panic!("cargo build {crate_path} failed.");
}
writeln!(
dest,
r#"pub const {glob_name}: &[u8] =
include_bytes!(r"{CARGO_MANIFEST_DIR}/{elf_path}");"#
)
vec!["build", "--release"]
};
let output = Command::new("cargo")
.args(args)
.current_dir(crate_path)
.env_clear()
.envs(std::env::vars().filter(|x| !x.0.starts_with("CARGO_")))
.output()
.expect("cargo command failed to run");
if !output.status.success() {
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
panic!("cargo build {crate_path} failed.");
}
.expect("failed to write vars.rs");
writeln!(
dest,
r#"pub const {glob_name}: &[u8] =
include_bytes!(r"{CARGO_MANIFEST_DIR}/{elf_path}");"#
).expect("failed to write vars.rs");

println!("cargo:rerun-if-changed={crate_path}");
println!("cargo:rerun-if-changed={elf_path}");
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-04-24"
channel = "nightly-2024-05-27"
components = ["rustfmt", "rust-src", "clippy"]
profile = "minimal"
2 changes: 2 additions & 0 deletions sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![allow(clippy::missing_panics_doc)]
#![feature(trait_alias)]
#![deny(warnings)]
// To allow `target_os = "mozakvm"` cfg on native, when the defining json file ain't available.
#![allow(unexpected_cfgs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "std", feature(restricted_std))]

Expand Down
Loading