Skip to content

Search over generic types in docs - #45673

Merged
bors merged 6 commits into
rust-lang:masterfrom
GuillaumeGomez:rustdoc-type-search-generic
Nov 13, 2017
Merged

Search over generic types in docs#45673
bors merged 6 commits into
rust-lang:masterfrom
GuillaumeGomez:rustdoc-type-search-generic

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

This is what I was talking about @QuietMisdreavus. Now we have generics.

Waiting for #45617 to get merged.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @QuietMisdreavus

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytmkennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 1, 2017
@GuillaumeGomezGuillaumeGomez mentioned this pull request Nov 1, 2017
@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-type-search-generic branch 3 times, most recently from fc2fb75 to 6f88227CompareNovember 1, 2017 23:54
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

It's now fully functional. You can look for type as generic parameters and look for types such as "Result". A little screenshot of the last commit:

screen shot 2017-11-02 at 01 02 13

@GuillaumeGomezGuillaumeGomez changed the title [WIP] Only search over generic types in docsOnly search over generic types in docsNov 3, 2017
@GuillaumeGomezGuillaumeGomez changed the title Only search over generic types in docsSearch over generic types in docsNov 3, 2017
@QuietMisdreavus

Copy link
Copy Markdown
Contributor

Shouldn't some of these be in the "As return value" instead?

image

I would expect the "As return value" tab to prioritize perfect matches of one of the type variables over ones that have no type variables but have a low lev score:

image

For public perusal, i have a rendering of the current PR here.

@QuietMisdreavus

Copy link
Copy Markdown
Contributor

Now that #45617 is merged, can you rebase on top of it to factor out the commits that were taken from there?

Comment threadsrc/librustdoc/html/static/main.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think numElements would be a better name for this.

Comment threadsrc/librustdoc/html/static/main.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this would be better off on the same line.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, only issue: line > 100 columns. :)

Comment threadsrc/librustdoc/html/static/main.js Outdated

@projektirprojektirNov 7, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is literalSearch === true in other parts of the code.

Comment threadsrc/librustdoc/html/static/main.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@shepmastershepmaster added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2017
@shepmaster

Copy link
Copy Markdown
Member

Ping from triage — @GuillaumeGomez will you be able to address some of the feedback you've received?

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

I'll be able to address all of them.

@bors

bors commented Nov 11, 2017

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #45932) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-type-search-generic branch from 597a82f to 942a4e9CompareNovember 11, 2017 22:26
@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Updated.

@QuietMisdreavus

Copy link
Copy Markdown
Contributor

This still seems to have a problem of taking all the items that should be in "As parameters" and putting them into "Types/modules" instead.

Your PR:

image

image

Current nightly:

image

image

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Hum, still not good then... Let's see what's happening.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

Ok, the mystery has been solved: I forgot to add the results into the tab. We're good now. :)

@QuietMisdreavusQuietMisdreavus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Home stretch! With that last change, this totally works. Just one last nit and i'll be ready to call it good.

Comment threadsrc/librustdoc/html/render.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just reuse Type::generics rather than copying it out? That way, if other Types support generics, both this and the "document impls when the type appears in the traits generics" benefit.

@GuillaumeGomez
GuillaumeGomezforce-pushed the rustdoc-type-search-generic branch from 2246728 to 0e4c829CompareNovember 12, 2017 20:38
@QuietMisdreavus

Copy link
Copy Markdown
Contributor

Excellent! r=me pending travis.

Thanks so much for doing this! This makes the extended search tabs much nicer.

@GuillaumeGomez

Copy link
Copy Markdown
MemberAuthor

@bors: r=QuietMisdreavus

@bors

bors commented Nov 12, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 0e4c829 has been approved by QuietMisdreavus

@bors

bors commented Nov 13, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 0e4c829 with merge c8c1424...

bors added a commit that referenced this pull request Nov 13, 2017
…QuietMisdreavus
Search over generic types in docs
This is what I was talking about @QuietMisdreavus. Now we have generics.
Waiting for #45617 to get merged.
@bors

bors commented Nov 13, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: QuietMisdreavus
Pushing c8c1424 to master...

@bors
bors merged commit 0e4c829 into rust-lang:masterNov 13, 2017
@GuillaumeGomez
GuillaumeGomez deleted the rustdoc-type-search-generic branch November 13, 2017 09:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@GuillaumeGomez@rust-highfive@QuietMisdreavus@shepmaster@bors@projektir@kennytm