Skip to content

Commit b75defc

Browse files
authored
Merge pull request #2692 from rust-lang/tshepang/fuzzing
small improvements to fuzzing.md
2 parents eb07b87 + 89e9af4 commit b75defc

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/fuzzing.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
For the purposes of this guide, *fuzzing* is any testing methodology that
66
involves compiling a wide variety of programs in an attempt to uncover bugs in rustc.
77
Fuzzing is often used to find internal compiler errors (ICEs).
8-
Fuzzing can be beneficial, because it can find bugs before users run into them and
9-
provide small, self-contained programs that make the bug easier to track down.
8+
Fuzzing can be beneficial, because it can find bugs before users run into them.
9+
It also provides small, self-contained programs that make the bug easier to track down.
1010
However, some common mistakes can reduce the helpfulness of fuzzing and end up
1111
making contributors' lives harder.
1212
To maximize your positive impact on the Rust
@@ -22,7 +22,7 @@ project, please read this guide before reporting fuzzer-generated bugs!
2222
- Include a reasonably minimal, standalone example along with any bug report
2323
- Include all of the information requested in the bug report template
2424
- Search for existing reports with the same message and query stack
25-
- Format the test case with `rustfmt`, if it maintains the bug
25+
- Format the test case with `rustfmt`
2626
- Indicate that the bug was found by fuzzing
2727

2828
*Please don't:*
@@ -36,15 +36,17 @@ project, please read this guide before reporting fuzzer-generated bugs!
3636
If you're not sure whether or not an ICE is a duplicate of one that's already
3737
been reported, please go ahead and report it and link to issues you think might be related.
3838
In general, ICEs on the same line but with different *query stacks* are usually distinct bugs.
39-
For example, [#109020][#109020] and [#109129][#109129] had similar error messages:
39+
For example, [#109020] and [#109129] had similar error messages:
4040

4141
```
4242
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize <[closure@src/main.rs:36:25: 36:28] as std::ops::FnOnce<(Emplacable<()>,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead
4343
```
44+
4445
```
4546
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize <() as Project>::Assoc, maybe try to call `try_normalize_erasing_regions` instead
4647
```
47-
but different query stacks:
48+
49+
However, they have different query stacks:
4850
```
4951
query stack during panic:
5052
#0 [fn_abi_of_instance] computing call ABI of `<[closure@src/main.rs:36:25: 36:28] as core::ops::function::FnOnce<(Emplacable<()>,)>>::call_once - shim(vtable)`
@@ -64,7 +66,7 @@ end of query stack
6466

6567
When building a corpus, be sure to avoid collecting tests that are already known to crash rustc.
6668
A fuzzer that is seeded with such tests is more likely to
67-
generate bugs with the same root cause, wasting everyone's time.
69+
generate bugs with the same root cause.
6870
The simplest way to avoid this is to loop over each file in the corpus, see if it causes an
6971
ICE, and remove it if so.
7072

@@ -73,14 +75,14 @@ To build a corpus, you may want to use:
7375
- The rustc/rust-analyzer/clippy test suites (or even source code) --- though avoid
7476
tests that are already known to cause failures, which often begin with comments
7577
like `//@ failure-status: 101` or `//@ known-bug: #NNN`.
76-
- The already-fixed ICEs in the archived [Glacier][glacier] repository --- though
78+
- The already-fixed ICEs in the archived [Glacier] repository --- though
7779
avoid the unfixed ones in `ices/`!
7880

7981
[glacier]: https://github.com/rust-lang/glacier
8082

8183
## Extra credit
8284

83-
Here are a few things you can do to help the Rust project after filing an ICE.
85+
Here are a few things you can do to help the Rust project after filing an ICE:
8486

8587
- [Bisect][bisect] the bug to figure out when it was introduced.
8688
If you find the regressing PR / commit, you can mark the issue with the label `S-has-bisection`.
@@ -135,19 +137,18 @@ Of course, it's best to try multiple build configurations and see
135137
what actually results in superior throughput.
136138

137139
You may want to build rustc from source with debug assertions to find
138-
additional bugs, though this is a trade-off: it can slow down fuzzing by
140+
additional bugs, though this can slow down fuzzing by
139141
requiring extra work for every execution.
140142
To enable debug assertions, add this to `bootstrap.toml` when compiling rustc:
141143

142144
```toml
143-
[rust]
144-
debug-assertions = true
145+
rust.debug-assertions = true
145146
```
146147

147-
ICEs that require debug assertions to reproduce should be tagged
148-
[`requires-debug-assertions`][requires-debug-assertions].
148+
ICEs that require debug assertions to reproduce should be tagged
149+
[`requires-debug-assertions`].
149150

150-
[requires-debug-assertions]: https://github.com/rust-lang/rust/labels/requires-debug-assertions
151+
[`requires-debug-assertions`]: https://github.com/rust-lang/rust/labels/requires-debug-assertions
151152

152153
## Existing projects
153154

0 commit comments

Comments
 (0)