Skip to content

Commit 8231b17

Browse files
committed
somehow i expect this is *not* the correct solution
1 parent 150cf3e commit 8231b17

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

compiler/rustc_mir/src/const_eval/eval_queries.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
276276
let cid = key.value;
277277
let def = cid.instance.def.with_opt_param();
278278

279+
debug!("promoted={:?}", cid.promoted);
280+
279281
if let Some(def) = def.as_local() {
280282
if tcx.has_typeck_results(def.did) {
281283
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>(
293295
return Err(ErrorHandled::Reported(error_reported));
294296
}
295297

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+
}
303308
}
304309
}
305310

0 commit comments

Comments
 (0)