Uh oh!
There was an error while loading. Please reload this page.
Add specific never search - #49757
Conversation
shepmaster
commented
Apr 7, 2018
novacrazy
commented
Apr 8, 2018
Would it not be better to add some kind of generic syntax alias system? For example, while this may fix searching for |
GuillaumeGomez
commented
Apr 8, 2018
This is an excellent point! I'll update this PR with these new adds. |
Maybe something like this? query=(function(){switch(raw){case'!': return"Never";case'?': return"try!";case'+': return"Add";case'-': return"Sub";case'%': return"Rem";case'[':
case']': return"Index";// and so forthdefault: returnraw;}})(); |
|
GuillaumeGomez
commented
Apr 8, 2018
I think I'll need to introduce a new syntax. Something like 'vec|Neg' and then it'll look for the both. What do you think of it? |
novacrazy
commented
Apr 8, 2018
Perhaps a comma would work better? As if it’s a list of search terms rather than a full expression. That would leave |
kennytm
commented
Apr 8, 2018
💡 Alternative: Allow items to register symbols as an alias index, like how the primitives are presented. Rationale: Non-std docs don't care about #[doc(primitive = "never")]#[doc(alias = "!")]/// blahmod prim_never {}#[doc(primitive = "slice")]#[doc(alias = "[]")]mod prim_slice {}#[doc(alias = "-")]pubtraitNeg{}#[doc(alias = "-")]pubtraitSub{} |
Is there a way to make a doc attribute like that require an unstable feature flag? That’s not really my area. I feel like it could be abused in crates, yet it should be allowed in crates on the rare occasion users need to define their own lang items, like with Edit: Can |
Yes, that's how |
GuillaumeGomez
commented
Apr 9, 2018
@kennytm: This is a brilliant idea. I'm just a bit afraid that people might misuse it though or that readers won't be aware of it, and therefore not use it... But this remains an excellent idea. I think I'll start implementing it. |
shepmaster
commented
Apr 9, 2018
You could put restrictions that the "alias" has to be non-word characters to start with. This might mitigate overall abuse. |
GuillaumeGomez
commented
Apr 9, 2018
Indeed! |
QuietMisdreavus
commented
Apr 9, 2018
+1 for adding a general mechanism. Adding a feature gate to a doc-attribute parameter is easy. The compiler already whitelists the doc attribute as a whole, so adding a check for a specific parameter just involves knowing the right place to put it.
@novacrazy Yes - as long as the compiler can build it, so can rustdoc. For example, libcore is a |
emilyalbini
commented
Apr 16, 2018
Blocked on #49966 |
kennytm
commented
Apr 16, 2018
@pietroalbini My alternative in #49757 (comment) wouldn't need #49966, though if the alternative is chosen, this PR should be closed or entirely rewritten. |
…tMisdreavus Multiple query search Part of rust-lang#49757. r? @QuietMisdreavus
bors
commented
Apr 17, 2018
☔ The latest upstream changes (presumably #50033) made this pull request unmergeable. Please resolve the merge conflicts. |
5891749 to
cadcf33CompareGuillaumeGomez
commented
Apr 18, 2018
@kennytm: Your doc alias can be the same for multiple types so it still strongly requires the multi-query feature. |
kennytm
commented
Apr 18, 2018
@GuillaumeGomez I don't think so, I expect there would be multiple dedicated entries named |
GuillaumeGomez
commented
Apr 19, 2018
Ok, here's all the implemented functionality. I finally went for last @kennytm's comment: no need for multiquery, I just add types at the beginning of the results and we're good! |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
We could delete this code now right? 😄
There was a problem hiding this comment.
Oh damn! Completely forgot about it 😆
5e2a223 to
d0e2d26CompareGuillaumeGomez
commented
Apr 21, 2018
Updated. |
QuietMisdreavus
commented
Apr 21, 2018
Looks good! One round of requests from me:
|
QuietMisdreavus
commented
Apr 21, 2018
Great, thanks so much! r=me pending travis. |
This comment has been minimized.
This comment has been minimized.
45c3923 to
1ed3e77Comparekennytm
commented
Apr 22, 2018
@bors r=QuietMisdreavus |
bors
commented
Apr 22, 2018
📌 Commit 1ed3e77 has been approved by |
bors
commented
Apr 22, 2018
Add specific never search Fixes#49529. r? @QuietMisdreavus
bors
commented
Apr 22, 2018
☀️ Test successful - status-appveyor, status-travis |

Fixes#49529.
r? @QuietMisdreavus