about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-05-04 17:13:15 +0900
committerGitHub <noreply@github.com>2022-05-04 17:13:15 +0900
commit731ad8a3c157ff85dc2509eb31f67f7f2b5a3169 (patch)
treece964525f0980a17aebbad6a087fabcc4bfbfd08
parentd0a7a4c6e65017fb50e8734e65cd04282bf1e461 (diff)
parenta63d414031dc0cb4af3e3e8066a7a04ab8436bcd (diff)
downloadrust-731ad8a3c157ff85dc2509eb31f67f7f2b5a3169.tar.gz
rust-731ad8a3c157ff85dc2509eb31f67f7f2b5a3169.zip
Rollup merge of #96684 - tmiasko:mir-downcast, r=petrochenkov
Update `ProjectionElem::Downcast` documentation

`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs4
-rw-r--r--compiler/rustc_middle/src/mir/tcx.rs2
2 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 188ca804805..924bacb7aae 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -2017,9 +2017,7 @@ pub enum ProjectionElem<V, T> {
         from_end: bool,
     },
 
-    /// "Downcast" to a variant of an ADT. Currently, we only introduce
-    /// this for ADTs with more than one variant. It may be better to
-    /// just introduce it always, or always for enums.
+    /// "Downcast" to a variant of an enum or a generator.
     ///
     /// The included Symbol is the name of the variant, used for printing MIR.
     Downcast(Option<Symbol>, VariantIdx),
diff --git a/compiler/rustc_middle/src/mir/tcx.rs b/compiler/rustc_middle/src/mir/tcx.rs
index 597ade42236..f1d5201454d 100644
--- a/compiler/rustc_middle/src/mir/tcx.rs
+++ b/compiler/rustc_middle/src/mir/tcx.rs
@@ -12,7 +12,7 @@ use rustc_target::abi::VariantIdx;
 #[derive(Copy, Clone, Debug, TypeFoldable)]
 pub struct PlaceTy<'tcx> {
     pub ty: Ty<'tcx>,
-    /// Downcast to a particular variant of an enum, if included.
+    /// Downcast to a particular variant of an enum or a generator, if included.
     pub variant_index: Option<VariantIdx>,
 }