Skip to content

Commit c514471

Browse files
committed
rustdoc-search: docs for reference syntax
1 parent 3c4e180 commit c514471

File tree

1 file changed

+9
-1
lines changed
  • src/doc/rustdoc/src/read-documentation

1 file changed

+9
-1
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ and number of matches. For example, a function with the signature
146146
`fn read_all(&mut self: impl Read) -> Result<Vec<u8>, Error>`
147147
will match these queries:
148148

149+
* `&mut Read -> Result<Vec<u8>, Error>`
149150
* `Read -> Result<Vec<u8>, Error>`
150151
* `Read -> Result<Error, Vec>`
151152
* `Read -> Result<Vec<u8>>`
@@ -166,6 +167,10 @@ but you need to know which one you want.
166167

167168
| Shorthand | Explicit names |
168169
| ---------------- | ------------------------------------------------- |
170+
| `&` | `primitive:reference` |
171+
| `&T` | `primitive:reference<T>` |
172+
| `&mut` | `primitive:reference<keyword:mut>` |
173+
| `&mut T` | `primitive:reference<keyword:mut, T>` |
169174
| `[]` | `primitive:slice` and/or `primitive:array` |
170175
| `[T]` | `primitive:slice<T>` and/or `primitive:array<T>` |
171176
| `()` | `primitive:unit` and/or `primitive:tuple` |
@@ -253,7 +258,8 @@ ident = *(ALPHA / DIGIT / "_")
253258
path = ident *(DOUBLE-COLON ident) [BANG]
254259
slice-like = OPEN-SQUARE-BRACKET [ nonempty-arg-list ] CLOSE-SQUARE-BRACKET
255260
tuple-like = OPEN-PAREN [ nonempty-arg-list ] CLOSE-PAREN
256-
arg = [type-filter *WS COLON *WS] (path [generics] / slice-like / tuple-like)
261+
borrow-ref = AMP *WS [MUT] *WS [arg]
262+
arg = [type-filter *WS COLON *WS] (path [generics] / slice-like / tuple-like / borrow-ref)
257263
type-sep = COMMA/WS *(COMMA/WS)
258264
nonempty-arg-list = *(type-sep) arg *(type-sep arg) *(type-sep) [ return-args ]
259265
generic-arg-list = *(type-sep) arg [ EQUAL arg ] *(type-sep arg [ EQUAL arg ]) *(type-sep)
@@ -310,6 +316,8 @@ COMMA = ","
310316
RETURN-ARROW = "->"
311317
EQUAL = "="
312318
BANG = "!"
319+
AMP = "&"
320+
MUT = "mut"
313321
314322
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
315323
DIGIT = %x30-39

0 commit comments

Comments
 (0)