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> {
1109
1109
/// A temporary created during evaluating `if` predicate, possibly for pattern matching for `let`s,
1110
1110
/// and subject to Edition 2024 temporary lifetime rules
1111
1111
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.
1113
1117
DerefTemp ,
1114
1118
/// A temporary created for borrow checking.
1115
1119
FakeBorrow ,
Original file line number Diff line number Diff line change @@ -1487,11 +1487,13 @@ pub enum Rvalue<'tcx> {
1487
1487
/// A CopyForDeref is equivalent to a read from a place at the
1488
1488
/// codegen level, but is treated specially by drop elaboration. When such a read happens, it
1489
1489
/// 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
1492
1492
/// read never happened and just projects further. This allows simplifying various MIR
1493
1493
/// optimizations and codegen backends that previously had to handle deref operations anywhere
1494
1494
/// in a place.
1495
+ ///
1496
+ /// Disallowed in runtime MIR and is replaced by normal copies.
1495
1497
CopyForDeref ( Place < ' tcx > ) ,
1496
1498
1497
1499
/// Wraps a value in an unsafe binder.
You can’t perform that action at this time.
0 commit comments