File tree Expand file tree Collapse file tree
compiler/rustc_mir_transform/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848//! # Handling of references
4949//!
5050//! We handle references by assigning a different "provenance" index to each Ref/RawPtr rvalue.
51- //! This ensure that we do not spuriously merge borrows that should not be merged. Meanwhile, we
52- //! consider all the derefs of an immutable reference to a freeze type to give the same value:
51+ //! This ensure that we do not spuriously merge borrows that should not be merged. For instance:
52+ //! ```ignore (MIR)
53+ //! _x = &_a;
54+ //! _a = 0;
55+ //! _y = &_a; // cannot be turned into `_y = _x`!
56+ //! ```
57+ //!
58+ //! On top of that, we consider all the derefs of an immutable reference to a freeze type to give
59+ //! the same value:
5360//! ```ignore (MIR)
5461//! _a = *_b // _b is &Freeze
5562//! _c = *_b // replaced by _c = _a
You can’t perform that action at this time.
0 commit comments