Skip to content

Commit 8164c4a

Browse files
authored
Merge pull request #752 from hermit-os/nightly-2025-06-25
chore: upgrade toolchain channel to nightly-2025-06-25
2 parents 8b41613 + 2ee2f70 commit 8164c4a

File tree

4 files changed

+60
-63
lines changed

4 files changed

+60
-63
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ jobs:
9494
- name: Dowload OpenSBI
9595
if: matrix.arch == 'riscv64'
9696
run: |
97-
gh release download v1.6 --repo riscv-software-src/opensbi --pattern 'opensbi-*-rv-bin.tar.xz'
98-
tar -xvf opensbi-*-rv-bin.tar.xz opensbi-1.6-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin
97+
gh release download v1.7 --repo riscv-software-src/opensbi --pattern 'opensbi-*-rv-bin.tar.xz'
98+
tar -xvf opensbi-*-rv-bin.tar.xz opensbi-1.7-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin
9999
- uses: mkroening/rust-toolchain-toml@main
100100
- uses: mkroening/rust-toolchain-toml@main
101101
with:

examples/hermit-wasm/src/preview1.rs

Lines changed: 56 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -384,32 +384,31 @@ pub(crate) fn init<T: 'static>(
384384
"fd_prestat_get",
385385
|mut caller: Caller<'_, _>, fd: i32, prestat_ptr: i32| {
386386
let guard = FD.lock().unwrap();
387-
if fd < guard.len().try_into().unwrap() {
388-
if let Some(Extern::Memory(mem)) = caller.get_export("memory") {
389-
if let Descriptor::Directory(name) = &guard[fd as usize] {
390-
let stat = Prestat {
391-
tag: PREOPENTYPE_DIR.raw(),
392-
u: PrestatU {
393-
dir: PrestatDir {
394-
pr_name_len: name.len(),
395-
},
396-
},
397-
};
387+
if fd < guard.len().try_into().unwrap()
388+
&& let Some(Extern::Memory(mem)) = caller.get_export("memory")
389+
&& let Descriptor::Directory(name) = &guard[fd as usize]
390+
{
391+
let stat = Prestat {
392+
tag: PREOPENTYPE_DIR.raw(),
393+
u: PrestatU {
394+
dir: PrestatDir {
395+
pr_name_len: name.len(),
396+
},
397+
},
398+
};
398399

399-
let _ = mem.write(
400-
caller.as_context_mut(),
401-
prestat_ptr.try_into().unwrap(),
402-
unsafe {
403-
std::slice::from_raw_parts(
404-
(&stat as *const _) as *const u8,
405-
size_of::<Prestat>(),
406-
)
407-
},
408-
);
400+
let _ = mem.write(
401+
caller.as_context_mut(),
402+
prestat_ptr.try_into().unwrap(),
403+
unsafe {
404+
std::slice::from_raw_parts(
405+
(&stat as *const _) as *const u8,
406+
size_of::<Prestat>(),
407+
)
408+
},
409+
);
409410

410-
return ERRNO_SUCCESS.raw() as i32;
411-
}
412-
}
411+
return ERRNO_SUCCESS.raw() as i32;
413412
}
414413

415414
ERRNO_BADF.raw() as i32
@@ -422,22 +421,20 @@ pub(crate) fn init<T: 'static>(
422421
"fd_tell",
423422
|mut caller: Caller<'_, _>, fd: i32, offset_ptr: i32| {
424423
let guard = FD.lock().unwrap();
425-
if fd < guard.len().try_into().unwrap() {
426-
if let Descriptor::File(file) = &guard[fd as usize] {
427-
if let Some(Extern::Memory(mem)) = caller.get_export("memory") {
428-
let offset =
429-
unsafe { hermit_abi::lseek(file.raw_fd, 0, hermit_abi::SEEK_CUR) };
424+
if fd < guard.len().try_into().unwrap()
425+
&& let Descriptor::File(file) = &guard[fd as usize]
426+
&& let Some(Extern::Memory(mem)) = caller.get_export("memory")
427+
{
428+
let offset = unsafe { hermit_abi::lseek(file.raw_fd, 0, hermit_abi::SEEK_CUR) };
430429

431-
if offset > 0 {
432-
let _ = mem.write(
433-
caller.as_context_mut(),
434-
offset_ptr.try_into().unwrap(),
435-
offset.as_bytes(),
436-
);
430+
if offset > 0 {
431+
let _ = mem.write(
432+
caller.as_context_mut(),
433+
offset_ptr.try_into().unwrap(),
434+
offset.as_bytes(),
435+
);
437436

438-
return ERRNO_SUCCESS.raw() as i32;
439-
}
440-
}
437+
return ERRNO_SUCCESS.raw() as i32;
441438
}
442439
}
443440

@@ -451,25 +448,25 @@ pub(crate) fn init<T: 'static>(
451448
"fd_prestat_dir_name",
452449
|mut caller: Caller<'_, _>, fd: i32, path_ptr: i32, path_len: i32| {
453450
let guard = FD.lock().unwrap();
454-
if fd < guard.len().try_into().unwrap() {
455-
if let Descriptor::Directory(path) = &guard[fd as usize] {
456-
if let Some(Extern::Memory(mem)) = caller.get_export(
457-
"memory
451+
if fd < guard.len().try_into().unwrap()
452+
&& let Descriptor::Directory(path) = &guard[fd as usize]
453+
{
454+
if let Some(Extern::Memory(mem)) = caller.get_export(
455+
"memory
458456
",
459-
) {
460-
if path_len < path.len().try_into().unwrap() {
461-
return ERRNO_INVAL.raw() as i32;
462-
}
463-
464-
let _ = mem.write(
465-
caller.as_context_mut(),
466-
path_ptr.try_into().unwrap(),
467-
path.as_bytes(),
468-
);
457+
) {
458+
if path_len < path.len().try_into().unwrap() {
459+
return ERRNO_INVAL.raw() as i32;
469460
}
470461

471-
return ERRNO_SUCCESS.raw() as i32;
462+
let _ = mem.write(
463+
caller.as_context_mut(),
464+
path_ptr.try_into().unwrap(),
465+
path.as_bytes(),
466+
);
472467
}
468+
469+
return ERRNO_SUCCESS.raw() as i32;
473470
}
474471

475472
ERRNO_BADF.raw() as i32
@@ -479,13 +476,13 @@ pub(crate) fn init<T: 'static>(
479476
linker
480477
.func_wrap("wasi_snapshot_preview1", "fd_close", |fd: i32| {
481478
let mut guard = FD.lock().unwrap();
482-
if fd < guard.len().try_into().unwrap() {
483-
if let Descriptor::File(file) = &guard[fd as usize] {
484-
unsafe {
485-
hermit_abi::close(file.raw_fd);
486-
}
487-
guard[fd as usize] = Descriptor::None;
479+
if fd < guard.len().try_into().unwrap()
480+
&& let Descriptor::File(file) = &guard[fd as usize]
481+
{
482+
unsafe {
483+
hermit_abi::close(file.raw_fd);
488484
}
485+
guard[fd as usize] = Descriptor::None;
489486
}
490487

491488
ERRNO_SUCCESS.raw() as i32

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-05-16"
2+
channel = "nightly-2025-06-25"
33
components = [ "rust-src" ]

0 commit comments

Comments
 (0)