diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3077f44..edab9a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 with: path: app - - uses: dtolnay/rust-toolchain@1.94.1 + - uses: dtolnay/rust-toolchain@1.96.1 with: components: clippy, rustfmt - name: Format @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v4 with: path: app - - uses: dtolnay/rust-toolchain@1.94.1 + - uses: dtolnay/rust-toolchain@1.96.1 with: components: llvm-tools-preview targets: riscv32imc-unknown-none-elf,riscv32imafc-unknown-none-elf diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b506f7..c470134 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 with: path: app - - uses: dtolnay/rust-toolchain@1.94.1 + - uses: dtolnay/rust-toolchain@1.96.1 with: components: llvm-tools-preview targets: riscv32imc-unknown-none-elf,riscv32imafc-unknown-none-elf diff --git a/Cargo.lock b/Cargo.lock index c8f5885..d097ab2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,7 +129,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pd-host-function" version = "0.1.0" -source = "git+https://github.com/rustscript-lang/rustscript.git?rev=b1d6cffede77f49410bf63525f30b9a46b02dc01#b1d6cffede77f49410bf63525f30b9a46b02dc01" +source = "git+https://github.com/rustscript-lang/rustscript.git?rev=fc8b0c8179640a8ffe460a64b3690e35c2f7eb73#fc8b0c8179640a8ffe460a64b3690e35c2f7eb73" dependencies = [ "pd-host-schema", "proc-macro2", @@ -140,7 +140,7 @@ dependencies = [ [[package]] name = "pd-host-schema" version = "0.1.0" -source = "git+https://github.com/rustscript-lang/rustscript.git?rev=b1d6cffede77f49410bf63525f30b9a46b02dc01#b1d6cffede77f49410bf63525f30b9a46b02dc01" +source = "git+https://github.com/rustscript-lang/rustscript.git?rev=fc8b0c8179640a8ffe460a64b3690e35c2f7eb73#fc8b0c8179640a8ffe460a64b3690e35c2f7eb73" dependencies = [ "proc-macro2", "syn", @@ -149,7 +149,7 @@ dependencies = [ [[package]] name = "pd-vm" version = "0.1.0" -source = "git+https://github.com/rustscript-lang/rustscript.git?rev=b1d6cffede77f49410bf63525f30b9a46b02dc01#b1d6cffede77f49410bf63525f30b9a46b02dc01" +source = "git+https://github.com/rustscript-lang/rustscript.git?rev=fc8b0c8179640a8ffe460a64b3690e35c2f7eb73#fc8b0c8179640a8ffe460a64b3690e35c2f7eb73" dependencies = [ "base64", "futures-channel", @@ -169,7 +169,7 @@ dependencies = [ [[package]] name = "pd-vm-nostd" version = "0.1.0" -source = "git+https://github.com/rustscript-lang/rustscript.git?rev=b1d6cffede77f49410bf63525f30b9a46b02dc01#b1d6cffede77f49410bf63525f30b9a46b02dc01" +source = "git+https://github.com/rustscript-lang/rustscript.git?rev=fc8b0c8179640a8ffe460a64b3690e35c2f7eb73#fc8b0c8179640a8ffe460a64b3690e35c2f7eb73" [[package]] name = "proc-macro2" diff --git a/Cargo.toml b/Cargo.toml index 86ae08a..d2bd335 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,9 +30,9 @@ wifi = [] bluetooth = [] [dependencies] -pd_vm_nostd = { package = "pd-vm-nostd", git = "https://github.com/rustscript-lang/rustscript.git", rev = "b1d6cffede77f49410bf63525f30b9a46b02dc01", version = "0.1.0", optional = true } +pd_vm_nostd = { package = "pd-vm-nostd", git = "https://github.com/rustscript-lang/rustscript.git", rev = "fc8b0c8179640a8ffe460a64b3690e35c2f7eb73", version = "0.1.0", optional = true } serialport = { version = "4.8.1", default-features = false, optional = true } -vm = { package = "pd-vm", git = "https://github.com/rustscript-lang/rustscript.git", rev = "b1d6cffede77f49410bf63525f30b9a46b02dc01", version = "0.1.0", default-features = false, optional = true } +vm = { package = "pd-vm", git = "https://github.com/rustscript-lang/rustscript.git", rev = "fc8b0c8179640a8ffe460a64b3690e35c2f7eb73", version = "0.1.0", default-features = false, optional = true } [profile.release] opt-level = "z" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 76b0081..dda72db 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.94" +channel = "1.96" profile = "minimal" components = ["clippy", "llvm-tools-preview", "rustfmt"] targets = ["riscv32imc-unknown-none-elf", "riscv32imafc-unknown-none-elf"] diff --git a/src/repl_client.rs b/src/repl_client.rs index e58485c..8af8110 100644 --- a/src/repl_client.rs +++ b/src/repl_client.rs @@ -774,7 +774,10 @@ mod tests { let mut session = SerialReplSession::new(); let mut transport = VmTransport::default(); session - .eval("let text: string? = \"hello\";", &mut transport) + .eval( + "let text: Option = Option::Some(\"hello\");", + &mut transport, + ) .unwrap(); session.eval("let other = text;", &mut transport).unwrap(); let calls = transport.calls; diff --git a/tests/ffi.rs b/tests/ffi.rs index 94e3243..94ad17d 100644 --- a/tests/ffi.rs +++ b/tests/ffi.rs @@ -352,7 +352,10 @@ fn stateful_repl_rejects_moved_optional_string_before_transport() { board: BoardState::default(), }; session - .eval("let text: string? = \"hello\";", &mut transport) + .eval( + "let text: Option = Option::Some(\"hello\");", + &mut transport, + ) .unwrap(); session.eval("let other = text;", &mut transport).unwrap(); assert!(session.eval("text", &mut transport).is_err()); diff --git a/tests/frozen_core_consumer.rs b/tests/frozen_core_consumer.rs index 8219753..570d8f5 100644 --- a/tests/frozen_core_consumer.rs +++ b/tests/frozen_core_consumer.rs @@ -9,7 +9,7 @@ use std::process::Command; use rustscript_embedded::{RunOutcome, run_source_file}; use vm::{compile_source_file, decode_program, encode_program}; -const FROZEN_RUSTSCRIPT_REV: &str = "b1d6cffede77f49410bf63525f30b9a46b02dc01"; +const FROZEN_RUSTSCRIPT_REV: &str = "fc8b0c8179640a8ffe460a64b3690e35c2f7eb73"; const RUSTSCRIPT_GIT: &str = "https://github.com/rustscript-lang/rustscript.git"; const EXPECTED_BUNDLED_RSS: usize = 4; const REQUIRED_LOCK_PACKAGES: &[&str] = @@ -74,6 +74,13 @@ fn rustscript_lock_source() -> String { format!("git+{RUSTSCRIPT_GIT}?rev={FROZEN_RUSTSCRIPT_REV}#{FROZEN_RUSTSCRIPT_REV}") } +/// The VMBC header stores magic then the wire version; bumping the encoded +/// version guarantees an unsupported version whichever one `encode_program` +/// currently emits. +fn unsupported_wire_version(bytes: &[u8]) -> u16 { + u16::from_le_bytes([bytes[4], bytes[5]]).wrapping_add(1) +} + fn collect_files(dir: &Path, out: &mut Vec) { for entry in fs::read_dir(dir).unwrap_or_else(|error| panic!("read {}: {error}", dir.display())) { @@ -364,7 +371,7 @@ fn vmbc_guest_sections_parse_or_reject_and_host_state_stays_off_the_wire() { } let mut unsupported = bytes.clone(); - unsupported[4..6].copy_from_slice(&14u16.to_le_bytes()); + unsupported[4..6].copy_from_slice(&unsupported_wire_version(&bytes).to_le_bytes()); decode_program(&unsupported).expect_err("unsupported VMBC version must reject"); let mut trailing = bytes.clone(); @@ -394,7 +401,7 @@ mod nostd_wire { } let mut unsupported = bytes.clone(); - unsupported[4..6].copy_from_slice(&14u16.to_le_bytes()); + unsupported[4..6].copy_from_slice(&unsupported_wire_version(&bytes).to_le_bytes()); decode_nostd(&unsupported).expect_err("no_std decoder must reject unsupported version"); let mut trailing = bytes.clone();