Skip to content

Commit

Permalink
Update to Rust 1.82.0 (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
magicant authored Nov 7, 2024
2 parents 6027118 + 6b39d2c commit c6f72e6
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/[email protected]
- uses: dtolnay/rust-toolchain@1.79.0
- uses: dtolnay/rust-toolchain@1.82.0
- uses: Swatinem/rust-cache@v2
- name: Run tests with MSRV
run: ./check-msrv.sh -v
Expand Down
16 changes: 8 additions & 8 deletions check-msrv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ cargo +1.65.0 test --package yash-arith -- $quiet

update_workspace_member yash-builtin
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-builtin -- $quiet
cargo +1.82.0 test --package yash-builtin -- $quiet

update_workspace_member yash-cli
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-cli -- $quiet
cargo +1.82.0 test --package yash-cli -- $quiet

update_workspace_member yash-env
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-env -- $quiet
cargo +1.82.0 test --package yash-env -- $quiet

update_workspace_member yash-env-test-helper
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-env-test-helper -- $quiet
cargo +1.82.0 test --package yash-env-test-helper -- $quiet

update_workspace_member yash-executor
cargo +nightly update -Z direct-minimal-versions
Expand All @@ -46,17 +46,17 @@ cargo +1.65.0 test --package yash-fnmatch -- $quiet

update_workspace_member yash-prompt
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-prompt -- $quiet
cargo +1.82.0 test --package yash-prompt -- $quiet

update_workspace_member yash-quote
cargo +nightly update -Z direct-minimal-versions
cargo +1.65.0 test --package yash-quote -- $quiet

update_workspace_member yash-semantics
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-semantics -- $quiet
cargo +1.82.0 test --package yash-semantics -- $quiet

update_workspace_member yash-syntax
cargo +nightly update -Z direct-minimal-versions
cargo +1.79.0 test --package yash-syntax -- $quiet
cargo +1.79.0 test --package yash-syntax --features annotate-snippets -- $quiet
cargo +1.82.0 test --package yash-syntax -- $quiet
cargo +1.82.0 test --package yash-syntax --features annotate-snippets -- $quiet
8 changes: 8 additions & 0 deletions yash-builtin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to `yash-builtin` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.1] - Unreleased

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0

## [0.4.0] - 2024-09-29

### Added
Expand Down Expand Up @@ -123,6 +130,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial implementation of the `yash-builtin` crate

[0.4.1]: https://github.com/magicant/yash-rs/releases/tag/yash-builtin-0.4.1
[0.4.0]: https://github.com/magicant/yash-rs/releases/tag/yash-builtin-0.4.0
[0.3.0]: https://github.com/magicant/yash-rs/releases/tag/yash-builtin-0.3.0
[0.2.0]: https://github.com/magicant/yash-rs/releases/tag/yash-builtin-0.2.0
Expand Down
2 changes: 1 addition & 1 deletion yash-builtin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-builtin"
version = "0.4.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Implementation of the built-in utilities of yash"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down
8 changes: 8 additions & 0 deletions yash-cli/CHANGELOG-lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ For changes to the shell binary as a whole, see [CHANGELOG-bin.md](CHANGELOG-bin
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.1] - Unreleased

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0

## [0.1.0] - 2024-09-29

### Added
Expand Down Expand Up @@ -121,6 +128,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial implementation of the `yash-cli` crate

[0.1.1]: https://github.com/magicant/yash-rs/releases/tag/yash-cli-0.1.1
[0.1.0]: https://github.com/magicant/yash-rs/releases/tag/yash-cli-0.1.0
[0.1.0-beta.2]: https://github.com/magicant/yash-rs/releases/tag/yash-cli-0.1.0-beta.2
[0.1.0-beta.1]: https://github.com/magicant/yash-rs/releases/tag/yash-cli-0.1.0-beta.1
Expand Down
2 changes: 1 addition & 1 deletion yash-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-cli"
version = "0.1.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Extended POSIX shell"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down
2 changes: 2 additions & 0 deletions yash-env-test-helper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0
- Internal dependency versions:
- futures-executor 0.3.28 → 0.3.31
- futures-util 0.3.28 → 0.3.31
Expand Down
2 changes: 1 addition & 1 deletion yash-env-test-helper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-env-test-helper"
version = "0.2.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Test helper for yash-env crate"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down
2 changes: 2 additions & 0 deletions yash-env/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0
- Internal dependency versions:
- futures-util 0.3.28 → 0.3.31

