@@ -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)
@@ -1281,8 +1284,7 @@ pub enum Rvalue<'tcx> {
1281
1284
///
1282
1285
/// This allows for casts from/to a variety of types.
1283
1286
///
1284
- /// **FIXME**: Document exactly which `CastKind`s allow which types of casts. Figure out why
1285
- /// `ArrayToPointer` and `MutToConstPointer` are special.
1287
+ /// **FIXME**: Document exactly which `CastKind`s allow which types of casts.
1286
1288
Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
1287
1289
1288
1290
/// * `Offset` has the same semantics as [`offset`](pointer::offset), except that the second
@@ -1362,6 +1364,13 @@ pub enum CastKind {
1362
1364
PointerWithExposedProvenance ,
1363
1365
/// Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
1364
1366
/// translated into `&raw mut/const *r`, i.e., they are not actually casts.
1367
+ ///
1368
+ /// The following are allowed in [`AnalysisPhase::Initial`] as they're needed for borrowck,
1369
+ /// but after that are forbidden (including in all phases of runtime MIR):
1370
+ /// * [`PointerCoercion::ArrayToPointer`]
1371
+ /// * [`PointerCoercion::MutToConstPointer`]
1372
+ ///
1373
+ /// Both are runtime nops, so should be [`CastKind::PtrToPtr`] instead in runtime MIR.
1365
1374
PointerCoercion ( PointerCoercion ) ,
1366
1375
/// Cast into a dyn* object.
1367
1376
DynStar ,
0 commit comments