@@ -127,6 +127,9 @@ pub enum AnalysisPhase {
127127 /// * [`StatementKind::AscribeUserType`]
128128 /// * [`StatementKind::Coverage`] with [`CoverageKind::BlockMarker`] or [`CoverageKind::SpanMarker`]
129129 /// * [`Rvalue::Ref`] with `BorrowKind::Fake`
130+ /// * [`CastKind::PointerCoercion`] with any of the following:
131+ /// * [`PointerCoercion::ArrayToPointer`]
132+ /// * [`PointerCoercion::MutToConstPointer`]
130133 ///
131134 /// Furthermore, `Deref` projections must be the first projection within any place (if they
132135 /// appear at all)
@@ -1284,8 +1287,7 @@ pub enum Rvalue<'tcx> {
12841287 ///
12851288 /// This allows for casts from/to a variety of types.
12861289 ///
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.
12891291 Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
12901292
12911293 /// * `Offset` has the same semantics as [`offset`](pointer::offset), except that the second
@@ -1365,6 +1367,13 @@ pub enum CastKind {
13651367 PointerWithExposedProvenance ,
13661368 /// Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
13671369 /// 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.
13681377 PointerCoercion ( PointerCoercion ) ,
13691378 /// Cast into a dyn* object.
13701379 DynStar ,
0 commit comments