diff options
| author | pierwill <pierwill@users.noreply.github.com> | 2020-12-23 23:01:03 -0800 |
|---|---|---|
| committer | pierwill <pierwill@users.noreply.github.com> | 2020-12-25 14:02:52 -0800 |
| commit | a8775d44e9f273b8ec03a0a881f2dc6800eb3027 (patch) | |
| tree | 4987f199f58dbe7f24f28e8be6941a0b4d573790 /compiler/rustc_span/src/span_encoding.rs | |
| parent | 3d10d3e49d9784ba3833ccf5d56d0a4d15bb36f6 (diff) | |
| download | rust-a8775d44e9f273b8ec03a0a881f2dc6800eb3027.tar.gz rust-a8775d44e9f273b8ec03a0a881f2dc6800eb3027.zip | |
Edit rustc_span documentation
Various changes to the `rustc_span` docs, including the following: - Additions to top-level docs - Edits to the source_map module docs - Edits to documentation for `Span` and `SpanData` - Added intra-docs links - Documentation for Levenshtein distances - Fixed missing punctuation
Diffstat (limited to 'compiler/rustc_span/src/span_encoding.rs')
| -rw-r--r-- | compiler/rustc_span/src/span_encoding.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index b05e01d666b..ceb9b59b13a 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxIndexSet; /// A compressed span. /// -/// `SpanData` is 12 bytes, which is a bit too big to stick everywhere. `Span` +/// Whereas [`SpanData`] is 12 bytes, which is a bit too big to stick everywhere, `Span` /// is a form that only takes up 8 bytes, with less space for the length and /// context. The vast majority (99.9%+) of `SpanData` instances will fit within /// those 8 bytes; any `SpanData` whose fields don't fit into a `Span` are @@ -42,13 +42,11 @@ use rustc_data_structures::fx::FxIndexSet; /// - `base` is 32 bits in both `Span` and `SpanData`, which means that `base` /// values never cause interning. The number of bits needed for `base` /// depends on the crate size. 32 bits allows up to 4 GiB of code in a crate. -/// `script-servo` is the largest crate in `rustc-perf`, requiring 26 bits -/// for some spans. /// - `len` is 15 bits in `Span` (a u16, minus 1 bit for the tag) and 32 bits /// in `SpanData`, which means that large `len` values will cause interning. /// The number of bits needed for `len` does not depend on the crate size. -/// The most common number of bits for `len` are 0--7, with a peak usually at -/// 3 or 4, and then it drops off quickly from 8 onwards. 15 bits is enough +/// The most common numbers of bits for `len` are from 0 to 7, with a peak usually +/// at 3 or 4, and then it drops off quickly from 8 onwards. 15 bits is enough /// for 99.99%+ of cases, but larger values (sometimes 20+ bits) might occur /// dozens of times in a typical crate. /// - `ctxt` is 16 bits in `Span` and 32 bits in `SpanData`, which means that |
