-
Notifications
You must be signed in to change notification settings - Fork 806
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
Make clippy happy with code emitted by impl_arg_param #2487
Conversation
Ok(quote_arg_span! { | ||
let #arg_name = #arg_value_or_default?; | ||
}) | ||
} else { | ||
let ty = arg.ty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need a call to remove_lifetime
. Can you add a test for a pyfunction with something like Vec<&'py PyAny>
as an argument? I've also been wondering if it's possible for us to copy lifetimes from the function definition onto the generated pyfunction
- I think that might also solve the problem but not sure.
pyo3-macros-backend/src/params.rs
Outdated
let #arg_name = #borrow_tmp; | ||
}) | ||
} else { | ||
} else if cfg!(feature = "pyproto") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lack of remove_lifetime
is probably why pyproto
broke - it inserts a hidden lifetime to try and behave like lifetime elision :(. Super weird and so close to killing off now!
Thanks! I've paused on reviewing this one for a bit just because I've always viewed the deref juggling the macro does here as a bit janky. I finally had an idea how to introduce a I haven't quite finished off that branch, I'm hoping I'll get a chance to implement at the weekend and see what folks think. |
Closing as superseded by #2503 |
Fixes some bad error message when Rust can't find a type:
Fixes rust-lang/rust-clippy#8971