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
Trying to mock the following trait fails:
#[mockall::automock] trait Foo { fn bar(&self, x: Option<&u32>); }
with a confusing error message:
error[E0106]: missing lifetime specifier --> src/main.rs:3:29 | 3 | fn bar(&self, x: Option<&u32>); | ^ expected named lifetime parameter | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'a` lifetime | 1 ~ for<'a> #[mockall::automock] 2 | trait Foo { 3 ~ fn bar(&self, x: Option<&'a u32>); | help: consider introducing a named lifetime parameter | 1 ~ #[mockall::automock]<'a> 2 | trait Foo { 3 ~ fn bar(&self, x: Option<&'a u32>); | error[E0637]: `&` without an explicit lifetime name cannot be used here --> src/main.rs:3:29 | 3 | fn bar(&self, x: Option<&u32>); | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | 1 ~ for<'a> #[mockall::automock] 2 | trait Foo { 3 ~ fn bar(&self, x: Option<&'a u32>); | Some errors have detailed explanations: E0106, E0637. For more information about an error, try `rustc --explain E0106`.
If there is some reason this can't be supported, the error message should at least be more helpful in explaining why.
The text was updated successfully, but these errors were encountered:
Have you tried adding a lifetime parameter, like this?
fn bar<'a>(&'a self, x: Option<&'a u32>);
Sorry, something went wrong.
No branches or pull requests
Trying to mock the following trait fails:
with a confusing error message:
If there is some reason this can't be supported, the error message should at least be more helpful in explaining why.
The text was updated successfully, but these errors were encountered: