File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
compiler/rustc_middle/src/mir Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1109,7 +1109,11 @@ pub enum LocalInfo<'tcx> {
11091109 /// A temporary created during evaluating `if` predicate, possibly for pattern matching for `let`s,
11101110 /// and subject to Edition 2024 temporary lifetime rules
11111111 IfThenRescopeTemp { if_then : HirId } ,
1112- /// A temporary created during the pass `Derefer` to avoid it's retagging
1112+ /// A temporary created during the pass `Derefer` treated as a transparent alias
1113+ /// for the place its copied from by analysis passes such as `AddRetag` and `ElaborateDrops`.
1114+ ///
1115+ /// It may only be written to by a `CopyForDeref` and otherwise only accessed through a deref.
1116+ /// In runtime MIR, it is replaced with a normal `Boring` local.
11131117 DerefTemp ,
11141118 /// A temporary created for borrow checking.
11151119 FakeBorrow ,
Original file line number Diff line number Diff line change @@ -1487,11 +1487,13 @@ pub enum Rvalue<'tcx> {
14871487 /// A CopyForDeref is equivalent to a read from a place at the
14881488 /// codegen level, but is treated specially by drop elaboration. When such a read happens, it
14891489 /// is guaranteed (via nature of the mir_opt `Derefer` in rustc_mir_transform/src/deref_separator)
1490- /// that the only use of the returned value is a deref operation, immediately
1491- /// followed by one or more projections. Drop elaboration treats this rvalue as if the
1490+ /// that the returned value is written into a `DerefTemp` local and that its only use is a deref operation,
1491+ /// immediately followed by one or more projections. Drop elaboration treats this rvalue as if the
14921492 /// read never happened and just projects further. This allows simplifying various MIR
14931493 /// optimizations and codegen backends that previously had to handle deref operations anywhere
14941494 /// in a place.
1495+ ///
1496+ /// Disallowed in runtime MIR and is replaced by normal copies.
14951497 CopyForDeref ( Place < ' tcx > ) ,
14961498
14971499 /// Wraps a value in an unsafe binder.
You can’t perform that action at this time.
0 commit comments