Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seal MetadataExt on all platforms #118916

Closed
wants to merge 1 commit into from

Conversation

ChrisDenton
Copy link
Member

The Windows flavour of MetadataExt is currently unimplementable on stable because of unstable methods. Therefore anyone making a cross-platform library that implements MetadataExt will fail on Windows. So let's see if we can seal it for all platforms.

Last time this was tried, sealing MetadataExt only caused a problem for one old version of one crate.

@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added O-android Operating system: Android O-fuchsia Operating system: Fuchsia O-ios Operating system: iOS O-linux Operating system: Linux O-macos Operating system: macOS O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-solaris Operating system: Solaris O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-watchos Operating System: watchOS O-windows Operating system: Windows T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 13, 2023
@rust-log-analyzer

This comment has been minimized.

@ChrisDenton
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Dec 13, 2023

⌛ Trying commit a0572b3 with merge 3d5258f...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 13, 2023
Seal `MetadataExt` on all platforms

The Windows flavour of [`MetadataExt`](https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html) is currently unimplementable on stable because of unstable methods. Therefore anyone making a cross-platform library that implements `MetadataExt` will fail on Windows. So let's see if we can seal it for all platforms.

[Last time this was tried](rust-lang#81213 (comment)), sealing `MetadataExt` only caused a problem for one old version of one crate.
@bors
Copy link
Contributor

bors commented Dec 13, 2023

☀️ Try build successful - checks-actions
Build commit: 3d5258f (3d5258f568a4b4970d455e4e29f39fd691b5a41a)

1 similar comment
@bors
Copy link
Contributor

bors commented Dec 13, 2023

☀️ Try build successful - checks-actions
Build commit: 3d5258f (3d5258f568a4b4970d455e4e29f39fd691b5a41a)

@ChrisDenton
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-118916 created and queued.
🤖 Automatically detected try build 3d5258f
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Dec 13, 2023
@craterbot
Copy link
Collaborator

🚧 Experiment pr-118916 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-118916 is completed!
📊 133 regressed and 0 fixed (399389 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Dec 22, 2023
@ChrisDenton
Copy link
Member Author

So the bad news is that cap-primitives has regressed again. Last time it was only one old version of cap-primitives that was affected so I wrongly assumed it would have remained fixed. The good news is that cap-primitives appears to be the only crate affected (the other failures are spurious: "No space left on device").

[INFO] [stdout] error[E0277]: the trait bound `metadata_ext::MetadataExt: std::sealed::Sealed` is not satisfied
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/cap-primitives-2.0.0/src/rustix/fs/metadata_ext.rs:277:34
[INFO] [stdout]     |
[INFO] [stdout] 277 | impl rustix::fs::MetadataExt for MetadataExt {
[INFO] [stdout]     |                                  ^^^^^^^^^^^ the trait `std::sealed::Sealed` is not implemented for `metadata_ext::MetadataExt`
[INFO] [stdout]     |
[INFO] [stdout]     = help: the following other types implement trait `std::sealed::Sealed`:
[INFO] [stdout]               OsString
[INFO] [stdout]               OsStr
[INFO] [stdout]               File
[INFO] [stdout]               std::fs::DirEntry
[INFO] [stdout]               Stdin
[INFO] [stdout]               StdinLock<'_>
[INFO] [stdout]               Stdout
[INFO] [stdout]               StdoutLock<'_>
[INFO] [stdout]             and 15 others
[INFO] [stdout] note: required by a bound in `rustix::fs::MetadataExt`
[INFO] [stdout]    --> /rustc/3d5258f568a4b4970d455e4e29f39fd691b5a41a/library/std/src/os/unix/fs.rs:432:1
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error[E0277]: the trait bound `metadata::Metadata: std::sealed::Sealed` is not satisfied
[INFO] [stdout]    --> /opt/rustwide/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/cap-primitives-2.0.0/src/fs/metadata.rs:202:41
[INFO] [stdout]     |
[INFO] [stdout] 202 | impl std::os::unix::fs::MetadataExt for Metadata {
[INFO] [stdout]     |                                         ^^^^^^^^ the trait `std::sealed::Sealed` is not implemented for `metadata::Metadata`
[INFO] [stdout]     |
[INFO] [stdout]     = help: the following other types implement trait `std::sealed::Sealed`:
[INFO] [stdout]               OsString
[INFO] [stdout]               OsStr
[INFO] [stdout]               File
[INFO] [stdout]               std::fs::DirEntry
[INFO] [stdout]               Stdin
[INFO] [stdout]               StdinLock<'_>
[INFO] [stdout]               Stdout
[INFO] [stdout]               StdoutLock<'_>
[INFO] [stdout]             and 15 others
[INFO] [stdout] note: required by a bound in `rustix::fs::MetadataExt`
[INFO] [stdout]    --> /rustc/3d5258f568a4b4970d455e4e29f39fd691b5a41a/library/std/src/os/unix/fs.rs:432:1

@ChrisDenton
Copy link
Member Author

cc @sunfishcode, maybe changes could be made to cap-primitives. Though I'm now thinking we can't do this on Unix. If we ever do have a need to extend Metadata further on Unix platforms we can always create MetadataExt2.

@sunfishcode
Copy link
Member

Yeah. I can change cap-primitives to avoid using MetadataExt, and a few more *Ext traits too.

@Mark-Simulacrum
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 31, 2023
@ChrisDenton
Copy link
Member Author

I think I'll close this for now. Even if cap-primitives is updated today there's going to be a long tale of crates relying on older versions so it'd be best to revisit this later. I might open another PR for specific platforms where MetadataExt can be sealed.

@ChrisDenton ChrisDenton deleted the metadataext branch January 10, 2024 22:46
@sunfishcode
Copy link
Member

@ChrisDenton I've now remove all implementations of all std::os::* traits from cap-std, and released it as cap-std 3.0. As you say, it'll likely be some time before all users are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-android Operating system: Android O-fuchsia Operating system: Fuchsia O-ios Operating system: iOS O-linux Operating system: Linux O-macos Operating system: macOS O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-solaris Operating system: Solaris O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-watchos Operating System: watchOS O-windows Operating system: Windows S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants