Skip to content

Commit bd5adc5

Browse files
committed
Rename surviving uses of sty
1 parent e2e0f9a commit bd5adc5

File tree

7 files changed

+33
-34
lines changed

7 files changed

+33
-34
lines changed

Diff for: src/librustc/traits/specialize/specialization_graph.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ impl<'tcx> Children {
8585
/// Insert an impl into this set of children without comparing to any existing impls.
8686
fn insert_blindly(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
8787
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
88-
if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
89-
debug!("insert_blindly: impl_def_id={:?} sty={:?}", impl_def_id, sty);
90-
self.nonblanket_impls.entry(sty).or_default().push(impl_def_id)
88+
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
89+
debug!("insert_blindly: impl_def_id={:?} st={:?}", impl_def_id, st);
90+
self.nonblanket_impls.entry(st).or_default().push(impl_def_id)
9191
} else {
92-
debug!("insert_blindly: impl_def_id={:?} sty=None", impl_def_id);
92+
debug!("insert_blindly: impl_def_id={:?} st=None", impl_def_id);
9393
self.blanket_impls.push(impl_def_id)
9494
}
9595
}
@@ -100,11 +100,11 @@ impl<'tcx> Children {
100100
fn remove_existing(&mut self, tcx: TyCtxt<'tcx>, impl_def_id: DefId) {
101101
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
102102
let vec: &mut Vec<DefId>;
103-
if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
104-
debug!("remove_existing: impl_def_id={:?} sty={:?}", impl_def_id, sty);
105-
vec = self.nonblanket_impls.get_mut(&sty).unwrap();
103+
if let Some(st) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
104+
debug!("remove_existing: impl_def_id={:?} st={:?}", impl_def_id, st);
105+
vec = self.nonblanket_impls.get_mut(&st).unwrap();
106106
} else {
107-
debug!("remove_existing: impl_def_id={:?} sty=None", impl_def_id);
107+
debug!("remove_existing: impl_def_id={:?} st=None", impl_def_id);
108108
vec = &mut self.blanket_impls;
109109
}
110110

@@ -130,7 +130,7 @@ impl<'tcx> Children {
130130
);
131131

132132
let possible_siblings = match simplified_self {
133-
Some(sty) => PotentialSiblings::Filtered(self.filtered(sty)),
133+
Some(st) => PotentialSiblings::Filtered(self.filtered(st)),
134134
None => PotentialSiblings::Unfiltered(self.iter()),
135135
};
136136

