diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2019-08-14 08:08:17 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2019-08-22 06:36:31 -0400 |
| commit | 34fe28bc67817db6743654f8eef8bbf8244f57bf (patch) | |
| tree | 22d070c3f693e0a6895f99bf42b6cda9137d1011 /src | |
| parent | 4d62545687d0c10577eb75c058c0662e6b261395 (diff) | |
| download | rust-34fe28bc67817db6743654f8eef8bbf8244f57bf.tar.gz rust-34fe28bc67817db6743654f8eef8bbf8244f57bf.zip | |
Fix tidy
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/query/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/place.rs | 1 | ||||
| -rw-r--r-- | src/librustc_metadata/decoder.rs | 3 | ||||
| -rw-r--r-- | src/librustc_metadata/encoder.rs | 3 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/renumber.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/type_check/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/monomorphize/collector.rs | 9 | ||||
| -rw-r--r-- | src/librustc_mir/transform/mod.rs | 10 | ||||
| -rw-r--r-- | src/librustc_mir/transform/promote_consts.rs | 7 |
10 files changed, 39 insertions, 15 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index e1dbaeb5b17..c4f7ca51f4a 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -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 } diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index f7b94ea134c..b08093c3a71 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -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); diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 128e30be799..2add8bf9183 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -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)),) diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index f3863fd788a..0b8d2438752 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -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); diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 33cec78f3df..8ded539e720 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -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); diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index 4e3ffb7af16..c6a5c6fdfd0 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -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); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 35dd5b5d7eb..da1f64b0515 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -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, diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 512ace1a472..11f9df62528 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -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) => {}, diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index a78e78331ee..f59ad6bae02 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -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<'_> { diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index cb0ce77d5c0..fd5b6c2a328 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -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); |
