Skip to content

Commit 0be3ed0

Browse files
committed
rustdoc-search: update documentation with notes about unboxing
1 parent 246835e commit 0be3ed0

File tree

1 file changed

+18
-7
lines changed
  • src/doc/rustdoc/src/read-documentation

1 file changed

+18
-7
lines changed

src/doc/rustdoc/src/read-documentation/search.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,16 @@ will match these queries:
149149
* `&mut Read -> Result<Vec<u8>, Error>`
150150
* `Read -> Result<Vec<u8>, Error>`
151151
* `Read -> Result<Vec<u8>>`
152-
* `Read -> u8`
152+
* `Read -> Vec<u8>`
153153

154154
But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`,
155155
because those are nested incorrectly, and it does not match
156156
`Result<Error, Vec<u8>>` or `Result<Error>`, because those are
157-
in the wrong order.
157+
in the wrong order. It also does not match `Read -> u8`, because
158+
only [certain generic wrapper types] can be left out, and `Vec` isn't
159+
one of them.
160+
161+
[certain generic wrapper types]: #wrappers-that-can-be-omitted
158162

159163
To search for a function that accepts a function as a parameter,
160164
like `Iterator::all`, wrap the nested signature in parenthesis,
@@ -165,6 +169,18 @@ but you need to know which one you want.
165169

166170
[iterator-all]: ../../std/vec/struct.Vec.html?search=Iterator<T>%2C+(T+->+bool)+->+bool&filter-crate=std
167171

172+
### Wrappers that can be omitted
173+
174+
* References
175+
* Box
176+
* Rc
177+
* Arc
178+
* Option
179+
* Result
180+
* From
181+
* Into
182+
* Future
183+
168184
### Primitives with Special Syntax
169185

170186
| Shorthand | Explicit names |
@@ -234,11 +250,6 @@ Most of these limitations should be addressed in future version of Rustdoc.
234250
that you don't want a type parameter, you can force it to match
235251
something else by giving it a different prefix like `struct:T`.
236252

237-
* It's impossible to search for references or pointers. The
238-
wrapped types can be searched for, so a function that takes `&File` can
239-
be found with `File`, but you'll get a parse error when typing an `&`
240-
into the search field.
241-
242253
* Searching for lifetimes is not supported.
243254

244255
* It's impossible to search based on the length of an array.

0 commit comments

Comments
 (0)