Diff for: src/librustc/ty/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ EnumLiftImpl! {
890890

891891
impl<'tcx> CommonTypes<'tcx> {
892892
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
893-
let mk = |sty| interners.intern_ty(sty);
893+
let mk = |ty| interners.intern_ty(ty);
894894

895895
CommonTypes {
896896
unit: mk(Tuple(List::empty())),
@@ -2080,7 +2080,7 @@ impl<'tcx, T: 'tcx+?Sized> Clone for Interned<'tcx, T> {
20802080
}
20812081
impl<'tcx, T: 'tcx+?Sized> Copy for Interned<'tcx, T> {}
20822082

2083-
// N.B., an `Interned<Ty>` compares and hashes as a sty.
2083+
// N.B., an `Interned<Ty>` compares and hashes as a `TyKind`.
20842084
impl<'tcx> PartialEq for Interned<'tcx, TyS<'tcx>> {
20852085
fn eq(&self, other: &Interned<'tcx, TyS<'tcx>>) -> bool {
20862086
self.0.kind == other.0.kind

Diff for: src/librustc/ty/structural_impls.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ impl<'tcx> TypeFoldable<'tcx> for interpret::GlobalId<'tcx> {
10231023

10241024
impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
10251025
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
1026-
let sty = match self.kind {
1026+
let kind = match self.kind {
10271027
ty::RawPtr(tm) => ty::RawPtr(tm.fold_with(folder)),
10281028
ty::Array(typ, sz) => ty::Array(typ.fold_with(folder), sz.fold_with(folder)),
10291029
ty::Slice(typ) => ty::Slice(typ.fold_with(folder)),
@@ -1064,13 +1064,13 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
10641064
ty::Bound(..) |
10651065
ty::Placeholder(..) |
10661066
ty::Never |
1067-
ty::Foreign(..) => return self
1067+
ty::Foreign(..) => return self,
10681068
};
10691069

1070-
if self.kind == sty {
1070+
if self.kind == kind {
10711071
self
10721072
} else {
1073-
folder.tcx().mk_ty(sty)
1073+
folder.tcx().mk_ty(kind)
10741074
}
10751075
}
10761076

Diff for: src/librustc_mir/borrow_check/nll/type_check/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,15 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
424424
let mut place_ty = match &place.base {
425425
PlaceBase::Local(index) =>
426426
PlaceTy::from_ty(self.body.local_decls[*index].ty),
427-
PlaceBase::Static(box Static { kind, ty: sty, def_id }) => {
428-
let sty = self.sanitize_type(place, sty);
427+
PlaceBase::Static(box Static { kind, ty, def_id }) => {
428+
let san_ty = self.sanitize_type(place, ty);
429429
let check_err =
430430
|verifier: &mut TypeVerifier<'a, 'b, 'tcx>,
431431
place: &Place<'tcx>,
432432
ty,
433-
sty| {
433+
san_ty| {
434434
if let Err(terr) = verifier.cx.eq_types(
435-
sty,
435+
san_ty,
436436
ty,
437437
location.to_locations(),
438438
ConstraintCategory::Boring,
@@ -442,7 +442,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
442442
place,
443443
"bad promoted type ({:?}: {:?}): {:?}",
444444
ty,
445-
sty,
445+
san_ty,
446446
terr
447447
);
448448
};
@@ -454,17 +454,17 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
454454
self.sanitize_promoted(promoted_body, location);
455455

456456
let promoted_ty = promoted_body.return_ty();
457-
check_err(self, place, promoted_ty, sty);
457+
check_err(self, place, promoted_ty, san_ty);
458458
}
459459
}
460460
StaticKind::Static => {
461461
let ty = self.tcx().type_of(*def_id);
462462
let ty = self.cx.normalize(ty, location);
463463

464-
check_err(self, place, ty, sty);
464+
check_err(self, place, ty, san_ty);
465465
}
466466
}
467-
PlaceTy::from_ty(sty)
467+
PlaceTy::from_ty(san_ty)
468468
}
469469
};
470470

Diff for: src/librustc_typeck/check/coercion.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,14 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
566566
let obligation = queue.remove(0);
567567
debug!("coerce_unsized resolve step: {:?}", obligation);
568568
let trait_ref = match obligation.predicate {
569-
ty::Predicate::Trait(ref tr) if traits.contains(&tr.def_id()) => {
570-
if unsize_did == tr.def_id() {
571-
let sty = &tr.skip_binder().input_types().nth(1).unwrap().kind;
572-
if let ty::Tuple(..) = sty {
569+
ty::Predicate::Trait(ref t) if traits.contains(&t.def_id()) => {
570+
if unsize_did == t.def_id() {
571+
if let ty::Tuple(..) = &t.skip_binder().input_types().nth(1).unwrap().kind {
573572
debug!("coerce_unsized: found unsized tuple coercion");
574573
has_unsized_tuple_coercion = true;
575574
}
576575
}
577-
tr.clone()
576+
t.clone()
578577
}
579578
_ => {
580579
coercion.obligations.push(obligation);

Diff for: src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use rustc::ty::{self, Ty, TyKind};
88

99
#[deny(rustc::usage_of_ty_tykind)]
1010
fn main() {
11-
let sty = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`
11+
let kind = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`
1212

13-
match sty {
13+
match kind {
1414
TyKind::Bool => (), //~ ERROR usage of `ty::TyKind::<kind>`
1515
TyKind::Char => (), //~ ERROR usage of `ty::TyKind::<kind>`
1616
TyKind::Int(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
@@ -41,9 +41,9 @@ fn main() {
4141
TyKind::Error => (), //~ ERROR usage of `ty::TyKind::<kind>`
4242
}
4343

44-
if let ty::Int(int_ty) = sty {}
44+
if let ty::Int(int_ty) = kind {}
4545

46-
if let TyKind::Int(int_ty) = sty {} //~ ERROR usage of `ty::TyKind::<kind>`
46+
if let TyKind::Int(int_ty) = kind {} //~ ERROR usage of `ty::TyKind::<kind>`
4747

4848
fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind`
4949
}

Diff for: src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: usage of `ty::TyKind::<kind>`
22
--> $DIR/ty_tykind_usage.rs:11:15
33
|
4-
LL | let sty = TyKind::Bool;
4+
LL | let kind = TyKind::Bool;
55
| ^^^^^^ help: try using ty::<kind> directly: `ty`
66
|
77
note: lint level defined here
@@ -181,7 +181,7 @@ LL | TyKind::Error => (),
181181
error: usage of `ty::TyKind::<kind>`
182182
--> $DIR/ty_tykind_usage.rs:46:12
183183
|
184-
LL | if let TyKind::Int(int_ty) = sty {}
184+
LL | if let TyKind::Int(int_ty) = kind {}
185185
| ^^^^^^ help: try using ty::<kind> directly: `ty`
186186

187187
error: usage of `ty::TyKind`

0 commit comments

Comments
 (0)