Fix tidy
This commit is contained in:
parent
4d62545687
commit
34fe28bc67
10 changed files with 39 additions and 15 deletions
|
|
@ -110,7 +110,11 @@ rustc_queries! {
|
|||
no_hash
|
||||
}
|
||||
|
||||
query mir_validated(_: DefId) -> (&'tcx Steal<mir::Body<'tcx>>, &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>) {
|
||||
query mir_validated(_: DefId) ->
|
||||
(
|
||||
&'tcx Steal<mir::Body<'tcx>>,
|
||||
&'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
|
||||
) {
|
||||
no_hash
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,7 +460,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
}),
|
||||
projection: None,
|
||||
} => {
|
||||
debug!("promoted={:?}, def_id={:?}, substs={:?}, self_substs={:?}", promoted, def_id, substs, self.instance.substs);
|
||||
let param_env = ty::ParamEnv::reveal_all();
|
||||
let instance = Instance::new(*def_id, substs.subst(bx.tcx(), self.instance.substs));
|
||||
debug!("instance: {:?}", instance);
|
||||
|
|
|
|||
|
|
@ -924,7 +924,8 @@ impl<'a, 'tcx> CrateMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn maybe_get_promoted_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> Option<IndexVec<Promoted, Body<'tcx>>> {
|
||||
pub fn maybe_get_promoted_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) ->
|
||||
Option<IndexVec<Promoted, Body<'tcx>>> {
|
||||
match self.is_proc_macro(id) {
|
||||
true => None,
|
||||
false => self.entry(id).promoted_mir.map(|promoted| promoted.decode((self, tcx)),)
|
||||
|
|
|
|||
|
|
@ -1060,7 +1060,8 @@ impl EncodeContext<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn encode_promoted_mir(&mut self, def_id: DefId) -> Option<Lazy<IndexVec<mir::Promoted, mir::Body<'tcx>>>> {
|
||||
fn encode_promoted_mir(&mut self, def_id: DefId) ->
|
||||
Option<Lazy<IndexVec<mir::Promoted, mir::Body<'tcx>>>> {
|
||||
debug!("EncodeContext::encode_promoted_mir({:?})", def_id);
|
||||
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) {
|
||||
let promoted = self.tcx.promoted_mir(def_id);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,8 @@ fn do_mir_borrowck<'a, 'tcx>(
|
|||
// will have a lifetime tied to the inference context.
|
||||
let mut body: Body<'tcx> = input_body.clone();
|
||||
let mut promoted: IndexVec<Promoted, Body<'tcx>> = input_promoted.clone();
|
||||
let free_regions = nll::replace_regions_in_mir(infcx, def_id, param_env, &mut body, &mut promoted);
|
||||
let free_regions =
|
||||
nll::replace_regions_in_mir(infcx, def_id, param_env, &mut body, &mut promoted);
|
||||
let body = &body; // no further changes
|
||||
let location_table = &LocationTable::new(body);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ use rustc_data_structures::indexed_vec::IndexVec;
|
|||
|
||||
/// Replaces all free regions appearing in the MIR with fresh
|
||||
/// inference variables, returning the number of variables created.
|
||||
pub fn renumber_mir<'tcx>(infcx: &InferCtxt<'_, 'tcx>, body: &mut Body<'tcx>, promoted: &mut IndexVec<Promoted, Body<'tcx>>) {
|
||||
pub fn renumber_mir<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
body: &mut Body<'tcx>,
|
||||
promoted: &mut IndexVec<Promoted, Body<'tcx>>,
|
||||
) {
|
||||
debug!("renumber_mir()");
|
||||
debug!("renumber_mir: body.arg_count={:?}", body.arg_count);
|
||||
|
||||
|
|
|
|||
|
|
@ -384,7 +384,11 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
fn new(cx: &'a mut TypeChecker<'b, 'tcx>, body: &'b Body<'tcx>, promoted: &'b IndexVec<Promoted, Body<'tcx>>) -> Self {
|
||||
fn new(
|
||||
cx: &'a mut TypeChecker<'b, 'tcx>,
|
||||
body: &'b Body<'tcx>,
|
||||
promoted: &'b IndexVec<Promoted, Body<'tcx>>,
|
||||
) -> Self {
|
||||
TypeVerifier {
|
||||
body,
|
||||
promoted,
|
||||
|
|
|
|||
|
|
@ -670,15 +670,16 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
|||
self.output.push(MonoItem::Static(*def_id));
|
||||
}
|
||||
}
|
||||
PlaceBase::Static(box Static { kind: StaticKind::Promoted(promoted, substs), def_id, .. }) => {
|
||||
debug!("collecting promoted(def_id: {:?}, promoted: {:?}, substs: {:?})", def_id, promoted, substs);
|
||||
debug!("param_substs: {:?}", self.param_substs);
|
||||
PlaceBase::Static(box Static {
|
||||
kind: StaticKind::Promoted(promoted, substs),
|
||||
def_id,
|
||||
..
|
||||
}) => {
|
||||
let param_env = ty::ParamEnv::reveal_all();
|
||||
let cid = GlobalId {
|
||||
instance: Instance::new(*def_id, substs.subst(self.tcx, self.param_substs)),
|
||||
promoted: Some(*promoted),
|
||||
};
|
||||
debug!("cid: {:?}", cid);
|
||||
match self.tcx.const_eval(param_env.and(cid)) {
|
||||
Ok(val) => collect_const(self.tcx, val, substs, self.output),
|
||||
Err(ErrorHandled::Reported) => {},
|
||||
|
|
|
|||
|
|
@ -200,7 +200,10 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
|
|||
tcx.alloc_steal_mir(body)
|
||||
}
|
||||
|
||||
fn mir_validated(tcx: TyCtxt<'tcx>, def_id: DefId) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
|
||||
fn mir_validated(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: DefId,
|
||||
) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
|
||||
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
|
||||
if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(hir_id) {
|
||||
// Ensure that we compute the `mir_const_qualif` for constants at
|
||||
|
|
@ -215,8 +218,9 @@ fn mir_validated(tcx: TyCtxt<'tcx>, def_id: DefId) -> (&'tcx Steal<Body<'tcx>>,
|
|||
&qualify_and_promote_pass,
|
||||
&simplify::SimplifyCfg::new("qualify-consts"),
|
||||
]);
|
||||
let promoted = qualify_and_promote_pass.promoted.into_inner();
|
||||
(tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted.unwrap_or_else(|| IndexVec::new())))
|
||||
let promoted =
|
||||
qualify_and_promote_pass.promoted.into_inner().unwrap_or_else(|| IndexVec::new());
|
||||
(tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted))
|
||||
}
|
||||
|
||||
fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
|
||||
|
|
|
|||
|
|
@ -295,7 +295,12 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|||
new_temp
|
||||
}
|
||||
|
||||
fn promote_candidate(mut self, def_id: DefId, candidate: Candidate, next_promoted_id: usize) -> Option<Body<'tcx>> {
|
||||
fn promote_candidate(
|
||||
mut self,
|
||||
def_id: DefId,
|
||||
candidate: Candidate,
|
||||
next_promoted_id: usize,
|
||||
) -> Option<Body<'tcx>> {
|
||||
let mut operand = {
|
||||
let promoted = &mut self.promoted;
|
||||
let promoted_id = Promoted::new(next_promoted_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue