1
Fork 0

Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse

add shims for WithOptConstParam query calls

r? @ecstatic-morse @eddyb
This commit is contained in:
Yuki Okushi 2020-10-13 04:07:50 +09:00 committed by GitHub
commit 687d7646de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 33 deletions

View file

@ -343,7 +343,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
// deny-by-default lint
_ => {
if let Some(p) = cid.promoted {
let span = tcx.promoted_mir_of_opt_const_arg(def.to_global())[p].span;
let span = tcx.promoted_mir_opt_const_arg(def.to_global())[p].span;
if let err_inval!(ReferencedConstant) = err.error {
Err(err.report_as_error(
tcx.at(span),

View file

@ -477,16 +477,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
trace!("load mir(instance={:?}, promoted={:?})", instance, promoted);
if let Some(promoted) = promoted {
return Ok(&self.tcx.promoted_mir_of_opt_const_arg(def)[promoted]);
return Ok(&self.tcx.promoted_mir_opt_const_arg(def)[promoted]);
}
match instance {
ty::InstanceDef::Item(def) => {
if self.tcx.is_mir_available(def.did) {
if let Some((did, param_did)) = def.as_const_arg() {
Ok(self.tcx.optimized_mir_of_const_arg((did, param_did)))
} else {
Ok(self.tcx.optimized_mir(def.did))
}
Ok(self.tcx.optimized_mir_opt_const_arg(def))
} else {
throw_unsup!(NoMirFor(def.did))
}

View file

@ -287,11 +287,7 @@ fn mir_promoted(
// this point, before we steal the mir-const result.
// Also this means promotion can rely on all const checks having been done.
let _ = tcx.mir_const_qualif_opt_const_arg(def);
let _ = if let Some(param_did) = def.const_param_did {
tcx.mir_abstract_const_of_const_arg((def.did, param_did))
} else {
tcx.mir_abstract_const(def.did.to_def_id())
};
let _ = tcx.mir_abstract_const_opt_const_arg(def.to_global());
let mut body = tcx.mir_const(def).steal();
let mut required_consts = Vec::new();