We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have this minimal example:
#[cfg(test)] use mocktopus::macros::*; pub struct Foo { } #[cfg_attr(test, mockable)] impl Foo { pub async fn read(&mut self, buf: &mut[u8]) { let _ = buf; } }
It builds fine without tests, but fails with tests enabled with:
error[E0621]: explicit lifetime required in the type of `buf` --> src/main.rs:13:5 | 12 | pub async fn read(&mut self, buf: &mut[u8]) -> () | -------- help: add explicit lifetime `'mocktopus` to the type of `buf`: `&'mocktopus mut [u8]` 13 | / { 14 | | let _ = buf; 15 | | } | |_____^ lifetime `'mocktopus` required
Using pub async fn read<'a>(&mut self, buf: &'a mut[u8]) instead silences the error. I have no idea if it's a good workaround.
pub async fn read<'a>(&mut self, buf: &'a mut[u8])
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I have this minimal example:
It builds fine without tests, but fails with tests enabled with:
Using
pub async fn read<'a>(&mut self, buf: &'a mut[u8])
instead silences the error. I have no idea if it's a good workaround.The text was updated successfully, but these errors were encountered: