File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
rustc_smir/src/rustc_smir Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -712,6 +712,11 @@ impl<'tcx> Stable<'tcx> for mir::PlaceElem<'tcx> {
712
712
to: *to,
713
713
from_end: *from_end,
714
714
},
715
+ // MIR includes an `Option<Symbol>` argument for `Downcast` that is the name of the
716
+ // variant, used for printing MIR. However this information should also be accessible
717
+ // via a lookup using the `VariantIdx`. The `Option<Symbol>` argument is therefore
718
+ // dropped when converting to Stable MIR. A brief justification for this decision can be
719
+ // found at https://github.com/rust-lang/rust/pull/117517#issuecomment-1811683486
715
720
Downcast(_, idx) => stable_mir::mir::ProjectionElem::Downcast(idx.stable(tables)),
716
721
OpaqueCast(ty) => stable_mir::mir::ProjectionElem::OpaqueCast(ty.stable(tables)),
717
722
Subtype(ty) => stable_mir::mir::ProjectionElem::Subtype(ty.stable(tables)),
@@ -723,7 +728,7 @@ impl<'tcx> Stable<'tcx> for mir::UserTypeProjection {
723
728
type T = stable_mir::mir::UserTypeProjection;
724
729
725
730
fn stable(&self, _tables: &mut Tables<'tcx>) -> Self::T {
726
- UserTypeProjection { base: self.base.as_usize(), projection: format!("{:?}", self.projs) }
731
+ UserTypeProjection { base: self.base.as_usize(), projection: opaque(& self.projs) }
727
732
}
728
733
}
729
734
Original file line number Diff line number Diff line change @@ -465,10 +465,6 @@ pub enum ProjectionElem {
465
465
} ,
466
466
467
467
/// "Downcast" to a variant of an enum or a coroutine.
468
- //
469
- // TODO(klinvill): MIR includes an Option<Symbol> argument that is the name of the variant, used
470
- // for printing MIR. However I don't see it used anywhere. Is such a field needed or can we just
471
- // include the VariantIdx which could be used to recover the field name if needed?
472
468
Downcast ( VariantIdx ) ,
473
469
474
470
/// Like an explicit cast from an opaque type to a concrete type, but without
@@ -488,7 +484,7 @@ pub enum ProjectionElem {
488
484
pub struct UserTypeProjection {
489
485
pub base : UserTypeAnnotationIndex ,
490
486
491
- pub projection: String ,
487
+ pub projection : Opaque ,
492
488
}
493
489
494
490
pub type Local = usize ;
You can’t perform that action at this time.
0 commit comments