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

Bug: /crates/samples/create_window/src/main.rs Line 40 expected *-ptr, found enum Option #1977

Closed
bmariuszb opened this issue Aug 22, 2022 · 7 comments · Fixed by #1991
Closed
Labels
question Further information is requested

Comments

@bmariuszb
Copy link

Which crate is this about?

windows

Crate version

0.39.0

Summary

No response

Toolchain version/configuration

No response

Reproducible example

No response

Crate manifest

[package]
name = "winows"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.windows]
version = "0.39.0"
features = [
    "Win32_Foundation",
    "Win32_Graphics_Gdi",
    "Win32_System_LibraryLoader",
    "Win32_UI_WindowsAndMessaging",
]

Expected behavior

Sample runs without errors.

Actual behavior

error[E0308]: mismatched types
--> src\main.rs:40:38
|
40 | ValidateRect(window, None);
| ------------ ^^^^ expected *-ptr, found enum Option
| |
| arguments to this function are incorrect
|
= note: expected raw pointer *const RECT
found enum Option<_>

Additional comments

No response

@bmariuszb bmariuszb added the bug Something isn't working label Aug 22, 2022
@MRahilly
Copy link

Does this work?
ValidateRect(window, std::ptr::null_mut());

@bmariuszb
Copy link
Author

yes

@kennykerr
Copy link
Collaborator

The samples in the repo compile with the latest, usually pre-release, version of the windows or windows-sys crate. To find the samples for a particular release you can use a specific release tag. For example:

https://github.com/microsoft/windows-rs/tree/0.39.0

That will give you the samples that compile with version 0.39 of the windows crate.

@kennykerr kennykerr added question Further information is requested and removed bug Something isn't working labels Aug 23, 2022
@bmariuszb
Copy link
Author

Maybe you could add that note to readme in samples directory?

@kennykerr
Copy link
Collaborator

Sure! Here you go: #1980

@kennykerr
Copy link
Collaborator

So yes, I'd love to but Cargo 1.46 doesn't appear to support that. #1980

Perhaps in future when we no longer need to validate against 1.46 for windows-sys.

@kennykerr
Copy link
Collaborator

Fixed! #1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants