1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Per-call working lists on the heap, grown only fallibly: every growth
//! goes through [`try_push`] — `try_reserve`, then `push` behind the very
//! test `push` makes (`len < capacity`) — so `push`'s infallible-growth
//! branch, and the capacity-overflow / allocation-failure panic behind it,
//! is provably dead and not linked (B12). That needs `Vec::push` inlined
//! next to the test, which at `opt-level = "z"` LLVM does only for a function
//! with a single caller: so each `Vec<T>::push` has exactly one call site,
//! inside [`Scratch::push`], which is kept out of line (one copy per `T`).
//! A failed reservation is reported to the caller, never an abort.
//!
//! A list that stays empty allocates nothing, so a message without
//! declarations, options or selectors formats without allocating.
use Vec;
/// Appends `t` to `v` with fallible growth; `false` (and `t` dropped) if the
/// memory could not be reserved. Always inlined: the test must sit next to
/// `push` for the growth branch to be dead (the module docs).
pub
/// A list of `T` (see the module documentation).
pub ;