Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/src/challenges/0010-string.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ Verify the memory safety of all public functions that are safe abstractions over
1. `pop`
1. `remove`
1. `remove_matches` (unbounded)

Any `Pattern` implementation used to verify `remove_matches` must uphold the
[safety contract of `Pattern`](https://doc.rust-lang.org/nightly/std/str/pattern/trait.Pattern.html#safety).
Its searcher's `haystack()` must return the same slice passed to `into_searcher`.

1. `retain` (unbounded)
1. `insert`
1. `insert_str` (unbounded)
Expand Down
7 changes: 6 additions & 1 deletion doc/src/challenges/0020-str-pattern-pt1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ Those functions are implemented in (library/core/src/str/mod.rs), but the core o
**Important note:** for this challenge, you can assume:
1. The safety and functional correctness of all functions in `slice` module.
2. That all functions in (library/core/src/str/validations.rs) are functionally correct (consistent with the UTF-8 encoding description in https://en.wikipedia.org/wiki/UTF-8).
3. That all the Searchers in (library/core/src/str/iter.rs) are created by the into_searcher(_, haystack) with haystack being a valid UTF-8 string (str). You can assume any UTF-8 string property of haystack.

The [safety contract of `Pattern`](https://doc.rust-lang.org/nightly/std/str/pattern/trait.Pattern.html#safety)
requires a searcher returned by `into_searcher` to search the supplied haystack.
In particular, `Searcher::haystack()` must return the same `&str` slice passed to
`into_searcher`. Any `Pattern` implementation used in a proof harness must
uphold this guarantee.

Verify the safety of the functions in (library/core/src/str/pattern.rs) listed in the next section.

Expand Down
7 changes: 6 additions & 1 deletion doc/src/challenges/0021-str-pattern-pt2.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ Those functions are implemented in (library/core/src/str/mod.rs), but the core o
**Important note:** for this challenge, you can assume:
1. The safety and functional correctness of all functions in `slice` module.
2. That all functions in (library/core/src/str/validations.rs) are functionally correct (consistent with the UTF8 encoding description in https://en.wikipedia.org/wiki/UTF-8).
3. That all the Searchers in (library/core/src/str/iter.rs) are created by the into_searcher(_, haystack) with haystack is a valid utf8 string (str). You can assume any utf8 string property of haystack.

The [safety contract of `Pattern`](https://doc.rust-lang.org/nightly/std/str/pattern/trait.Pattern.html#safety)
requires a searcher returned by `into_searcher` to search the supplied haystack.
In particular, `Searcher::haystack()` must return the same `&str` slice passed to
`into_searcher`. Any `Pattern` implementation used in a proof harness must
uphold this guarantee.

Verify the safety of the functions in (library/core/src/str/pattern.rs) listed in the next section.

Expand Down
5 changes: 4 additions & 1 deletion doc/src/challenges/0022-str-iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ String and `str` types are widely used in Rust programs, so it is important that

**Important note:** for this challenge, you can assume:
1. The safety and functional correctness of all functions in `slice` module.
2. The safety and functional correctness of all functions in (library/core/src/str/pattern.rs).
2. The safety and functional correctness of all functions in (library/core/src/str/pattern.rs),
including the [safety contract of `Pattern`](https://doc.rust-lang.org/nightly/std/str/pattern/trait.Pattern.html#safety).
A `Pattern` implementation used in a proof harness must ensure that
`Searcher::haystack()` returns the same slice passed to `into_searcher`.
3. That all functions in (library/core/src/str/validations.rs) are functionally correct (consistent with the UTF-8 encoding description in https://en.wikipedia.org/wiki/UTF-8).
4. That all the Iterators in (library/core/src/str/iter.rs) are derived from a valid UTF-8 string (str) (You can assume any property of valid UTF-8 encoded string).

Expand Down
Loading