Rename surviving uses of sty
This commit is contained in:
parent
e2e0f9af85
commit
bd5adc51fb
@ -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<DefId>;
|
||||
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()),
|
||||
};
|
||||
|
||||
|
@ -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<Ty>` compares and hashes as a sty.
|
||||
// N.B., an `Interned<Ty>` 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
|
||||
|
@ -1023,7 +1023,7 @@ impl<'tcx> TypeFoldable<'tcx> for interpret::GlobalId<'tcx> {
|
||||
|
||||
impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
||||
fn super_fold_with<F: TypeFolder<'tcx>>(&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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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::<kind>`
|
||||
let kind = TyKind::Bool; //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
|
||||
match sty {
|
||||
match kind {
|
||||
TyKind::Bool => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Char => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Int(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
@ -41,9 +41,9 @@ fn main() {
|
||||
TyKind::Error => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
}
|
||||
|
||||
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::<kind>`
|
||||
if let TyKind::Int(int_ty) = kind {} //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
|
||||
fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} //~ ERROR usage of `ty::TyKind`
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:11:15
|
||||
|
|
||||
LL | let sty = TyKind::Bool;
|
||||
LL | let kind = TyKind::Bool;
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
|
||||
note: lint level defined here
|
||||
@ -181,7 +181,7 @@ LL | TyKind::Error => (),
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $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::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind`
|
||||
|
Loading…
Reference in New Issue
Block a user