]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #96684 - tmiasko:mir-downcast, r=petrochenkov
authorYuki Okushi <jtitor@2k36.org>
Wed, 4 May 2022 08:13:15 +0000 (17:13 +0900)
committerGitHub <noreply@github.com>
Wed, 4 May 2022 08:13:15 +0000 (17:13 +0900)
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.

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>,
 }