From 25fdd416993b490d569ce3bf96f11057857daeff Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 24 Jun 2024 10:51:49 +0200 Subject: [PATCH 1/2] clarify the warning shown when optimizations are enabled --- src/bin/miri.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 829bfa7cd7..9d8e44ce40 100644 --- a/src/bin/miri.rs +++ b/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 \ From 4f7bc6ad8698d581a4ec25c44a06586feacd0964 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 24 Jun 2024 10:54:26 +0200 Subject: [PATCH 2/2] clarify the status of Tree Borrows --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b4f2f8306..87b437a308 100644 --- a/README.md +++ b/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=` 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