File tree 1 file changed +12
-7
lines changed
compiler/rustc_mir/src/const_eval
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,8 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
276
276
let cid = key. value ;
277
277
let def = cid. instance . def . with_opt_param ( ) ;
278
278
279
+ debug ! ( "promoted={:?}" , cid. promoted) ;
280
+
279
281
if let Some ( def) = def. as_local ( ) {
280
282
if tcx. has_typeck_results ( def. did ) {
281
283
if let Some ( error_reported) = tcx. typeck_opt_const_arg ( def) . tainted_by_errors {
@@ -293,13 +295,16 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
293
295
return Err ( ErrorHandled :: Reported ( error_reported) ) ;
294
296
}
295
297
296
- let borrowck_results = if let Some ( param_did) = def. const_param_did {
297
- tcx. mir_borrowck_const_arg ( ( def. did , param_did) )
298
- } else {
299
- tcx. mir_borrowck ( def. did )
300
- } ;
301
- if borrowck_results. errored {
302
- return Err ( ErrorHandled :: Reported ( ErrorReported { } ) ) ;
298
+ if cid. promoted . is_none ( ) {
299
+ let borrowck_results = if let Some ( param_did) = def. const_param_did {
300
+ tcx. mir_borrowck_const_arg ( ( def. did , param_did) )
301
+ } else {
302
+ tcx. mir_borrowck ( def. did )
303
+ } ;
304
+
305
+ if borrowck_results. errored {
306
+ return Err ( ErrorHandled :: Reported ( ErrorReported { } ) ) ;
307
+ }
303
308
}
304
309
}
305
310
You can’t perform that action at this time.
0 commit comments