From e2ddf8a6e579ca1d92fdddd8bead46277c3261eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Christopher=20K=C3=B6hl?= Date: Sun, 4 Sep 2022 12:29:49 +0200 Subject: [PATCH] Add comment about downcast projection element --- compiler/rustc_mir_dataflow/src/value_analysis.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index f625f71ccda..80d343e2b53 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -582,7 +582,10 @@ impl Map { // Apply the projection. for &elem in projection { - // For now, downcast is not allowed (see #101168). + // For now, downcast is not allowed due to aliasing between variants (see #101168). + // Also, according to the documentation of [`Place`], a single-variant type can be + // projected with and without a [`ProjectionElem::Downcast`]. This creates an ambiguity + // that needs to be resolved. match elem { PlaceElem::Downcast(..) => return Err(()), _ => (),