Skip to content

implement/interface macro docs are outdated #3302

Open

Description

Summary

ver: windows-rs 0.58

use windows::core::*;

#[interface("094d70d6-5202-44b8-abb8-43860da5aca2")]
unsafe trait IValue: IUnknown {
    fn GetValue(&self, value: *mut i32) -> HRESULT;
}

#[implement(IValue)]
struct Value(i32);

impl IValue_Impl for Value {
    unsafe fn GetValue(&self, value: *mut i32) -> HRESULT {
        *value = self.0;
        HRESULT(0)
    }
}

get compile error=>

error[E0277]: the trait bound `Value_Impl: IValue_Impl` is not satisfied
 --> src\test.rs:8:1
  |
8 | #[implement(IValue)]
  | ^^^^^^^^^^^^^^^^^^^^ the trait `IValue_Impl` is not implemented for `Value_Impl`
  |
  = help: the trait `IValue_Impl` is implemented for `arc_stream::Value`
note: required by a bound in `IValue_Vtbl::new`
 --> src\test.rs:4:14
  |
3 | #[interface("094d70d6-5202-44b8-abb8-43860da5aca2")]
  | ---------------------------------------------------- required by a bound in this associated function
4 | unsafe trait IValue: IUnknown {
  |              ^^^^^^ required by this bound in `IValue_Vtbl::new`
  = note: this error originates in the attribute macro `implement` (in Nightly builds, run with -Z macro-backtrace for more info)

Crate manifest

No response

Crate code

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions