v3.3.1 broken on windows
ardyfeb opened this issue · comments
Cannot compile on windows with latest version v3.3.1
error[E0446]: private type `platform::windows::OpenClipboard<'_>` in public interface
--> C:\Users\gitlab_runner\.cargo\registry\src\index.crates.io-6f17d22bba15001f\arboard-3.3.1\src\platform\windows.rs:40:2
|
40 | pub fn add_cf_dibv5(_open_clipboard: OpenClipboard, image: ImageData) -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
...
422 | struct OpenClipboard<'clipboard> {
| -------------------------------- `platform::windows::OpenClipboard<'_>` declared as private
For more information about this error, try `rustc --explain E0446`.
Seems to be caused by the refactor in a100f2d, where the add_cf_dibv5
function is moved into the new mod image_data
. The mod has use super::*
but OpenClipboard
is private, so it can't access it.
This can be fixed by simply adding pub
to the struct OpenClipboard
. However, that might compromise the intended API design.
It looks like the _open_clipboard
is unused in the function, and only there to enforce the existence of an open clipboard? At least that is my impression by seeing it's usage later in the file (line #600).
I can open a PR for adding pub
to the OpenClipboard
struct, just in case that's a sufficient fix.
@rhysd, maybe you have input on a better solution?
Hi everyone, thanks for the report.
Can I ask what cargo
command can be used to reproduce this, alongside the output of rustc --version -v
? Somehow it slipped past CI and my manual testing so I'd like to add a regression test to ensure future issues which have visibility mishaps are caught ahead of time. I can't seem to reproduce this yet with cargo build --features image-data
on the rustc
stable.
I am pretty certain #138 fixes this problem, but could I ask someone who can actually reproduce this issue to use the fix-windows-image-visiblity
branch in their build and confirm this?
Once this is confirmed to be the fix (and ideally I can reproduce it), I'll make a new patch release fixing the problem.
i can confirm that i am now able to build successfully on windows with the changes in the fix-windows-image-visiblity
branch.
i was only using cargo build
directly when i first encountered it, but i can also confirm that i am able to reproduce the build error with cargo build --features image-data
on the master
branch. the latter builds successfully on fix-windows-image-visiblity
.
output from rustc --version v
:
$ rustc --version -v
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-pc-windows-msvc
release: 1.73.0
LLVM version: 17.0.2
Thank you for the details and confirmation. I pulled in some older toolchains and confirmed this is an error from Rust 1.69-1.73. In Rust 1.74 it started working. I'm unsure why CI didn't catch this either but at least it should going forward.
This is now fixed in v3.3.2 on crates.io.