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

Alloc #[cfg()] attributes on trait impls in mock! #288

Closed
asomers opened this issue Jun 20, 2021 · 0 comments · Fixed by #297
Closed

Alloc #[cfg()] attributes on trait impls in mock! #288

asomers opened this issue Jun 20, 2021 · 0 comments · Fixed by #297
Labels
enhancement New feature or request

Comments

@asomers
Copy link
Owner

asomers commented Jun 20, 2021

mock! allows individual methods to be gated by #[cfg()]. It would be handy if that worked for trait impls too. For example,

mock! {
    struct Foo { }
    #[cfg(unix)]
    impl std::os::unix::io::AsRawFd for Foo {
        //...
    }
    #[cfg(windows)]
    impl std::os::windows::fs::FileExt for Foo {
        //...
    }
}

We certainly don't want both traits to be compiled at the same time.

@asomers asomers added the enhancement New feature or request label Jun 20, 2021
@asomers asomers changed the title Alloc #[cfg()] attributes on individual methods in mock! Alloc #[cfg()] attributes on trait impls in mock! Jun 27, 2021
asomers added a commit that referenced this issue Jun 27, 2021
mock! already allowed individual methods to be so gated.  Now it will
work for trait impls, too.

Fixes #288
asomers added a commit that referenced this issue Jun 27, 2021
mock! already allowed individual methods to be so gated.  Now it will
work for trait impls, too.

Fixes #288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant