diff options
| author | cjkenn <cjkenn@users.noreply.github.com> | 2020-11-20 14:51:29 -0500 |
|---|---|---|
| committer | Joshua Nelson <joshua@yottadb.com> | 2020-11-22 08:43:00 -0500 |
| commit | 157db48097637eec482abac07551033dea57b2e1 (patch) | |
| tree | e0d1072ed6ab600d73138c20e40e463ea69b4bc6 /src/doc/rustc-dev-guide | |
| parent | 462fd32ac3a7151ff0498112dc1c5ef39b724908 (diff) | |
| download | rust-157db48097637eec482abac07551033dea57b2e1.tar.gz rust-157db48097637eec482abac07551033dea57b2e1.zip | |
add small explanation of why fuel can be useful for debugging
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/mir/optimizations.md | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/doc/rustc-dev-guide/src/mir/optimizations.md b/src/doc/rustc-dev-guide/src/mir/optimizations.md index b34520f353d..080c8fd3fb0 100644 --- a/src/doc/rustc-dev-guide/src/mir/optimizations.md +++ b/src/doc/rustc-dev-guide/src/mir/optimizations.md @@ -65,8 +65,10 @@ current level using `tcx.sess.opts.debugging_opts.mir_opt_level`. Optimization fuel is a compiler option (`-Z fuel=<crate>=<value>`) that allows for fine grained control over which optimizations can be applied during compilation: each optimization reduces -fuel by 1, and when fuel reaches 0 no more optimizations are applied. This can help with debugging -and identifying problems with optimizations. +fuel by 1, and when fuel reaches 0 no more optimizations are applied. The primary use of fuel +is debugging optimizations that may be incorrect or misapplied. By changing the fuel +value, you can bisect a compilation session down to the exact incorrect optimization +(this behaves like a kind of binary search through the optimizations). MIR optimizations respect fuel, and in general each pass should check fuel by calling [`tcx.consider_optimizing`][consideroptimizing] and skipping the optimization if fuel |
