Skip to content

Rollup of 6 pull requests #31646

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

Merged
merged 4 commits into from
Feb 16, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc pages: add the ability to search unknown types
This enables `*` in all type positions in doc searches, which I often
want in order to find functions that create or convert specific
types (e.g. `* -> vec`) but I don't actually know what kinds of input
they expect.

I actually started working on this because of #31598, but I've wanted it
several times when exploring new crates.
quodlibetor authored and Manishearth committed Feb 15, 2016
commit 17691af38d68755ffa0ff1d5752bdfbe57264abd
2 changes: 1 addition & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ r##"<!DOCTYPE html>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
@@ -280,7 +280,7 @@
var parts = val.split("->").map(trimmer);
var input = parts[0];
// sort inputs so that order does not matter
var inputs = input.split(",").map(trimmer).sort();
var inputs = input.split(",").map(trimmer).sort().toString();
var output = parts[1];

for (var i = 0; i < nSearchWords; ++i) {
@@ -296,8 +296,8 @@

// allow searching for void (no output) functions as well
var typeOutput = type.output ? type.output.name : "";
if (inputs.toString() === typeInputs.toString() &&
output == typeOutput) {
if ((inputs === "*" || inputs === typeInputs.toString()) &&
(output === "*" || output == typeOutput)) {
results.push({id: i, index: -1, dontValidate: true});
}
}