Expand Down
2 changes: 1 addition & 1 deletion yash-env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-env"
version = "0.4.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Yash shell execution environment interface"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down
26 changes: 12 additions & 14 deletions yash-env/src/system/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ use std::os::unix::ffi::OsStrExt as _;
use std::os::unix::ffi::OsStringExt as _;
use std::os::unix::io::IntoRawFd;
use std::pin::Pin;
use std::ptr::addr_of;
use std::ptr::addr_of_mut;
use std::ptr::NonNull;
use std::sync::atomic::compiler_fence;
use std::sync::atomic::AtomicIsize;
Expand Down Expand Up @@ -162,8 +160,8 @@ fn to_timespec(duration: Duration) -> MaybeUninit<nix::libc::timespec> {
.unwrap_or(nix::libc::time_t::MAX);
let mut timespec = MaybeUninit::<nix::libc::timespec>::uninit();
unsafe {
addr_of_mut!((*timespec.as_mut_ptr()).tv_sec).write(seconds);
addr_of_mut!((*timespec.as_mut_ptr()).tv_nsec).write(duration.subsec_nanos() as _);
(&raw mut (*timespec.as_mut_ptr()).tv_sec).write(seconds);
(&raw mut (*timespec.as_mut_ptr()).tv_nsec).write(duration.subsec_nanos() as _);
}
timespec
}
Expand Down Expand Up @@ -434,10 +432,10 @@ impl System for RealSystem {
// SAFETY: The four fields of `tms` have been initialized by `times`.
// (But that does not mean *all* fields are initialized,
// so we cannot use `assume_init` here.)
let utime = unsafe { addr_of!((*tms.as_ptr()).tms_utime).read() };
let stime = unsafe { addr_of!((*tms.as_ptr()).tms_stime).read() };
let cutime = unsafe { addr_of!((*tms.as_ptr()).tms_cutime).read() };
let cstime = unsafe { addr_of!((*tms.as_ptr()).tms_cstime).read() };
let utime = unsafe { (&raw const (*tms.as_ptr()).tms_utime).read() };
let stime = unsafe { (&raw const (*tms.as_ptr()).tms_stime).read() };
let cutime = unsafe { (&raw const (*tms.as_ptr()).tms_cutime).read() };
let cstime = unsafe { (&raw const (*tms.as_ptr()).tms_cstime).read() };

Ok(Times {
self_user: utime as f64 / ticks_per_second as f64,
Expand Down Expand Up @@ -518,7 +516,7 @@ impl System for RealSystem {
let new_action = handling.to_sigaction();

let mut old_action = MaybeUninit::<nix::libc::sigaction>::uninit();
let old_mask_ptr = addr_of_mut!((*old_action.as_mut_ptr()).sa_mask);
let old_mask_ptr = &raw mut (*old_action.as_mut_ptr()).sa_mask;
// POSIX requires *all* sigset_t objects to be initialized before use.
nix::libc::sigemptyset(old_mask_ptr).errno_if_m1()?;

Expand Down Expand Up @@ -838,8 +836,8 @@ impl System for RealSystem {
let mut limits = MaybeUninit::<nix::libc::rlimit>::uninit();
unsafe { nix::libc::getrlimit(raw_resource as _, limits.as_mut_ptr()) }.errno_if_m1()?;
Ok(LimitPair {
soft: unsafe { addr_of!((*limits.as_ptr()).rlim_cur).read() },
hard: unsafe { addr_of!((*limits.as_ptr()).rlim_max).read() },
soft: unsafe { (&raw const (*limits.as_ptr()).rlim_cur).read() },
hard: unsafe { (&raw const (*limits.as_ptr()).rlim_max).read() },
})
}

Expand All @@ -848,8 +846,8 @@ impl System for RealSystem {

let mut rlimit = MaybeUninit::<nix::libc::rlimit>::uninit();
unsafe {
addr_of_mut!((*rlimit.as_mut_ptr()).rlim_cur).write(limits.soft);
addr_of_mut!((*rlimit.as_mut_ptr()).rlim_max).write(limits.hard);
(&raw mut (*rlimit.as_mut_ptr()).rlim_cur).write(limits.soft);
(&raw mut (*rlimit.as_mut_ptr()).rlim_max).write(limits.hard);
}

unsafe { nix::libc::setrlimit(raw_resource as _, rlimit.as_ptr()) }.errno_if_m1()?;
Expand Down Expand Up @@ -882,7 +880,7 @@ impl Dir for RealDir {
}
} else {
// TODO Use as_ptr rather than cast when array_ptr_get is stabilized
let name = unsafe { CStr::from_ptr(addr_of!((*entry).d_name).cast()) };
let name = unsafe { CStr::from_ptr((&raw const (*entry).d_name).cast()) };
let name = UnixStr::from_bytes(name.to_bytes());
Ok(Some(DirEntry { name }))
}
Expand Down
15 changes: 7 additions & 8 deletions yash-env/src/system/real/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use super::super::{FileType, Gid, Mode, RawMode, Stat, Uid};
use std::mem::MaybeUninit;
use std::ptr::addr_of;

impl FileType {
#[must_use]
Expand All @@ -45,16 +44,16 @@ impl Stat {
#[must_use]
pub(super) const fn from_raw(stat: &MaybeUninit<nix::libc::stat>) -> Self {
let ptr = stat.as_ptr();
let raw_mode = unsafe { addr_of!((*ptr).st_mode).read() };
let raw_mode = unsafe { (&raw const (*ptr).st_mode).read() };
Self {
dev: unsafe { addr_of!((*ptr).st_dev).read() } as _,
ino: unsafe { addr_of!((*ptr).st_ino).read() } as _,
dev: unsafe { (&raw const (*ptr).st_dev).read() } as _,
ino: unsafe { (&raw const (*ptr).st_ino).read() } as _,
mode: Mode::from_bits_truncate(raw_mode),
r#type: FileType::from_raw(raw_mode),
nlink: unsafe { addr_of!((*ptr).st_nlink).read() } as _,
uid: Uid(unsafe { addr_of!((*ptr).st_uid).read() }),
gid: Gid(unsafe { addr_of!((*ptr).st_gid).read() }),
size: unsafe { addr_of!((*ptr).st_size).read() } as _,
nlink: unsafe { (&raw const (*ptr).st_nlink).read() } as _,
uid: Uid(unsafe { (&raw const (*ptr).st_uid).read() }),
gid: Gid(unsafe { (&raw const (*ptr).st_gid).read() }),
size: unsafe { (&raw const (*ptr).st_size).read() } as _,
}
}
}
13 changes: 6 additions & 7 deletions yash-env/src/system/real/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::ffi::c_int;
use std::mem::MaybeUninit;
use std::num::NonZeroI32;
use std::ops::RangeInclusive;
use std::ptr::{addr_of, addr_of_mut};

/// Returns the range of real-time signals supported by the real system.
///
Expand Down Expand Up @@ -437,27 +436,27 @@ impl Disposition {
let mut sa = MaybeUninit::<nix::libc::sigaction>::uninit();
let sa_ptr = sa.as_mut_ptr();
unsafe {
addr_of_mut!((*sa_ptr).sa_flags).write(0);
nix::libc::sigemptyset(addr_of_mut!((*sa_ptr).sa_mask));
(&raw mut (*sa_ptr).sa_flags).write(0);
nix::libc::sigemptyset(&raw mut ((*sa_ptr).sa_mask));

#[cfg(not(target_os = "aix"))]
#[allow(clippy::useless_transmute)] // See from_sigaction below
addr_of_mut!((*sa_ptr).sa_sigaction).write(std::mem::transmute(handler));
(&raw mut (*sa_ptr).sa_sigaction).write(std::mem::transmute(handler));

#[cfg(target_os = "aix")]
#[allow(clippy::useless_transmute)] // See from_sigaction below
addr_of_mut!((*sa_ptr).sa_union.__su_sigaction).write(std::mem::transmute(handler));
(&raw mut (*sa_ptr).sa_union.__su_sigaction).write(std::mem::transmute(handler));
}
sa
}

/// Converts the `sigaction` to the signal disposition for the real system.
pub(super) unsafe fn from_sigaction(sa: &MaybeUninit<nix::libc::sigaction>) -> Self {
#[cfg(not(target_os = "aix"))]
let handler = addr_of!((*sa.as_ptr()).sa_sigaction).read();
let handler = (&raw const (*sa.as_ptr()).sa_sigaction).read();

#[cfg(target_os = "aix")]
let handler = addr_of!((*sa.as_ptr()).sa_union.__su_sigaction).read();
let handler = (&raw const (*sa.as_ptr()).sa_union.__su_sigaction).read();

// It is platform-specific whether we really need to transmute the handler.
#[allow(clippy::useless_transmute)]
Expand Down
2 changes: 2 additions & 0 deletions yash-prompt/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0
- Internal dependency versions:
- futures-util 0.3.28 → 0.3.31

Expand Down
2 changes: 1 addition & 1 deletion yash-prompt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-prompt"
version = "0.2.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Command line prompt for yash shell"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down
8 changes: 8 additions & 0 deletions yash-semantics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to `yash-semantics` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.1] - Unreleased

### Changed

- External dependency versions:
- Rust 1.79.0 → 1.82.0

## [0.4.0] - 2024-09-29

### Added
Expand Down Expand Up @@ -128,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial implementation of the `yash-semantics` crate

[0.4.1]: https://github.com/magicant/yash-rs/releases/tag/yash-semantics-0.4.1
[0.4.0]: https://github.com/magicant/yash-rs/releases/tag/yash-semantics-0.4.0
[0.3.0]: https://github.com/magicant/yash-rs/releases/tag/yash-semantics-0.3.0
[0.2.0]: https://github.com/magicant/yash-rs/releases/tag/yash-semantics-0.2.0
Expand Down
2 changes: 1 addition & 1 deletion yash-semantics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "yash-semantics"
version = "0.4.0"
authors = ["WATANABE Yuki <[email protected]>"]
edition = "2021"
rust-version = "1.79.0"
rust-version = "1.82.0"
description = "Yash shell language semantics"
# documentation = "https://yash.osdn.jp/doc/"
readme = "README.md"
Expand Down

0 comments on commit c6f72e6

Please sign in to comment.