From 46b885f62b03957b5a89786f87c66b82fbde7253 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Thu, 23 Aug 2018 08:45:59 -0700 Subject: [PATCH] Fix stylistic mistakes --- src/librustc/mir/interpret/error.rs | 4 ++-- src/librustc_mir/interpret/eval_context.rs | 13 +++++++++---- src/librustc_mir/interpret/place.rs | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 3590cbdf2c7..dc6d17d3453 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -380,12 +380,12 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { Layout(_) => "rustc layout computation failed", UnterminatedCString(_) => - "attempted to get length of a null terminated string, but no null found before end + "attempted to get length of a null terminated string, but no null found before end \ of allocation", HeapAllocZeroBytes => "tried to re-, de- or allocate zero bytes on the heap", HeapAllocNonPowerOfTwoAlignment(_) => - "tried to re-, de-, or allocate heap memory with alignment that is not a power of + "tried to re-, de-, or allocate heap memory with alignment that is not a power of \ two", Unreachable => "entered unreachable code", diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index fdb1a1596c4..29c1e32c479 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -392,8 +392,11 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M Ok(Value::new_slice(Scalar::Ptr(ptr), s.len() as u64, self.tcx.tcx)) } - pub(super) fn resolve(&self, def_id: DefId, substs: &'tcx Substs<'tcx>) - -> EvalResult<'tcx, ty::Instance<'tcx>> { + pub(super) fn resolve( + &self, + def_id: DefId, + substs: &'tcx Substs<'tcx> + ) -> EvalResult<'tcx, ty::Instance<'tcx>> { trace!("resolve: {:?}, {:#?}", def_id, substs); trace!("substs: {:#?}", self.substs()); trace!("param_env: {:#?}", self.param_env); @@ -422,7 +425,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M let did = instance.def_id(); if did.is_local() && self.tcx.has_typeck_tables(did) - && self.tcx.typeck_tables_of(did).tainted_by_errors { + && self.tcx.typeck_tables_of(did).tainted_by_errors + { return err!(TypeckError); } trace!("load mir {:?}", instance); @@ -777,7 +781,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M last_span = Some(span); } let location = if self.tcx.def_key(instance.def_id()).disambiguated_data.data - == DefPathData::ClosureExpr { + == DefPathData::ClosureExpr + { "closure".to_owned() } else { instance.to_string() diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 17ace26ed8a..f46d6a1ea7d 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -773,8 +773,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { /// Turn a place that is a dyn trait (i.e., PlaceExtra::Vtable and the appropriate layout) /// or a slice into the specific fixed-size place and layout that is given by the vtable/len. /// This "unpacks" the existential quantifier, so to speak. - pub fn unpack_unsized_mplace(&self, mplace: MPlaceTy<'tcx>) - -> EvalResult<'tcx, MPlaceTy<'tcx>> { + pub fn unpack_unsized_mplace( + &self, + mplace: MPlaceTy<'tcx> + ) -> EvalResult<'tcx, MPlaceTy<'tcx>> { trace!("Unpacking {:?} ({:?})", *mplace, mplace.layout.ty); let layout = match mplace.extra { PlaceExtra::Vtable(vtable) => {