@@ -217,7 +217,7 @@ pub struct Body<'tcx> {
217
217
218
218
/// Constants that are required to evaluate successfully for this MIR to be well-formed.
219
219
/// 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 > ) > ,
221
221
222
222
/// Does this body use generic parameters. This is used for the `ConstEvaluatable` check.
223
223
///
@@ -1222,6 +1222,7 @@ pub enum InlineAsmOperand<'tcx> {
1222
1222
out_place : Option < Place < ' tcx > > ,
1223
1223
} ,
1224
1224
Const {
1225
+ span : Span ,
1225
1226
value : Box < Constant < ' tcx > > ,
1226
1227
} ,
1227
1228
SymFn {
@@ -2029,7 +2030,7 @@ pub enum Operand<'tcx> {
2029
2030
Move ( Place < ' tcx > ) ,
2030
2031
2031
2032
/// Synthesizes a constant value.
2032
- Constant ( Box < Constant < ' tcx > > ) ,
2033
+ Constant ( Box < ( Span , Constant < ' tcx > ) > ) ,
2033
2034
}
2034
2035
2035
2036
#[ cfg( target_arch = "x86_64" ) ]
@@ -2057,11 +2058,10 @@ impl<'tcx> Operand<'tcx> {
2057
2058
span : Span ,
2058
2059
) -> Self {
2059
2060
let ty = tcx. type_of ( def_id) . subst ( tcx, substs) ;
2060
- Operand :: Constant ( box Constant {
2061
- span,
2061
+ Operand :: Constant ( box ( span, Constant {
2062
2062
user_ty : None ,
2063
2063
literal : ConstantKind :: Ty ( ty:: Const :: zero_sized ( tcx, ty) ) ,
2064
- } )
2064
+ } ) )
2065
2065
}
2066
2066
2067
2067
pub fn is_move ( & self ) -> bool {
@@ -2088,11 +2088,10 @@ impl<'tcx> Operand<'tcx> {
2088
2088
} ;
2089
2089
scalar_size == type_size
2090
2090
} ) ;
2091
- Operand :: Constant ( box Constant {
2092
- span,
2091
+ Operand :: Constant ( box ( span, Constant {
2093
2092
user_ty : None ,
2094
2093
literal : ConstantKind :: Val ( val. into ( ) , ty) ,
2095
- } )
2094
+ } ) )
2096
2095
}
2097
2096
2098
2097
pub fn to_copy ( & self ) -> Self {
@@ -2113,9 +2112,9 @@ impl<'tcx> Operand<'tcx> {
2113
2112
2114
2113
/// Returns the `Constant` that is the target of this `Operand`, or `None` if this `Operand` is a
2115
2114
/// place.
2116
- pub fn constant ( & self ) -> Option < & Constant < ' tcx > > {
2115
+ pub fn constant ( & self ) -> Option < ( & Span , & Constant < ' tcx > ) > {
2117
2116
match self {
2118
- Operand :: Constant ( x ) => Some ( & * * x ) ,
2117
+ Operand :: Constant ( box ( span , c ) ) => Some ( ( span , c ) ) ,
2119
2118
Operand :: Copy ( _) | Operand :: Move ( _) => None ,
2120
2119
}
2121
2120
}
@@ -2426,8 +2425,6 @@ impl<'tcx> Debug for Rvalue<'tcx> {
2426
2425
2427
2426
#[ derive( Clone , Copy , PartialEq , PartialOrd , TyEncodable , TyDecodable , Hash , HashStable ) ]
2428
2427
pub struct Constant < ' tcx > {
2429
- pub span : Span ,
2430
-
2431
2428
/// Optional user-given type: for something like
2432
2429
/// `collect::<Vec<_>>`, this would be present and would
2433
2430
/// indicate that `Vec<_>` was explicitly specified.
0 commit comments