-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
for purely return-type based searches, deprioritize clone-like functions #135302
for purely return-type based searches, deprioritize clone-like functions #135302
Conversation
r? @notriddle rustbot has assigned @notriddle. Use |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@notriddle do you know how to make |
update: looks like the issue was the minification was stripping the log statements, hacking my way around the minification fixed that |
second update: the workaround broke things catestrophically: #135345 |
I've usually worked around it by running the test case in a browser instead of the test harness. The docs for a
This way, search.js can be symlinked like normal, and you can try out queries against the test data without having to re-run the test harness. |
fair... but honestly i really just want to bring back i also really don't know what's going on here, to be honest. i feel like i'm doing everything right, but evidently i'm not. |
Do you mean the change to |
well, mainly that sometimes i get a test failure when running locally (the one you fixed with type.where_clause, maybe there was a cache invalidation issue). but anyways, i don't really think this should count generics, is there some way to turn off generic unification? maybe in one of those callbacks i don't really understand? |
This code only fires if there's at least one item in the return spot. Check if any of them have a negative |
but in the case of a search like also, the code also triggers when sorting the "in return types" section. |
an example of a type that should not be considered clone-like is |
ok it looks like that's not how generic unification works (right, they're universally quantified, not existentially), so the fix you recommended should work. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks again... I'm too used to having a typechecker, so I didn't even consider this as a possibility (I mean, even python would give a TypeError there) |
* @param {[FunctionType]} where_clause - Trait bounds for generic items. | ||
*/ | ||
function containsTypeFromQuery(list, where_clause) { | ||
if (!list) return false; |
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.
Please add parens (here an below) for coherency with the rest of the code.
Once ready, please squash your commits as well. And final point: should we start documenting how search items are ranked and (de)prioritized in the rustdoc book? |
i think adding a section in the rustdoc book about how results are sorted would be a good idea, yes |
A clone-like function in a function that takes as an argument the type that it returns. However, functions that return a type variable are not counted as clone-line. Because we're not unifying the whole function at once, a function like `U -> T` would otherwise be counted as "clone-like" because the generics will just unify with anything when done seperatly. Co-authored-by: Michael Howell <[email protected]>
a234b59
to
ebd5ce1
Compare
@bors r+ |
…-sort-134935, r=notriddle for purely return-type based searches, deprioritize clone-like functions closes rust-lang#134935
…-sort-134935, r=notriddle for purely return-type based searches, deprioritize clone-like functions closes rust-lang#134935
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#134940 (Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck) - rust-lang#135047 (Add gpu-kernel calling convention) - rust-lang#135228 (Improve `DispatchFromDyn` and `CoerceUnsized` impl validation) - rust-lang#135264 (Consider more erroneous layouts as `LayoutError::ReferencesError` to suppress spurious errors) - rust-lang#135302 (for purely return-type based searches, deprioritize clone-like functions) - rust-lang#135380 (Make sure we can produce `ConstArgHasWrongType` errors for valtree consts) - rust-lang#135425 (Do not consider traits that have unsatisfied const conditions to be conditionally const) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 11 pull requests Successful merges: - rust-lang#134913 (bootstrap: do not rely on LIBRARY_PATH env variable) - rust-lang#134940 (Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck) - rust-lang#135228 (Improve `DispatchFromDyn` and `CoerceUnsized` impl validation) - rust-lang#135264 (Consider more erroneous layouts as `LayoutError::ReferencesError` to suppress spurious errors) - rust-lang#135302 (for purely return-type based searches, deprioritize clone-like functions) - rust-lang#135353 (re-add --disable-minification to rustdoc) - rust-lang#135380 (Make sure we can produce `ConstArgHasWrongType` errors for valtree consts) - rust-lang#135423 (Enforce syntactical stability of const traits in HIR) - rust-lang#135425 (Do not consider traits that have unsatisfied const conditions to be conditionally const) - rust-lang#135499 (fix underlining of hovered intra-doc links.) - rust-lang#135505 (Fix clippy lints in rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135302 - lolbinarycat:rustdoc-search-return-sort-134935, r=notriddle for purely return-type based searches, deprioritize clone-like functions closes rust-lang#134935
closes #134935