@@ -24,7 +24,7 @@ impl<'tcx> TyCtxt<'tcx> {
24
24
let instance = ty:: Instance :: new ( def_id, args) ;
25
25
let cid = GlobalId { instance, promoted : None } ;
26
26
let param_env = self . param_env ( def_id) . with_reveal_all_normalized ( self ) ;
27
- self . const_eval_global_id ( param_env, cid, None )
27
+ self . const_eval_global_id ( param_env, cid, DUMMY_SP )
28
28
}
29
29
/// Resolves and evaluates a constant.
30
30
///
@@ -40,7 +40,7 @@ impl<'tcx> TyCtxt<'tcx> {
40
40
self ,
41
41
param_env : ty:: ParamEnv < ' tcx > ,
42
42
ct : mir:: UnevaluatedConst < ' tcx > ,
43
- span : Option < Span > ,
43
+ span : Span ,
44
44
) -> EvalToConstValueResult < ' tcx > {
45
45
// Cannot resolve `Unevaluated` constants that contain inference
46
46
// variables. We reject those here since `resolve`
@@ -73,7 +73,7 @@ impl<'tcx> TyCtxt<'tcx> {
73
73
self ,
74
74
param_env : ty:: ParamEnv < ' tcx > ,
75
75
ct : ty:: UnevaluatedConst < ' tcx > ,
76
- span : Option < Span > ,
76
+ span : Span ,
77
77
) -> EvalToValTreeResult < ' tcx > {
78
78
// Cannot resolve `Unevaluated` constants that contain inference
79
79
// variables. We reject those here since `resolve`
@@ -130,7 +130,7 @@ impl<'tcx> TyCtxt<'tcx> {
130
130
self ,
131
131
param_env : ty:: ParamEnv < ' tcx > ,
132
132
instance : ty:: Instance < ' tcx > ,
133
- span : Option < Span > ,
133
+ span : Span ,
134
134
) -> EvalToConstValueResult < ' tcx > {
135
135
self . const_eval_global_id ( param_env, GlobalId { instance, promoted : None } , span)
136
136
}
@@ -141,12 +141,12 @@ impl<'tcx> TyCtxt<'tcx> {
141
141
self ,
142
142
param_env : ty:: ParamEnv < ' tcx > ,
143
143
cid : GlobalId < ' tcx > ,
144
- span : Option < Span > ,
144
+ span : Span ,
145
145
) -> EvalToConstValueResult < ' tcx > {
146
146
// Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
147
147
// improve caching of queries.
148
148
let inputs = self . erase_regions ( param_env. with_reveal_all_normalized ( self ) . and ( cid) ) ;
149
- if let Some ( span) = span {
149
+ if ! span. is_dummy ( ) {
150
150
// The query doesn't know where it is being invoked, so we need to fix the span.
151
151
self . at ( span) . eval_to_const_value_raw ( inputs) . map_err ( |e| e. with_span ( span) )
152
152
} else {
@@ -160,13 +160,13 @@ impl<'tcx> TyCtxt<'tcx> {
160
160
self ,
161
161
param_env : ty:: ParamEnv < ' tcx > ,
162
162
cid : GlobalId < ' tcx > ,
163
- span : Option < Span > ,
163
+ span : Span ,
164
164
) -> EvalToValTreeResult < ' tcx > {
165
165
// Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should
166
166
// improve caching of queries.
167
167
let inputs = self . erase_regions ( param_env. with_reveal_all_normalized ( self ) . and ( cid) ) ;
168
168
debug ! ( ?inputs) ;
169
- if let Some ( span) = span {
169
+ if ! span. is_dummy ( ) {
170
170
// The query doesn't know where it is being invoked, so we need to fix the span.
171
171
self . at ( span) . eval_to_valtree ( inputs) . map_err ( |e| e. with_span ( span) )
172
172
} else {
0 commit comments