Skip to content

Commit 5de7dd6

Browse files
langston-barrettcompiler-errors
authored andcommitted
Address review comments
1 parent 5531ed7 commit 5de7dd6

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

src/fuzzing.md

+35-8
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,43 @@ project, please read this guide before reporting fuzzer-generated bugs!
2222
- Include all of the information requested in the bug report template
2323
- Search for existing reports with the same message and query stack
2424
- Format the test case with `rustfmt`, if it maintains the bug
25+
- Indicate that the bug was found by fuzzing
2526

2627
*Please don't:*
2728

2829
- Report lots of bugs that use internal features, including but not limited to
29-
`custom_mir`, `lang_items`, `no_std`, and `rustc_attrs`.
30+
`custom_mir`, `lang_items`, `no_core`, and `rustc_attrs`.
3031
- Seed your fuzzer with inputs that are known to crash rustc (details below).
3132

3233
### Discussion
3334

3435
If you're not sure whether or not an ICE is a duplicate of one that's already
3536
been reported, please go ahead and report it and link to issues you think might
3637
be related. In general, ICEs on the same line but with different *query stacks*
37-
are usually distinct bugs.
38+
are usually distinct bugs. For example, [#109020][#109202] and [#109129][#109129]
39+
had similar error messages:
40+
41+
```
42+
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
43+
```
44+
```
45+
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
46+
```
47+
but different query stacks:
48+
```
49+
query stack during panic:
50+
#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)`
51+
end of query stack
52+
```
53+
```
54+
query stack during panic:
55+
#0 [check_mod_attrs] checking attributes in top-level module
56+
#1 [analysis] running analysis passes on this crate
57+
end of query stack
58+
```
59+
60+
[#109020]: https://github.com/rust-lang/rust/issues/109020
61+
[#109129]: https://github.com/rust-lang/rust/issues/109129
3862

3963
## Building a corpus
4064

@@ -56,19 +80,19 @@ To build a corpus, you may want to use:
5680

5781
Here are a few things you can do to help the Rust project after filing an ICE.
5882

59-
- Add the minimal test case to [Glacier][glacier]
6083
- [Bisect][bisect] the bug to figure out when it was introduced
6184
- Fix unrelated problems with the test case (things like syntax errors or
6285
borrow-checking errors)
6386
- Minimize the test case (see below)
87+
- Add the minimal test case to [Glacier][glacier]
6488

6589
[bisect]: https://github.com/rust-lang/cargo-bisect-rustc/blob/master/TUTORIAL.md
6690

6791
## Minimization
6892

69-
It can be helpful to *minimize* the fuzzer-generated input. When minimizing, be
70-
careful to preserve the original error, and avoid introducing distracting
71-
problems such as syntax, type-checking, or borrow-checking errors.
93+
It is helpful to carefully *minimize* the fuzzer-generated input. When
94+
minimizing, be careful to preserve the original error, and avoid introducing
95+
distracting problems such as syntax, type-checking, or borrow-checking errors.
7296

7397
There are some tools that can help with minimization. If you're not sure how
7498
to avoid introducing syntax, type-, and borrow-checking errors while using
@@ -86,10 +110,13 @@ these tools, post both the complete and minimized test cases. Generally,
86110
When fuzzing rustc, you may want to avoid generating code, since this is mostly
87111
done by LLVM. Try `--emit=mir` instead.
88112

89-
A variety of compiler flags can uncover different issues.
113+
A variety of compiler flags can uncover different issues. `-Zmir-opt=4` will
114+
turn on MIR optimization passes that are not run by default, potentially
115+
uncovering interesting bugs.
90116

91117
If you're fuzzing a compiler you built, you may want to build it with `-C
92-
target-cpu=native` to squeeze out a few more executions per second.
118+
target-cpu=native` or even PGO/BOLT to squeeze out a few more executions per
119+
second.
93120

94121
## Existing projects
95122

0 commit comments

Comments
 (0)