]> git.lizzy.rs Git - rust.git/commitdiff
Update `ProjectionElem::Downcast` documentation
authorTomasz Miąsko <tomasz.miasko@gmail.com>
Tue, 3 May 2022 00:00:00 +0000 (00:00 +0000)
committerTomasz Miąsko <tomasz.miasko@gmail.com>
Tue, 3 May 2022 20:29:51 +0000 (22:29 +0200)
`ProjectionElem:::Downcast` is used when downcasting to a variant of
an enum or a generator, regardless of the number of variants.

compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/tcx.rs

index 188ca8048055cae9cf1085b42cbe6e4081b40478..924bacb7aae21fe2508649d45b420604f6029731 100644 (file)
@@ -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),
index 597ade42236842c10ba0cb8b4675c87f44779021..f1d5201454d698389430528b811e7ad7ba6c2b28 100644 (file)
@@ -12,7 +12,7 @@
 #[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>,
 }