Documentation

Miri.TreeBorrows.Permissions

Tree Borrows permission states and the per-node access transition function.

This is a port of transition::{child_read, foreign_read, child_write, foreign_write, perform_access} in the pinned Miri source: upstream/miri-source/src/borrow_tracker/tree_borrows/perms.rs. The corresponding upstream revision is 7fa591d7d4dd9af8154becbc8332f8096f8323b1 (blob 0dd4712b85c7d660eb0a4395223335b2b766062b).

This module models only one permission at one location. It does not model a borrow tree, provenance, memory, initialization, protector lifetime, or diagnostic transition history.

The activation states of a Tree Borrows pointer.

  • Cell : Permission

    A shared reference to interior mutable data.

  • ReservedFrz (conflicted : Bool) : Permission

    A local mutable reference not yet written through.

  • ReservedIM : Permission

    A reservation to interior mutable data.

  • Unique : Permission

    A unique pointer.

  • Frozen : Permission

    A shared, read-only pointer.

  • Disabled : Permission

    A disabled pointer.

Instances For
    Equations
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        The access kind used by Miri's borrow tracker.

        Instances For
          @[instance_reducible]
          Equations
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Whether an access is through this node or one of its children.

            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Outcomes of Miri's Option<PermissionPriv> transition function.

                UndefinedBehavior corresponds to upstream None for a forbidden child access. ImpossibleProtectedReservedIM preserves the upstream assert!(!protected) branches: those are invariant failures, not ordinary UB outcomes.

                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Apply the pinned Miri transition rules to one permission.

                    The dispatcher is the same four-way match as upstream on (kind, rel_pos.is_foreign()).

                    Equations
                    Instances For

                      Source ordering by reachability of permission transitions.

                      This captures the PartialOrd relation from PermissionPriv::partial_cmp: Cell is isolated; ReservedIM is incomparable with either ReservedFrz state; all remaining reachable states form the Reserved → Unique → Frozen → Disabled chain, with the conflicted Reserved state above the unconflicted one.

                      Equations
                      Instances For

                        Result corresponding to Rust's Option<Ordering> for the source PermissionPriv::partial_cmp.

                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Whether a local access to a permission is allowed by the wildcard cache.

                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Whether a foreign access can be skipped after a recorded subtree access.

                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Source order used by Miri: None < Read < Write.

                                      Equations
                                      Instances For
                                        Equations
                                        Instances For

                                          Convert an access and its relation to the cache's recorded-access value.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Result of the source skip check, including its debug assertion.

                                            Instances For
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Whether the recorded access allows skipping the next foreign access.

                                                  The source's debug_assert!(happeningNext.is_foreign()) is represented explicitly for calls outside its documented domain.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Update a recorded access exactly as the source record_new method does.

                                                    Equations
                                                    Instances For

                                                      Weaken a cache value when a newly inserted child has a weaker value.

                                                      Equations
                                                      Instances For

                                                        Strongest foreign action this node survives unchanged.

                                                        ImpossibleProtectedReservedIM preserves the upstream unreachable! branch as an invariant failure instead of treating it as an ordinary result.

                                                        Instances For
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For

                                                              Strongest local access that does not cause UB, used by wildcard tracking.

                                                              Equations
                                                              Instances For

                                                                A transition reconstructed by the source diagnostics and permission API.

                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      Equations
                                                                      Instances For

                                                                        Apply this transition only when the supplied starting permission matches.

                                                                        Equations
                                                                        Instances For
                                                                          Equations
                                                                          Instances For

                                                                            Permission-level result of the public source Permission::perform_access wrapper, retaining an explicit label for its invariant panic.

                                                                            Instances For
                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For

                                                                                Convert the per-node result to the source PermTransition wrapper form.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For

                                                                                  If the protector invariant holds, the two upstream assertion branches are unreachable. The invariant excludes only protected ReservedIM; Cell may be protected, as in upstream behavior.

                                                                                  theorem Miri.TreeBorrows.successful_transition_is_monotone (kind : AccessKind) (relPos : AccessRelatedness) (state next : Permission) (isProtected : Bool) (h : performAccess kind relPos state isProtected = AccessOutcome.Transition next) :
                                                                                  permissionLE state next = true

                                                                                  Every successful per-node transition is nondecreasing in Miri's source permission ordering.

                                                                                  Tree compaction always permits replacing a permission with itself.

                                                                                  The strongest-local-access summary agrees with the local read/write transition function: it allows exactly the accesses that are not UB.

                                                                                  A recorded local access resets SIFA regardless of the previous value.

                                                                                  A successful source transition can be applied only at its recorded source state, and then returns the recorded endpoint.

                                                                                  A permission marked idempotent under foreign reads really is unchanged by the source foreign-read transition.

                                                                                  A permission marked idempotent under foreign writes is unchanged by both foreign read and write transitions.