diff options
| author | bors <bors@rust-lang.org> | 2024-06-24 21:43:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-24 21:43:59 +0000 |
| commit | 8a8b357bf11ed4f7ba28916c5975f74dde55f0ea (patch) | |
| tree | 90981ea461f3199198eba469b3494ef11b4cf8c0 | |
| parent | 4f8dc8fa3e5e50ab024252397d272f773f3a2a8d (diff) | |
| parent | ba61c8f2a6ee3e874c1745d1471a16f4a1616290 (diff) | |
| download | rust-8a8b357bf11ed4f7ba28916c5975f74dde55f0ea.tar.gz rust-8a8b357bf11ed4f7ba28916c5975f74dde55f0ea.zip | |
Auto merge of #3709 - RalfJung:docs-clarifications, r=saethlin
clarify the warning shown when optimizations are enabled, and the status of Tree Borrows
| -rw-r--r-- | src/tools/miri/README.md | 8 | ||||
| -rw-r--r-- | src/tools/miri/src/bin/miri.rs | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 4b4f2f83062..87b437a3080 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -425,8 +425,12 @@ to Miri failing to detect cases of undefined behavior in a program. value from a load. This can help diagnose problems that disappear under `-Zmiri-disable-weak-memory-emulation`. * `-Zmiri-tree-borrows` replaces [Stacked Borrows] with the [Tree Borrows] rules. - The soundness rules are already experimental without this flag, but even more - so with this flag. + Tree Borrows is even more experimental than Stacked Borrows. While Tree Borrows + is still sound in the sense of catching all aliasing violations that current versions + of the compiler might exploit, it is likely that the eventual final aliasing model + of Rust will be stricter than Tree Borrows. In other words, if you use Tree Borrows, + even if your code is accepted today, it might be declared UB in the future. + This is much less likely with Stacked Borrows. * `-Zmiri-force-page-size=<num>` overrides the default page size for an architecture, in multiples of 1k. `4` is default for most targets. This value should always be a power of 2 and nonzero. * `-Zmiri-unique-is-unique` performs additional aliasing checks for `core::ptr::Unique` to ensure diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index 829bfa7cd70..9d8e44ce409 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -98,10 +98,9 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { } if tcx.sess.opts.optimize != OptLevel::No { - tcx.dcx().warn("Miri does not support optimizations. If you have enabled optimizations \ - by selecting a Cargo profile (such as --release) which changes other profile settings \ - such as whether debug assertions and overflow checks are enabled, those settings are \ - still applied."); + tcx.dcx().warn("Miri does not support optimizations: the opt-level is ignored. The only effect \ + of selecting a Cargo profile that enables optimizations (such as --release) is to apply \ + its remaining settings, such as whether debug assertions and overflow checks are enabled."); } if tcx.sess.mir_opt_level() > 0 { tcx.dcx().warn("You have explicitly enabled MIR optimizations, overriding Miri's default \ |
