• R
    Rollup merge of #72497 - RalfJung:tag-term, r=oli-obk · 5e7eec2e
    Ralf Jung 提交于
    tag/niche terminology cleanup
    
    The term "discriminant" was used in two ways throughout the compiler:
    * every enum variant has a corresponding discriminant, that can be given explicitly with `Variant = N`.
    * that discriminant is then encoded in memory to store which variant is active -- but this encoded form of the discriminant was also often called "discriminant", even though it is conceptually quite different (e.g., it can be smaller in size, or even use niche-filling).
    
    After discussion with @EddyB, this renames the second term to "tag". The way the tag is encoded can be either `TagEncoding::Direct` (formerly `DiscriminantKind::Tag`) or `TagEncoding::Niche` (formerly `DiscrimianntKind::Niche`).
    
    This finally resolves some long-standing confusion I had about the handling of variant indices and discriminants, which surfaced in https://github.com/rust-lang/rust/pull/72419.
    
    (There is also a `DiscriminantKind` type in libcore, it remains unaffected. I think this corresponds to the discriminant, not the tag, so that seems all right.)
    
    r? @EddyB
    5e7eec2e
ub-enum.stderr 7.5 KB