-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Generics confusion in docs #15977
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Compare with core docs: http://doc.rust-lang.org/core/iter/struct.FilterMap.html
|
Since #15099 is fixed, I'm closing this. Please let me know if something is changed! |
It looks like it might be a separate issue -- the reported bug still exists, and core and std docs are still not equal for the trait implementations section. |
Apparently so. |
These signatures have changed entirely, I'm not sure if they're still wrong, but they are slightly different... |
Confusion in some form arises in the following code pub trait MyImpl<A> {
fn myimpl_fun<B>(&self, _: A) -> Option<B> {
None
}
}
pub struct MyStruct<B> {
_data: B,
}
impl<B> MyImpl<B> for MyStruct<B> {} Running the doc, we get impl<B> MyImpl<B> for MyStruct<B>
fn myimpl_fun<B>(&self, _: A) -> Option<B> In this case, the A should actually be a B, and the B's from the function something else. |
I believe this is a dupe of #14072, so closing in favor of that. |
Description
Recently I was looking in the docs for FilterMap, where it says:
However, it seems that not all
B
's must be the same type. The definition offilter_map
is namely:I believe this is due to the fact that the function
filter_map
is implemented forIterator<A>
and that FilterMap implementsIterator<B>
.The text was updated successfully, but these errors were encountered: