Skip to content

add miri strong mode for tree borrows#154948

Closed
quiode wants to merge 2 commits intorust-lang:mainfrom
quiode:miri-writable
Closed

add miri strong mode for tree borrows#154948
quiode wants to merge 2 commits intorust-lang:mainfrom
quiode:miri-writable

Conversation

@quiode
Copy link
Copy Markdown

@quiode quiode commented Apr 7, 2026

This PR depends on #154946. It tries to address rust-lang/unsafe-code-guidelines#584 (comment). It is part of a bachelor thesis supervised by @JoJoDeveloping and @RalfJung, for more information, see: Project_Description.pdf.
In Tree Borrows, Miri now checks for spurious writes on function entry, if no_writable is not set. This means that all mutable references on function entry have to be writable, violating this is Undefined Behaviour. The compiler can then make use of this in #154949.

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 7, 2026
@quiode
Copy link
Copy Markdown
Author

quiode commented Apr 7, 2026

r? @RalfJung

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 7, 2026

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
PR_CI_JOB set; skipping tidy
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
downloading https://static.rust-lang.org/dist/2026-03-05/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz
---
To only update this specific test, also pass `--test-args cfg/suggest-alternative-name-on-target.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/cfg/suggest-alternative-name-on-target.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/cfg/suggest-alternative-name-on-target" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: unexpected `cfg` condition value: `arm`
##[error]  --> /checkout/tests/ui/cfg/suggest-alternative-name-on-target.rs:5:7
   |
---
LL | #![deny(unexpected_cfgs)]
   |         ^^^^^^^^^^^^^^^
help: `arm` is an expected value for `target_arch`
   |
LL - #[cfg(target_abi = "arm")]
LL + #[cfg(target_arch = "arm")]
   |

error: unexpected `cfg` condition value: `gnu`
##[error]  --> /checkout/tests/ui/cfg/suggest-alternative-name-on-target.rs:12:7
   |
LL | #[cfg(target_arch = "gnu")]
   |       ^^^^^^^^^^^^^^^^^^^
   |
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
help: `gnu` is an expected value for `target_env`
   |
LL - #[cfg(target_arch = "gnu")]
LL + #[cfg(target_env = "gnu")]
   |

error: unexpected `cfg` condition value: `openbsd`
##[error]  --> /checkout/tests/ui/cfg/suggest-alternative-name-on-target.rs:19:7
   |

@RalfJung
Copy link
Copy Markdown
Member

RalfJung commented Apr 7, 2026

Thanks!

Could you make a Miri PR that doesn't depend on #154946? It should be possible to have a flag like -Zmiri-tree-borrows-writable with all the new TB logic, without having a new attribute. Ideally that is submitted as a PR in https://github.com/rust-lang/miri.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 7, 2026

☔ The latest upstream changes (presumably #154958) made this pull request unmergeable. Please resolve the merge conflicts.

@quiode quiode closed this Apr 8, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants