-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
False positive in new_ret_no_self
if self type carries lifetime annotation?
#734
Comments
I should probably not compare types with |
If I use impl<T> CharIter<T> {
pub fn new<U>( s: &str ) -> CharIter<U> { .. }
..
} Any idea how to compare types with type parameters? 🆘 |
This is a bit complex, because the types can literally come from anywhere. But in general, we should consider two unbound type variables in the same position equal, regardless there name, so
Both |
I know, but any idea what function does that in rustc? |
I don't think there's a function for this in rustc (because for rustc the types are not equal at all). We'll have to walk the type's |
triage: The first example is fixed (I'm going to add a testcase for that). |
…, r=flip1995 Add lifetime test case for `new_ret_no_self` cc rust-lang#734 (comment) changelog: none
…, r=flip1995 Add lifetime test case for `new_ret_no_self` cc rust-lang#734 (comment) changelog: none
This was fixed in #6952 |
Example (from lib_json):
While the warning can be fixed by changing it to
pub fn new(s: &'a str) -> CharIter<'a> { .. }
, I am unsure if the lifetime difference is really relevant here.The text was updated successfully, but these errors were encountered: