Skip to content

Breaking change in std::os::windows::fs::OpenOptionsExt affecting 1.94.0 #153486

@Darksonn

Description

@Darksonn

This is a regression from stable to stable that affects Tokio's test suite: tokio-rs/tokio#7955

Code

I tried this code:

use std::os::windows::fs::OpenOptionsExt;

pub struct MyCustomOptions {
    // Placeholder for actual options logic
    pub access: u32,
    pub share: u32,
}

impl OpenOptionsExt for MyCustomOptions {
    fn access_mode(&mut self, access: u32) -> &mut Self {
        self.access = access; // Minimal side effect for testing
        self
    }

    fn share_mode(&mut self, val: u32) -> &mut Self {
        self.share = val;
        self
    }

    fn custom_flags(&mut self, _flags: u32) -> &mut Self {
        self
    }

    fn attributes(&mut self, _val: u32) -> &mut Self {
        self
    }

    fn security_qos_flags(&mut self, _flags: u32) -> &mut Self {
        self
    }
}

fn main() {
    println!("Hello, world!");
}

I expected to see this happen: Since this builds successfully on 1.90.0, it should also build successfully on 1.94.0

Instead, this happened: Build failed on 1.94.0.

aliceryhl@aliceryhl4:/tmp/foo$ cargo check --target x86_64-pc-windows-msvc
    Checking foo v0.1.0 (/tmp/foo)
error[E0046]: not all trait items implemented, missing: `freeze_last_access_time`, `freeze_last_write_time`
 --> src/main.rs:9:1
  |
9 | impl OpenOptionsExt for MyCustomOptions {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `freeze_last_access_time`, `freeze_last_write_time` in implementation
  |
  = help: implement the missing item: `fn freeze_last_access_time(&mut self, _: bool) -> &mut Self { todo!() }`
  = help: implement the missing item: `fn freeze_last_write_time(&mut self, _: bool) -> &mut Self { todo!() }`

Be aware that it's impossible to implement these methods as they are unstable. The breaking change effectively makes the trait sealed.

Version it worked on

I carried out this test locally on 1.90.0, but I believe it worked until 1.93.0.

Version with regression

rustc --version --verbose:

aliceryhl@aliceryhl4:/tmp/foo$ rustc --version --verbose
rustc 1.94.0 (4a4ef493e 2026-03-02)
binary: rustc
commit-hash: 4a4ef493e3a1488c6e321570238084b38948f6db
commit-date: 2026-03-02
host: x86_64-unknown-linux-gnu
release: 1.94.0
LLVM version: 21.1.8

Additional details

This was caused by: #149718

As far as I can tell, crates affected by this have no way to fix this build error without a breaking change because it's impossible to provide an implementation of the unstable method freeze_last_access_time.

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: WindowsP-highHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions