@@ -217,7 +217,7 @@ pub struct Body<'tcx> {
217217
218218 /// Constants that are required to evaluate successfully for this MIR to be well-formed.
219219 /// We hold in this field all the constants we are not able to evaluate yet.
220- pub required_consts : Vec < Constant < ' tcx > > ,
220+ pub required_consts : Vec < ( Span , Constant < ' tcx > ) > ,
221221
222222 /// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
223223 ///
@@ -1222,6 +1222,7 @@ pub enum InlineAsmOperand<'tcx> {
12221222 out_place : Option < Place < ' tcx > > ,
12231223 } ,
12241224 Const {
1225+ span : Span ,
12251226 value : Box < Constant < ' tcx > > ,
12261227 } ,
12271228 SymFn {
@@ -2029,7 +2030,7 @@ pub enum Operand<'tcx> {
20292030 Move ( Place < ' tcx > ) ,
20302031
20312032 /// Synthesizes a constant value.
2032- Constant ( Box < Constant < ' tcx > > ) ,
2033+ Constant ( Box < ( Span , Constant < ' tcx > ) > ) ,
20332034}
20342035
20352036#[ cfg( target_arch = "x86_64" ) ]
@@ -2057,11 +2058,10 @@ impl<'tcx> Operand<'tcx> {
20572058 span : Span ,
20582059 ) -> Self {
20592060 let ty = tcx. type_of ( def_id) . subst ( tcx, substs) ;
2060- Operand :: Constant ( box Constant {
2061- span,
2061+ Operand :: Constant ( box ( span, Constant {
20622062 user_ty : None ,
20632063 literal : ConstantKind :: Ty ( ty:: Const :: zero_sized ( tcx, ty) ) ,
2064- } )
2064+ } ) )
20652065 }
20662066
20672067 pub fn is_move ( & self ) -> bool {
@@ -2088,11 +2088,10 @@ impl<'tcx> Operand<'tcx> {
20882088 } ;
20892089 scalar_size == type_size
20902090 } ) ;
2091- Operand :: Constant ( box Constant {
2092- span,
2091+ Operand :: Constant ( box ( span, Constant {
20932092 user_ty : None ,
20942093 literal : ConstantKind :: Val ( val. into ( ) , ty) ,
2095- } )
2094+ } ) )
20962095 }
20972096
20982097 pub fn to_copy ( & self ) -> Self {
@@ -2113,9 +2112,9 @@ impl<'tcx> Operand<'tcx> {
21132112
21142113 /// Returns the `Constant` that is the target of this `Operand`, or `None` if this `Operand` is a
21152114 /// place.
2116- pub fn constant ( & self ) -> Option < & Constant < ' tcx > > {
2115+ pub fn constant ( & self ) -> Option < ( & Span , & Constant < ' tcx > ) > {
21172116 match self {
2118- Operand :: Constant ( x ) => Some ( & * * x ) ,
2117+ Operand :: Constant ( box ( span , c ) ) => Some ( ( span , c ) ) ,
21192118 Operand :: Copy ( _) | Operand :: Move ( _) => None ,
21202119 }
21212120 }
@@ -2426,8 +2425,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
24262425
24272426#[ derive( Clone , Copy , PartialEq , PartialOrd , TyEncodable , TyDecodable , Hash , HashStable ) ]
24282427pub struct Constant < ' tcx > {
2429- pub span : Span ,
2430-
24312428 /// Optional user-given type: for something like
24322429 /// `collect::<Vec<_>>`, this would be present and would
24332430 /// indicate that `Vec<_>` was explicitly specified.
0 commit comments