rust/library/alloc/src
Yuki Okushi ab1ae48cce
Rollup merge of #96568 - EliasHolzmann:fmt_doc_fixes, r=joshtriplett
std::fmt: Various fixes and improvements to documentation

This PR contains the following changes:

- **Added argument index comments to examples for specifying precision**

  The examples for specifying the precision have comments explaining which
  argument the specifier is referring to. However, for implicit positional
  arguments, the examples simply refer to "next arg". To simplify following the
  comments, "next arg" was supplemented with the actual resulting argument index.

- **Fixed documentation for specifying precision via `.*`**

  The documentation stated that in case of the syntax `{<arg>:<spec>.*}`, "the
  `<arg>` part refers to the value to print, and the precision must come in the
  input preceding `<arg>`". This is not correct: the <arg> part does indeed refer
  to the value to print, but the precision does not come in the input preciding
  arg, but in the next implicit input (as if specified with {}).

  Fixes #96413.

- **Fix the grammar documentation**

  According to the grammar documented, the format specifier `{: }` should not be
  legal because of the whitespace it contains. However, in reality, this is
  perfectly fine because the actual implementation allows spaces before the
  closing brace. Fixes #71088.

  Also, the exact meaning of most of the terminal symbols was not specified, for
  example the meaning of `identifier`.

- **Removed reference to Formatter::buf and other private fields**

  Formatter::buf is not a public field and therefore isn't very helpful in user-
  facing documentation. Also, the other public fields of Formatter were removed
  during stabilization of std::fmt (4af3494bb0) and can only be accessed via
  getters.

- **Improved list of formatting macros**

  Two improvements:
  1. write! can not only receive a `io::Write`, but also a `fmt::Write` as first argument.
  2. The description texts now contain links to the actual macros for easier
     navigation.
2022-05-02 10:41:58 +09:00
..
alloc Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
boxed Add ThinBox type for 1 stack pointer sized heap allocated trait objects 2022-04-08 09:00:16 -07:00
collections Rollup merge of #94126 - ssomers:alloc_prep_1, r=Mark-Simulacrum 2022-05-02 10:41:54 +09:00
ffi Fix targets not supporting target_has_atomic = "ptr" 2022-04-14 21:53:11 +03:00
raw_vec Add a unit test for zero-sized types in RawVec. 2021-11-26 19:30:45 +11:00
rc Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
sync Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
vec Rollup merge of #96222 - jmaargh:john-mark/clarify-from-raw-parts-docs, r=JohnTitor 2022-05-02 10:41:55 +09:00
alloc.rs trivial cfg(bootstrap) changes 2022-04-05 23:18:40 +02:00
borrow.rs Rollup merge of #94022 - jongiddy:cow-into-owned-docs, r=Dylan-DPC 2022-04-26 13:22:26 +02:00
boxed.rs impl const Default for Box<[T]> and Box<str> 2022-04-11 12:14:18 -07:00
fmt.rs std::fmt: Improved list of formatting macros 2022-05-01 15:27:41 +02:00
lib.rs library: Use type aliases to make CStr(ing) in libcore/liballoc unstable 2022-04-14 21:53:11 +03:00
macros.rs alloc: make vec! unavailable under no_global_oom_handling 2022-04-16 06:31:41 +02:00
raw_vec.rs formatting 2022-04-06 01:36:46 +05:30
rc.rs Auto merge of #96078 - udoprog:refcounted-str-to-u8, r=dtolnay 2022-05-01 06:41:59 +00:00
slice.rs library: Move CStr to libcore, and CString to liballoc 2022-04-14 21:53:11 +03:00
str.rs trivial cfg(bootstrap) changes 2022-04-05 23:18:40 +02:00
string.rs Clarify docs for from_raw_parts 2022-04-19 21:12:55 +01:00
sync.rs Bump shared_from_str to Rust 1.62.0 2022-04-30 23:40:35 -07:00
task.rs Document From implementations for Waker and RawWaker 2021-04-22 14:16:33 -07:00
tests.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00