From bd5adc51fb6989435d39b3f4d484430c6714d762 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 16 Sep 2019 19:11:57 +0100 Subject: [PATCH] Rename surviving uses of `sty` --- .../traits/specialize/specialization_graph.rs | 18 +++++++++--------- src/librustc/ty/context.rs | 4 ++-- src/librustc/ty/structural_impls.rs | 8 ++++---- .../borrow_check/nll/type_check/mod.rs | 16 ++++++++-------- src/librustc_typeck/check/coercion.rs | 9 ++++----- .../internal-lints/ty_tykind_usage.rs | 8 ++++---- .../internal-lints/ty_tykind_usage.stderr | 4 ++-- 7 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 885d4b4cb0269..8cbadebaea5a5 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -85,11 +85,11 @@ impl<'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); - if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { - debug!("insert_blindly: impl_def_id={:?} sty={:?}", impl_def_id, sty); - self.nonblanket_impls.entry(sty).or_default().push(impl_def_id) + if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { + debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st); + self.nonblanket_impls.entry(st).or_default().push(impl_def_id) } else { - debug!("insert_blindly: impl_def_id={:?} sty=None", impl_def_id); + debug!("insert_blindly: impl_def_id={:?} st=None", impl_def_id); self.blanket_impls.push(impl_def_id) } } @@ -100,11 +100,11 @@ impl<'tcx> Children { fn remove_existing(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec; - if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { - debug!("remove_existing: impl_def_id={:?} sty={:?}", impl_def_id, sty); - vec = self.nonblanket_impls.get_mut(&sty).unwrap(); + if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { + debug!("remove_existing: impl_def_id={:?} st={:?}", impl_def_id, st); + vec = self.nonblanket_impls.get_mut(&st).unwrap(); } else { - debug!("remove_existing: impl_def_id={:?} sty=None", impl_def_id); + debug!("remove_existing: impl_def_id={:?} st=None", impl_def_id); vec = &mut self.blanket_impls; } @@ -130,7 +130,7 @@ impl<'tcx> Children { ); let possible_siblings = match simplified_self { - Some(sty) => PotentialSiblings::Filtered(self.filtered(sty)), + Some(st) => PotentialSiblings::Filtered(self.filtered(st)), None => PotentialSiblings::Unfiltered(self.iter()), }; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 371ce885ce2ea..c08f250f3dcee 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -890,7 +890,7 @@ EnumLiftImpl! { impl<'tcx> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { - let mk = |sty| interners.intern_ty(sty); + let mk = |ty| interners.intern_ty(ty); CommonTypes { unit: mk(Tuple(List::empty())), @@ -2080,7 +2080,7 @@ impl<'tcx, T: 'tcx+?Sized> Clone for Interned<'tcx, T> { } impl<'tcx, T: 'tcx+?Sized> Copy for Interned<'tcx, T> {} -// N.B., an `Interned` compares and hashes as a sty. +// N.B., an `Interned` compares and hashes as a `TyKind`. impl<'tcx> PartialEq for Interned<'tcx, TyS<'tcx>> { fn eq(&self, other: &Interned<'tcx, TyS<'tcx>>) -> bool { self.0.kind == other.0.kind diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 72e1bd33c6a81..42d632d120ea1 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -1023,7 +1023,7 @@ impl<'tcx> TypeFoldable<'tcx> for interpret::GlobalId<'tcx> { impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { fn super_fold_with>(&self, folder: &mut F) -> Self { - let sty = match self.kind { + let kind = match self.kind { ty::RawPtr(tm) => ty::RawPtr(tm.fold_with(folder)), ty::Array(typ, sz) => ty::Array(typ.fold_with(folder), sz.fold_with(folder)), ty::Slice(typ) => ty::Slice(typ.fold_with(folder)), @@ -1064,13 +1064,13 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { ty::Bound(..) | ty::Placeholder(..) | ty::Never | - ty::Foreign(..) => return self + ty::Foreign(..) => return self, }; - if self.kind == sty { + if self.kind == kind { self } else { - folder.tcx().mk_ty(sty) + folder.tcx().mk_ty(kind) } } 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 4996ea83ae04e..eadc58cc80027 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -424,15 +424,15 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { let mut place_ty = match &place.base { PlaceBase::Local(index) => PlaceTy::from_ty(self.body.local_decls[*index].ty), - PlaceBase::Static(box Static { kind, ty: sty, def_id }) => { - let sty = self.sanitize_type(place, sty); + PlaceBase::Static(box Static { kind, ty, def_id }) => { + let san_ty = self.sanitize_type(place, ty); let check_err = |verifier: &mut TypeVerifier<'a, 'b, 'tcx>, place: &Place<'tcx>, ty, - sty| { + san_ty| { if let Err(terr) = verifier.cx.eq_types( - sty, + san_ty, ty, location.to_locations(), ConstraintCategory::Boring, @@ -442,7 +442,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { place, "bad promoted type ({:?}: {:?}): {:?}", ty, - sty, + san_ty, terr ); }; @@ -454,17 +454,17 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { self.sanitize_promoted(promoted_body, location); let promoted_ty = promoted_body.return_ty(); - check_err(self, place, promoted_ty, sty); + check_err(self, place, promoted_ty, san_ty); } } StaticKind::Static => { let ty = self.tcx().type_of(*def_id); let ty = self.cx.normalize(ty, location); - check_err(self, place, ty, sty); + check_err(self, place, ty, san_ty); } } - PlaceTy::from_ty(sty) + PlaceTy::from_ty(san_ty) } }; diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index e507fa31435ac..564a0eac75539 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -566,15 +566,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { let obligation = queue.remove(0); debug!("coerce_unsized resolve step: {:?}", obligation); let trait_ref = match obligation.predicate { - ty::Predicate::Trait(ref tr) if traits.contains(&tr.def_id()) => { - if unsize_did == tr.def_id() { - let sty = &tr.skip_binder().input_types().nth(1).unwrap().kind; - if let ty::Tuple(..) = sty { + ty::Predicate::Trait(ref t) if traits.contains(&t.def_id()) => { + if unsize_did == t.def_id() { + if let ty::Tuple(..) = &t.skip_binder().input_types().nth(1).unwrap().kind { debug!("coerce_unsized: found unsized tuple coercion"); has_unsized_tuple_coercion = true; } } - tr.clone() + t.clone() } _ => { coercion.obligations.push(obligation); diff --git a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs index c6bd122f4e548..f716a78a031f2 100644 --- a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs +++ b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs @@ -8,9 +8,9 @@ use rustc::ty::{self, Ty, TyKind}; #[deny(rustc::usage_of_ty_tykind)] fn main() { - let sty = TyKind::Bool; //~ ERROR usage of `ty::TyKind::` + let kind = TyKind::Bool; //~ ERROR usage of `ty::TyKind::` - match sty { + match kind { TyKind::Bool => (), //~ ERROR usage of `ty::TyKind::` TyKind::Char => (), //~ ERROR usage of `ty::TyKind::` TyKind::Int(..) => (), //~ ERROR usage of `ty::TyKind::` @@ -41,9 +41,9 @@ fn main() { TyKind::Error => (), //~ ERROR usage of `ty::TyKind::` } - if let ty::Int(int_ty) = sty {} + if let ty::Int(int_ty) = kind {} - if let TyKind::Int(int_ty) = sty {} //~ ERROR usage of `ty::TyKind::` + if let TyKind::Int(int_ty) = kind {} //~ ERROR usage of `ty::TyKind::` fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind` } diff --git a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr index 8add4252c4103..a5c9ed3478cf4 100644 --- a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr +++ b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr @@ -1,7 +1,7 @@ error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:11:15 | -LL | let sty = TyKind::Bool; +LL | let kind = TyKind::Bool; | ^^^^^^ help: try using ty:: directly: `ty` | note: lint level defined here @@ -181,7 +181,7 @@ LL | TyKind::Error => (), error: usage of `ty::TyKind::` --> $DIR/ty_tykind_usage.rs:46:12 | -LL | if let TyKind::Int(int_ty) = sty {} +LL | if let TyKind::Int(int_ty) = kind {} | ^^^^^^ help: try using ty:: directly: `ty` error: usage of `ty::TyKind`