@@ -637,7 +637,7 @@ pub enum AggregateKind {
637637pub enum Operand {
638638 Copy ( Place ) ,
639639 Move ( Place ) ,
640- Constant ( Constant ) ,
640+ Constant ( ConstOperand ) ,
641641}
642642
643643#[ derive( Clone , Eq , PartialEq ) ]
@@ -653,6 +653,13 @@ impl From<Local> for Place {
653653 }
654654}
655655
656+ #[ derive( Clone , Debug , Eq , PartialEq ) ]
657+ pub struct ConstOperand {
658+ pub span : Span ,
659+ pub user_ty : Option < UserTypeAnnotationIndex > ,
660+ pub const_ : MirConst ,
661+ }
662+
656663/// Debug information pertaining to a user variable.
657664#[ derive( Clone , Debug , Eq , PartialEq ) ]
658665pub struct VarDebugInfo {
@@ -714,13 +721,6 @@ pub enum VarDebugInfoContents {
714721 Const ( ConstOperand ) ,
715722}
716723
717- #[ derive( Clone , Debug , Eq , PartialEq ) ]
718- pub struct ConstOperand {
719- pub span : Span ,
720- pub user_ty : Option < UserTypeAnnotationIndex > ,
721- pub const_ : MirConst ,
722- }
723-
724724// In MIR ProjectionElem is parameterized on the second Field argument and the Index argument. This
725725// is so it can be used for both Places (for which the projection elements are of type
726726// ProjectionElem<Local, Ty>) and user-provided type annotations (for which the projection elements
@@ -829,13 +829,6 @@ pub type FieldIdx = usize;
829829
830830type UserTypeAnnotationIndex = usize ;
831831
832- #[ derive( Clone , Debug , Eq , PartialEq ) ]
833- pub struct Constant {
834- pub span : Span ,
835- pub user_ty : Option < UserTypeAnnotationIndex > ,
836- pub literal : MirConst ,
837- }
838-
839832/// The possible branch sites of a [TerminatorKind::SwitchInt].
840833#[ derive( Clone , Debug , Eq , PartialEq ) ]
841834pub struct SwitchTargets {
@@ -1001,9 +994,9 @@ impl Operand {
1001994 }
1002995}
1003996
1004- impl Constant {
997+ impl ConstOperand {
1005998 pub fn ty ( & self ) -> Ty {
1006- self . literal . ty ( )
999+ self . const_ . ty ( )
10071000 }
10081001}
10091002
0 commit comments