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: Compile error "'Debug' trait not implemented for 'Rect'" in code generated by windows::core::build! #1404

Closed
milyin opened this issue Dec 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@milyin
Copy link
Contributor

milyin commented Dec 29, 2021

Which crate is this about?

windows

Crate version

0.29

Summary

I'm trying to use Win2D library in a way shown in windows-samples-rs/win2d. When I'm trying to import Microsoft::Graphics::Canvas::Text::CanvasTextLayout I'm getting compilation error

error[E0277]: `Rect` doesn't implement `Debug`
    --> C:\projects\rust\wag\target\debug\build\bindings-596a2b6b6583e9c0\out/windows.rs:3762:52
     |
3762 | ...                   .field("LayoutBounds", &self.LayoutBounds)
     |                                              ^^^^^^^^^^^^^^^^^^ `Rect` cannot be formatted using `{:?}` because it doesn't implement `Debug`
     |
     = help: the trait `Debug` is not implemented for `Rect`
     = note: required for the cast to the object type `dyn Debug`

bindings/build.rs:

fn main() {
    windows::core::build! {
        Microsoft::Graphics::Canvas::Text::CanvasTextLayout,
    };
}

Dependencies in bindings/Cargo.toml

windows = { version = "0.29", features = [
    "build",
    "Foundation",
    "Foundation_Numerics",
    "Foundation_Collections",
    "UI_Composition",
    "UI_Input",
    "UI_Input_Inking",
    "UI_Text",
    "Graphics_Imaging",
    "Graphics_DirectX_Direct3D11",
] }

autogenerated code causing compilation error:

                impl ::core::fmt::Debug for CanvasTextLayoutRegion {
                    fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
                        fmt.debug_struct("CanvasTextLayoutRegion")
                            .field("CharacterIndex", &self.CharacterIndex)
                            .field("CharacterCount", &self.CharacterCount)
                            .field("LayoutBounds", &self.LayoutBounds)
                            .finish()
                    }
                }

Link to project with error
https://github.com/milyin/windows-samples-rs/tree/master/win2d

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

@milyin milyin added the bug Something isn't working label Dec 29, 2021
@milyin milyin changed the title Bug: Compile error 'Debug' trait not implemented for 'Rect' in code generated by windows::core::build! Bug: Compile error "'Debug' trait not implemented for 'Rect'" in code generated by windows::core::build! Dec 29, 2021
@ryancerium
Copy link
Contributor

I think @kennykerr fixed this a week ago, but probably needs to cut a release still.

#1395

@kennykerr
Copy link
Collaborator

Yes, this is fixed in the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants