-
Notifications
You must be signed in to change notification settings - Fork 14k
Search fixes #45617
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
Search fixes #45617
Conversation
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat.
I would have used indexOf/lastIndexOf to extract the substring instead of the split.slice.join.split.slice.join
function extractGenerics(val) {
var values = val.substring(val.indexOf('<')+1, val.lastIndexOf('>'));
return values.split(/\s*,\s*/);
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way better, thanks!
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to use name here? The check above says name won't contain any '<'...
(If this is expected why not just write tmp_valu = name.split(/\s*,\s*/)...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed... It should have been !== -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe not... Trying to understand what I was trying to do...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I was right: it should have been !== -1!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait a sec, this is ripping out the contents of the generics if both the type and the search query contain them? Am i reading this correctly? It seems like we should do that if isWrapper === false instead.
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you define this on Object (of all things) and not just as a free function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred it as is but I can make a free function if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think adding a static method for this on a core, well, Object is the way to go. This function probably shouldn't escape the scope of this file anyway.
50d3776 to
6b79f0e
Compare
QuietMisdreavus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm way shaky on everything that's going on in the last commit - it seems like the code that checks through generics should be thrown out since that needs to be in a separate PR anyway. (It's also unrelated to the linked issue.)
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be prudent to also include the "base name" in this? It looks like this throws away the "Result" in Result<File, Error>. From how this is used it seems like it wouldn't be included in Levenstein comparisons because of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the point. :)
src/librustdoc/html/static/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait a sec, this is ripping out the contents of the generics if both the type and the search query contain them? Am i reading this correctly? It seems like we should do that if isWrapper === false instead.
6ed3fd5 to
630957e
Compare
630957e to
5a63b01
Compare
|
Removed the genericity part. I'll put it directly in #45673. |
…. Thanks to @Seeker14491 for this one!
5a63b01 to
ee7e372
Compare
|
Thanks! This looks good to go now. @bors r+ |
|
📌 Commit ee7e372 has been approved by |
Search fixes Fixes #45608. r? @QuietMisdreavus
|
☀️ Test successful - status-appveyor, status-travis |
…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.
Fixes #45608.
r? @QuietMisdreavus