Skip to content

Commit

Permalink
Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynam…
Browse files Browse the repository at this point in the history
…ic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
  • Loading branch information
varkor committed Aug 22, 2018
1 parent d37cee3 commit 6f637da
Show file tree
Hide file tree
Showing 157 changed files with 1,430 additions and 1,430 deletions.
34 changes: 17 additions & 17 deletions src/librustc/ich/impls_ty.rs
Expand Up @@ -809,8 +809,8 @@ for ty::TyKind<'gcx>
TyBool |
TyChar |
TyStr |
TyError |
TyNever => {
Error |
Never => {
// Nothing more to hash.
}
TyInt(int_ty) => {
Expand All @@ -822,55 +822,55 @@ for ty::TyKind<'gcx>
TyFloat(float_ty) => {
float_ty.hash_stable(hcx, hasher);
}
TyAdt(adt_def, substs) => {
Adt(adt_def, substs) => {
adt_def.hash_stable(hcx, hasher);
substs.hash_stable(hcx, hasher);
}
TyArray(inner_ty, len) => {
Array(inner_ty, len) => {
inner_ty.hash_stable(hcx, hasher);
len.hash_stable(hcx, hasher);
}
TySlice(inner_ty) => {
Slice(inner_ty) => {
inner_ty.hash_stable(hcx, hasher);
}
TyRawPtr(pointee_ty) => {
RawPtr(pointee_ty) => {
pointee_ty.hash_stable(hcx, hasher);
}
TyRef(region, pointee_ty, mutbl) => {
Ref(region, pointee_ty, mutbl) => {
region.hash_stable(hcx, hasher);
pointee_ty.hash_stable(hcx, hasher);
mutbl.hash_stable(hcx, hasher);
}
TyFnDef(def_id, substs) => {
FnDef(def_id, substs) => {
def_id.hash_stable(hcx, hasher);
substs.hash_stable(hcx, hasher);
}
TyFnPtr(ref sig) => {
FnPtr(ref sig) => {
sig.hash_stable(hcx, hasher);
}
TyDynamic(ref existential_predicates, region) => {
Dynamic(ref existential_predicates, region) => {
existential_predicates.hash_stable(hcx, hasher);
region.hash_stable(hcx, hasher);
}
TyClosure(def_id, closure_substs) => {
Closure(def_id, closure_substs) => {
def_id.hash_stable(hcx, hasher);
closure_substs.hash_stable(hcx, hasher);
}
TyGenerator(def_id, generator_substs, movability) => {
Generator(def_id, generator_substs, movability) => {
def_id.hash_stable(hcx, hasher);
generator_substs.hash_stable(hcx, hasher);
movability.hash_stable(hcx, hasher);
}
TyGeneratorWitness(types) => {
GeneratorWitness(types) => {
types.hash_stable(hcx, hasher)
}
TyTuple(inner_tys) => {
Tuple(inner_tys) => {
inner_tys.hash_stable(hcx, hasher);
}
TyProjection(ref projection_ty) => {
Projection(ref projection_ty) => {
projection_ty.hash_stable(hcx, hasher);
}
TyAnon(def_id, substs) => {
Anon(def_id, substs) => {
def_id.hash_stable(hcx, hasher);
substs.hash_stable(hcx, hasher);
}
Expand All @@ -880,7 +880,7 @@ for ty::TyKind<'gcx>
TyForeign(def_id) => {
def_id.hash_stable(hcx, hasher);
}
TyInfer(infer_ty) => {
Infer(infer_ty) => {
infer_ty.hash_stable(hcx, hasher);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/infer/anon_types/mod.rs
Expand Up @@ -592,7 +592,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx>

fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
match ty.sty {
ty::TyClosure(def_id, substs) => {
ty::Closure(def_id, substs) => {
// I am a horrible monster and I pray for death. When
// we encounter a closure here, it is always a closure
// from within the function that we are currently
Expand Down Expand Up @@ -655,7 +655,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
tcx,
reg_op: |reg| reg,
fldop: |ty| {
if let ty::TyAnon(def_id, substs) = ty.sty {
if let ty::Anon(def_id, substs) = ty.sty {
// Check that this is `impl Trait` type is
// declared by `parent_def_id` -- i.e., one whose
// value we are inferring. At present, this is
Expand All @@ -679,7 +679,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
// ```
//
// Here, the return type of `foo` references a
// `TyAnon` indeed, but not one whose value is
// `Anon` indeed, but not one whose value is
// presently being inferred. You can get into a
// similar situation with closure return types
// today:
Expand Down Expand Up @@ -755,11 +755,11 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {
let tcx = infcx.tcx;

debug!(
"instantiate_anon_types: TyAnon(def_id={:?}, substs={:?})",
"instantiate_anon_types: Anon(def_id={:?}, substs={:?})",
def_id, substs
);

// Use the same type variable if the exact same TyAnon appears more
// Use the same type variable if the exact same Anon appears more
// than once in the return type (e.g. if it's passed to a type alias).
if let Some(anon_defn) = self.anon_types.get(&def_id) {
return anon_defn.concrete_ty;
Expand Down Expand Up @@ -805,7 +805,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> {

for predicate in bounds.predicates {
// Change the predicate to refer to the type variable,
// which will be the concrete type, instead of the TyAnon.
// which will be the concrete type, instead of the Anon.
// This also instantiates nested `impl Trait`.
let predicate = self.instantiate_anon_types_in_map(&predicate);

Expand Down
46 changes: 23 additions & 23 deletions src/librustc/infer/canonical/canonicalizer.rs
Expand Up @@ -246,46 +246,46 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>

fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match t.sty {
ty::TyInfer(ty::TyVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::General, t),
ty::Infer(ty::TyVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::General, t),

ty::TyInfer(ty::IntVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Int, t),
ty::Infer(ty::IntVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Int, t),

ty::TyInfer(ty::FloatVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Float, t),
ty::Infer(ty::FloatVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Float, t),

ty::TyInfer(ty::FreshTy(_))
| ty::TyInfer(ty::FreshIntTy(_))
| ty::TyInfer(ty::FreshFloatTy(_)) => {
ty::Infer(ty::FreshTy(_))
| ty::Infer(ty::FreshIntTy(_))
| ty::Infer(ty::FreshFloatTy(_)) => {
bug!("encountered a fresh type during canonicalization")
}

ty::TyInfer(ty::CanonicalTy(_)) => {
ty::Infer(ty::CanonicalTy(_)) => {
bug!("encountered a canonical type during canonicalization")
}

ty::TyClosure(..)
| ty::TyGenerator(..)
| ty::TyGeneratorWitness(..)
ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::TyBool
| ty::TyChar
| ty::TyInt(..)
| ty::TyUint(..)
| ty::TyFloat(..)
| ty::TyAdt(..)
| ty::Adt(..)
| ty::TyStr
| ty::TyError
| ty::TyArray(..)
| ty::TySlice(..)
| ty::TyRawPtr(..)
| ty::TyRef(..)
| ty::TyFnDef(..)
| ty::TyFnPtr(_)
| ty::TyDynamic(..)
| ty::TyNever
| ty::TyTuple(..)
| ty::TyProjection(..)
| ty::Error
| ty::Array(..)
| ty::Slice(..)
| ty::RawPtr(..)
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Dynamic(..)
| ty::Never
| ty::Tuple(..)
| ty::Projection(..)
| ty::TyForeign(..)
| ty::TyParam(..)
| ty::TyAnon(..) => {
| ty::Anon(..) => {
if t.flags.intersects(self.needs_canonical_flags) {
t.super_fold_with(self)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/query_result.rs
Expand Up @@ -421,7 +421,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
match result_value.unpack() {
UnpackedKind::Type(result_value) => {
// e.g., here `result_value` might be `?0` in the example above...
if let ty::TyInfer(ty::InferTy::CanonicalTy(index)) = result_value.sty {
if let ty::Infer(ty::InferTy::CanonicalTy(index)) = result_value.sty {
// in which case we would set `canonical_vars[0]` to `Some(?U)`.
opt_values[index] = Some(*original_value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/substitute.rs
Expand Up @@ -85,7 +85,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for CanonicalVarValuesSubst<'cx, 'g

fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
match t.sty {
ty::TyInfer(ty::InferTy::CanonicalTy(c)) => {
ty::Infer(ty::InferTy::CanonicalTy(c)) => {
match self.var_values.var_values[c].unpack() {
UnpackedKind::Type(ty) => ty,
r => bug!("{:?} is a type but value is {:?}", c, r),
Expand Down
26 changes: 13 additions & 13 deletions src/librustc/infer/combine.rs
Expand Up @@ -76,44 +76,44 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {

match (&a.sty, &b.sty) {
// Relate integral variables to other types
(&ty::TyInfer(ty::IntVar(a_id)), &ty::TyInfer(ty::IntVar(b_id))) => {
(&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
self.int_unification_table
.borrow_mut()
.unify_var_var(a_id, b_id)
.map_err(|e| int_unification_error(a_is_expected, e))?;
Ok(a)
}
(&ty::TyInfer(ty::IntVar(v_id)), &ty::TyInt(v)) => {
(&ty::Infer(ty::IntVar(v_id)), &ty::TyInt(v)) => {
self.unify_integral_variable(a_is_expected, v_id, IntType(v))
}
(&ty::TyInt(v), &ty::TyInfer(ty::IntVar(v_id))) => {
(&ty::TyInt(v), &ty::Infer(ty::IntVar(v_id))) => {
self.unify_integral_variable(!a_is_expected, v_id, IntType(v))
}
(&ty::TyInfer(ty::IntVar(v_id)), &ty::TyUint(v)) => {
(&ty::Infer(ty::IntVar(v_id)), &ty::TyUint(v)) => {
self.unify_integral_variable(a_is_expected, v_id, UintType(v))
}
(&ty::TyUint(v), &ty::TyInfer(ty::IntVar(v_id))) => {
(&ty::TyUint(v), &ty::Infer(ty::IntVar(v_id))) => {
self.unify_integral_variable(!a_is_expected, v_id, UintType(v))
}

// Relate floating-point variables to other types
(&ty::TyInfer(ty::FloatVar(a_id)), &ty::TyInfer(ty::FloatVar(b_id))) => {
(&ty::Infer(ty::FloatVar(a_id)), &ty::Infer(ty::FloatVar(b_id))) => {
self.float_unification_table
.borrow_mut()
.unify_var_var(a_id, b_id)
.map_err(|e| float_unification_error(relation.a_is_expected(), e))?;
Ok(a)
}
(&ty::TyInfer(ty::FloatVar(v_id)), &ty::TyFloat(v)) => {
(&ty::Infer(ty::FloatVar(v_id)), &ty::TyFloat(v)) => {
self.unify_float_variable(a_is_expected, v_id, v)
}
(&ty::TyFloat(v), &ty::TyInfer(ty::FloatVar(v_id))) => {
(&ty::TyFloat(v), &ty::Infer(ty::FloatVar(v_id))) => {
self.unify_float_variable(!a_is_expected, v_id, v)
}

// All other cases of inference are errors
(&ty::TyInfer(_), _) |
(_, &ty::TyInfer(_)) => {
(&ty::Infer(_), _) |
(_, &ty::Infer(_)) => {
Err(TypeError::Sorts(ty::relate::expected_found(relation, &a, &b)))
}

Expand Down Expand Up @@ -393,7 +393,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, '
// subtyping. This is basically our "occurs check", preventing
// us from creating infinitely sized types.
match t.sty {
ty::TyInfer(ty::TyVar(vid)) => {
ty::Infer(ty::TyVar(vid)) => {
let mut variables = self.infcx.type_variables.borrow_mut();
let vid = variables.root_var(vid);
let sub_vid = variables.sub_root_var(vid);
Expand Down Expand Up @@ -433,8 +433,8 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, '
}
}
}
ty::TyInfer(ty::IntVar(_)) |
ty::TyInfer(ty::FloatVar(_)) => {
ty::Infer(ty::IntVar(_)) |
ty::Infer(ty::FloatVar(_)) => {
// No matter what mode we are in,
// integer/floating-point types must be equal to be
// relatable.
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/infer/equate.rs
Expand Up @@ -75,17 +75,17 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
let a = infcx.type_variables.borrow_mut().replace_if_possible(a);
let b = infcx.type_variables.borrow_mut().replace_if_possible(b);
match (&a.sty, &b.sty) {
(&ty::TyInfer(TyVar(a_id)), &ty::TyInfer(TyVar(b_id))) => {
(&ty::Infer(TyVar(a_id)), &ty::Infer(TyVar(b_id))) => {
infcx.type_variables.borrow_mut().equate(a_id, b_id);
Ok(a)
}

(&ty::TyInfer(TyVar(a_id)), _) => {
(&ty::Infer(TyVar(a_id)), _) => {
self.fields.instantiate(b, RelationDir::EqTo, a_id, self.a_is_expected)?;
Ok(a)
}

(_, &ty::TyInfer(TyVar(b_id))) => {
(_, &ty::Infer(TyVar(b_id))) => {
self.fields.instantiate(a, RelationDir::EqTo, b_id, self.a_is_expected)?;
Ok(a)
}
Expand Down

0 comments on commit 6f637da

Please sign in to comment.