-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-iteratorsArea: IteratorsArea: IteratorsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Context: #70750 (comment)
We have some uses of default fn
in src/libcore/adapters/fuse.rs
which allow users to specialize those functions. Instead, these default fn
s should be moved into internal (private) traits so that the specialization isn't exposed.
This issue has been assigned to @rakshith-ravi via this comment.
Metadata
Metadata
Assignees
Labels
A-iteratorsArea: IteratorsArea: IteratorsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
rakshith-ravi commentedon Apr 6, 2020
Supp. Can I take this up?
Oh also, the file is in
src/libcore/iter/adapters/fuse.rs
notsrc/libcore/adapters/fuse.rs
. Had me confused for a while, but picked it up from context of the other PR, just saying.cuviper commentedon Apr 6, 2020
@rustbot assign @rakshith-ravi
cuviper commentedon Apr 6, 2020
I fear what the extra indirection will do to #70332, but I guess we'll just have to see...
rakshith-ravi commentedon Apr 6, 2020
Alright. I'll go through that as well and suggest changes there, in case I can think of any.
Unlike my last PR, this time, I'd like to give this a shot without any mentoring. However, if I get stuck somewhere, I might request for help. Bear with me please.
Anyways, it's a little too late for me here (IST). Will get on it first thing tomorrow morning. Thanks
cuviper commentedon Apr 6, 2020
It's also possible that could work out better if there's a way for
Chain
to directly reach the non-specialized version, rather than shimming its ownDefuse
to avoidFusedIterator
effects.rakshith-ravi commentedon Apr 7, 2020
So if I understand the situation correctly, we need to have
Iterator
inherit fromIteratorInternal
or something like that, which allows for specialization and perform all our specialized work on that, while not exposing thedefault fn
s to anything outside the crate, yes?This will also mean that
Iterator
will provide a blanket implementation that uses theIteratorInternal
's implementation.rakshith-ravi commentedon Apr 7, 2020
I don't think I entirely understand what you're saying. Could you help me clarify that please?
cuviper commentedon Apr 7, 2020
We definitely don't want to change the
Iterator
trait, if that's what you mean. I would look atZip
and itsZipImpl
to see how that's privately specialized.My thought was that we could make #70332 use some internal part of your work, e.g.
FuseImpl
, to bypass some of the nested calls. But now I'm also trying anotherChain
independent ofFuse
in #70896 which I think is promising...rakshith-ravi commentedon Apr 7, 2020
Alrighty. Let me know if #70322 requires something specific so that I can implement it accordingly. Would be happy to dive deep into this.
rakshith-ravi commentedon Apr 7, 2020
Yup, an implementation similar to
ZipImpl
is exactly what I meant. I'll get right on it thenRollup merge of rust-lang#70910 - rakshith-ravi:master, r=cuviper