ci: workaround for OpenOptionsExt in 1.94.0 (#7968)

This commit is contained in:
Chris Denton
2026-03-13 10:53:13 +00:00
committed by GitHub
parent ee04abe797
commit d3c7f56c10
4 changed files with 26 additions and 21 deletions
+3 -1
View File
@@ -15,7 +15,7 @@ env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
RUSTUP_WINDOWS_PATH_ADD_BIN: 1 RUSTUP_WINDOWS_PATH_ADD_BIN: 1
# Change to specific Rust release to pin # Change to specific Rust release to pin
rust_stable: '1.93.1' rust_stable: stable
rust_nightly: nightly-2025-10-12 rust_nightly: nightly-2025-10-12
# Pin a specific miri version # Pin a specific miri version
rust_miri_nightly: nightly-2025-11-13 rust_miri_nightly: nightly-2025-11-13
@@ -1057,6 +1057,8 @@ jobs:
target: target:
- wasm32-wasip1 - wasm32-wasip1
- wasm32-wasip1-threads - wasm32-wasip1-threads
env:
rust_stable: '1.93.1'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
+2 -2
View File
@@ -16,9 +16,9 @@ use mock_open_options::MockOpenOptions as StdOpenOptions;
#[cfg(not(test))] #[cfg(not(test))]
use std::fs::OpenOptions as StdOpenOptions; use std::fs::OpenOptions as StdOpenOptions;
#[cfg(unix)] #[cfg(all(unix, not(test)))]
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
#[cfg(windows)] #[cfg(all(windows, not(test)))]
use std::os::windows::fs::OpenOptionsExt; use std::os::windows::fs::OpenOptionsExt;
/// Options and flags which can be used to configure how a file is opened. /// Options and flags which can be used to configure how a file is opened.
+17 -17
View File
@@ -3,10 +3,6 @@
use mockall::mock; use mockall::mock;
use crate::fs::mocks::MockFile; use crate::fs::mocks::MockFile;
#[cfg(unix)]
use std::os::unix::fs::OpenOptionsExt;
#[cfg(windows)]
use std::os::windows::fs::OpenOptionsExt;
use std::{io, path::Path}; use std::{io, path::Path};
mock! { mock! {
@@ -19,21 +15,25 @@ mock! {
pub fn read(&mut self, read: bool) -> &mut Self; pub fn read(&mut self, read: bool) -> &mut Self;
pub fn truncate(&mut self, truncate: bool) -> &mut Self; pub fn truncate(&mut self, truncate: bool) -> &mut Self;
pub fn write(&mut self, write: bool) -> &mut Self; pub fn write(&mut self, write: bool) -> &mut Self;
// Not mocking OpenOptionsExt trait due to:
// https://github.com/rust-lang/rust/issues/153486
#[cfg(unix)]
pub fn custom_flags(&mut self, flags: i32) -> &mut Self;
#[cfg(unix)]
pub fn mode(&mut self, mode: u32) -> &mut Self;
#[cfg(windows)]
pub fn access_mode(&mut self, access: u32) -> &mut Self;
#[cfg(windows)]
pub fn share_mode(&mut self, val: u32) -> &mut Self;
#[cfg(windows)]
pub fn custom_flags(&mut self, flags: u32) -> &mut Self;
#[cfg(windows)]
pub fn attributes(&mut self, val: u32) -> &mut Self;
#[cfg(windows)]
pub fn security_qos_flags(&mut self, flags: u32) -> &mut Self;
} }
impl Clone for OpenOptions { impl Clone for OpenOptions {
fn clone(&self) -> Self; fn clone(&self) -> Self;
} }
#[cfg(unix)]
impl OpenOptionsExt for OpenOptions {
fn custom_flags(&mut self, flags: i32) -> &mut Self;
fn mode(&mut self, mode: u32) -> &mut Self;
}
#[cfg(windows)]
impl OpenOptionsExt for OpenOptions {
fn access_mode(&mut self, access: u32) -> &mut Self;
fn share_mode(&mut self, val: u32) -> &mut Self;
fn custom_flags(&mut self, flags: u32) -> &mut Self;
fn attributes(&mut self, val: u32) -> &mut Self;
fn security_qos_flags(&mut self, flags: u32) -> &mut Self;
}
} }
@@ -1,4 +1,7 @@
use std::{io, os::unix::fs::OpenOptionsExt}; use std::io;
#[cfg(not(test))]
use std::os::unix::fs::OpenOptionsExt;
#[cfg(test)] #[cfg(test)]
use super::mock_open_options::MockOpenOptions as StdOpenOptions; use super::mock_open_options::MockOpenOptions as StdOpenOptions;