Repository navigation
Commit 0f3f5da
committed
api: document a couple panicking preconditions
This brings the API documentation for `Span::offset` and
`packed::Searcher::find_in` into consistency with `Input::span`. That
is, if you try to set offsets that are incorrect for the provided
haystack (or are pathologically invalid), then you get a panic. This
mimics how, e.g., `&slice[range]` works.
This addresses a [RUSTSEC advisory proposal] for these omissions from
the docs. The proposed advisory misses the forest for the trees: if you
go out of your way to use invalid offsets, then you're going to have a
bad time. On top of that, offsets are rarely provided as inputs from
users. That is, offsets are usually _trusted_ information, which is why
it's reasonable to establish their correctness as a precondition.
[RUSTSEC advisory proposal]: rustsec/advisory-db#26841 parent e88e1fc commit 0f3f5da
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
505 | 509 | | |
506 | 510 | | |
507 | 511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
712 | 717 | | |
713 | 718 | | |
714 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
715 | 726 | | |
716 | 727 | | |
717 | 728 | | |
| |||
0 commit comments