Skip to content

Commit a63d414

Browse files
committed
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.
1 parent 086bf7a commit a63d414

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/rustc_middle/src/mir/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2017,9 +2017,7 @@ pub enum ProjectionElem<V, T> {
20172017
from_end: bool,
20182018
},
20192019

2020-
/// "Downcast" to a variant of an ADT. Currently, we only introduce
2021-
/// this for ADTs with more than one variant. It may be better to
2022-
/// just introduce it always, or always for enums.
2020+
/// "Downcast" to a variant of an enum or a generator.
20232021
///
20242022
/// The included Symbol is the name of the variant, used for printing MIR.
20252023
Downcast(Option<Symbol>, VariantIdx),

compiler/rustc_middle/src/mir/tcx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_target::abi::VariantIdx;
1212
#[derive(Copy, Clone, Debug, TypeFoldable)]
1313
pub struct PlaceTy<'tcx> {
1414
pub ty: Ty<'tcx>,
15-
/// Downcast to a particular variant of an enum, if included.
15+
/// Downcast to a particular variant of an enum or a generator, if included.
1616
pub variant_index: Option<VariantIdx>,
1717
}
1818

0 commit comments

Comments
 (0)