@@ -127,6 +127,9 @@ pub enum AnalysisPhase {
127
127
/// * [`StatementKind::AscribeUserType`]
128
128
/// * [`StatementKind::Coverage`] with [`CoverageKind::BlockMarker`] or [`CoverageKind::SpanMarker`]
129
129
/// * [`Rvalue::Ref`] with `BorrowKind::Fake`
130
+ /// * [`CastKind::PointerCoercion`] with any of the following:
131
+ /// * [`PointerCoercion::ArrayToPointer`]
132
+ /// * [`PointerCoercion::MutToConstPointer`]
130
133
///
131
134
/// Furthermore, `Deref` projections must be the first projection within any place (if they
132
135
/// appear at all)
@@ -1284,8 +1287,7 @@ pub enum Rvalue<'tcx> {
1284
1287
///
1285
1288
/// This allows for casts from/to a variety of types.
1286
1289
///
1287
- /// **FIXME**: Document exactly which `CastKind`s allow which types of casts. Figure out why
1288
- /// `ArrayToPointer` and `MutToConstPointer` are special.
1290
+ /// **FIXME**: Document exactly which `CastKind`s allow which types of casts.
1289
1291
Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
1290
1292
1291
1293
/// * `Offset` has the same semantics as [`offset`](pointer::offset), except that the second
@@ -1365,6 +1367,13 @@ pub enum CastKind {
1365
1367
PointerWithExposedProvenance ,
1366
1368
/// Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
1367
1369
/// translated into `&raw mut/const *r`, i.e., they are not actually casts.
1370
+ ///
1371
+ /// The following are allowed in [`AnalysisPhase::Initial`] as they're needed for borrowck,
1372
+ /// but after that are forbidden (including in all phases of runtime MIR):
1373
+ /// * [`PointerCoercion::ArrayToPointer`]
1374
+ /// * [`PointerCoercion::MutToConstPointer`]
1375
+ ///
1376
+ /// Both are runtime nops, so should be [`CastKind::PtrToPtr`] instead in runtime MIR.
1368
1377
PointerCoercion ( PointerCoercion ) ,
1369
1378
/// Cast into a dyn* object.
1370
1379
DynStar ,
0 commit comments