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.
This commit is contained in:
Yuki Okushi 2022-05-04 17:13:15 +09:00 committed by GitHub
commit 731ad8a3c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View 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),

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