From 6f637da50c56a22f745fd056691da8c86824cd9b Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 22 Aug 2018 01:35:02 +0100 Subject: [PATCH] Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} --- src/librustc/ich/impls_ty.rs | 34 ++-- src/librustc/infer/anon_types/mod.rs | 12 +- src/librustc/infer/canonical/canonicalizer.rs | 46 ++--- src/librustc/infer/canonical/query_result.rs | 2 +- src/librustc/infer/canonical/substitute.rs | 2 +- src/librustc/infer/combine.rs | 26 +-- src/librustc/infer/equate.rs | 6 +- src/librustc/infer/error_reporting/mod.rs | 32 +-- .../infer/error_reporting/need_type_info.rs | 6 +- .../error_reporting/nice_region_error/util.rs | 4 +- src/librustc/infer/freshen.rs | 46 ++--- src/librustc/infer/fudge.rs | 2 +- src/librustc/infer/lattice.rs | 4 +- src/librustc/infer/mod.rs | 18 +- src/librustc/infer/outlives/obligations.rs | 2 +- src/librustc/infer/resolve.rs | 10 +- src/librustc/infer/sub.rs | 8 +- src/librustc/infer/type_variable.rs | 2 +- src/librustc/middle/dead.rs | 8 +- src/librustc/middle/expr_use_visitor.rs | 10 +- src/librustc/middle/intrinsicck.rs | 4 +- src/librustc/middle/mem_categorization.rs | 24 +-- src/librustc/mir/mod.rs | 4 +- src/librustc/mir/tcx.rs | 8 +- src/librustc/traits/auto_trait.rs | 2 +- src/librustc/traits/coherence.rs | 42 ++-- src/librustc/traits/error_reporting.rs | 50 ++--- src/librustc/traits/fulfill.rs | 2 +- src/librustc/traits/object_safety.rs | 2 +- src/librustc/traits/project.rs | 18 +- src/librustc/traits/query/dropck_outlives.rs | 36 ++-- src/librustc/traits/query/normalize.rs | 4 +- src/librustc/traits/select.rs | 170 ++++++++-------- src/librustc/ty/_match.rs | 12 +- src/librustc/ty/cast.rs | 12 +- src/librustc/ty/context.rs | 50 ++--- src/librustc/ty/error.rs | 50 ++--- src/librustc/ty/fast_reject.rs | 30 +-- src/librustc/ty/flags.rs | 38 ++-- src/librustc/ty/fold.rs | 2 +- src/librustc/ty/inhabitedness/mod.rs | 10 +- src/librustc/ty/instance.rs | 2 +- src/librustc/ty/item_path.rs | 36 ++-- src/librustc/ty/layout.rs | 90 ++++----- src/librustc/ty/mod.rs | 48 ++--- src/librustc/ty/outlives.rs | 34 ++-- src/librustc/ty/relate.rs | 48 ++--- src/librustc/ty/structural_impls.rs | 72 +++---- src/librustc/ty/sty.rs | 184 +++++++++--------- src/librustc/ty/util.rs | 70 +++---- src/librustc/ty/walk.rs | 28 +-- src/librustc/ty/wf.rs | 36 ++-- src/librustc/util/ppaux.rs | 48 ++--- src/librustc_borrowck/borrowck/check_loans.rs | 2 +- .../borrowck/gather_loans/gather_moves.rs | 4 +- .../borrowck/gather_loans/move_error.rs | 2 +- .../borrowck/gather_loans/restrictions.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 2 +- src/librustc_borrowck/borrowck/move_data.rs | 4 +- src/librustc_codegen_llvm/abi.rs | 2 +- src/librustc_codegen_llvm/base.rs | 32 +-- src/librustc_codegen_llvm/common.rs | 10 +- src/librustc_codegen_llvm/consts.rs | 2 +- src/librustc_codegen_llvm/context.rs | 2 +- .../debuginfo/metadata.rs | 44 ++--- src/librustc_codegen_llvm/debuginfo/mod.rs | 8 +- .../debuginfo/type_names.rs | 32 +-- src/librustc_codegen_llvm/glue.rs | 6 +- src/librustc_codegen_llvm/intrinsic.rs | 14 +- src/librustc_codegen_llvm/mir/analyze.rs | 2 +- src/librustc_codegen_llvm/mir/block.rs | 6 +- src/librustc_codegen_llvm/mir/constant.rs | 2 +- src/librustc_codegen_llvm/mir/mod.rs | 12 +- src/librustc_codegen_llvm/mir/place.rs | 4 +- src/librustc_codegen_llvm/mir/rvalue.rs | 6 +- src/librustc_codegen_llvm/type_of.rs | 30 +-- src/librustc_codegen_utils/symbol_names.rs | 2 +- src/librustc_lint/builtin.rs | 2 +- src/librustc_lint/types.rs | 40 ++-- src/librustc_lint/unused.rs | 6 +- src/librustc_metadata/encoder.rs | 6 +- .../borrow_check/error_reporting.rs | 12 +- src/librustc_mir/borrow_check/mod.rs | 16 +- src/librustc_mir/borrow_check/move_errors.rs | 4 +- .../borrow_check/nll/invalidation.rs | 8 +- .../error_reporting/region_name.rs | 12 +- .../borrow_check/nll/type_check/mod.rs | 28 +-- .../borrow_check/nll/type_check/relate_tys.rs | 2 +- .../borrow_check/nll/universal_regions.rs | 10 +- src/librustc_mir/borrow_check/place_ext.rs | 2 +- .../borrow_check/places_conflict.rs | 6 +- src/librustc_mir/borrow_check/prefixes.rs | 8 +- src/librustc_mir/build/expr/into.rs | 2 +- src/librustc_mir/build/matches/test.rs | 4 +- src/librustc_mir/build/mod.rs | 8 +- .../dataflow/drop_flag_effects.rs | 6 +- .../dataflow/move_paths/builder.rs | 10 +- src/librustc_mir/hair/cx/expr.rs | 14 +- src/librustc_mir/hair/pattern/_match.rs | 42 ++-- src/librustc_mir/hair/pattern/check_match.rs | 6 +- src/librustc_mir/hair/pattern/mod.rs | 56 +++--- src/librustc_mir/interpret/cast.rs | 10 +- src/librustc_mir/interpret/eval_context.rs | 6 +- src/librustc_mir/interpret/terminator/drop.rs | 2 +- src/librustc_mir/interpret/terminator/mod.rs | 14 +- src/librustc_mir/monomorphize/collector.rs | 26 +-- src/librustc_mir/monomorphize/item.rs | 34 ++-- src/librustc_mir/shim.rs | 10 +- src/librustc_mir/transform/add_validation.rs | 6 +- src/librustc_mir/transform/check_unsafety.rs | 4 +- src/librustc_mir/transform/generator.rs | 4 +- src/librustc_mir/transform/inline.rs | 8 +- src/librustc_mir/transform/instcombine.rs | 2 +- src/librustc_mir/transform/qualify_consts.rs | 12 +- src/librustc_mir/transform/rustc_peek.rs | 2 +- .../transform/uniform_array_move_out.rs | 4 +- src/librustc_mir/util/alignment.rs | 2 +- src/librustc_mir/util/borrowck_errors.rs | 4 +- src/librustc_mir/util/elaborate_drops.rs | 14 +- src/librustc_passes/rvalue_promotion.rs | 6 +- src/librustc_privacy/lib.rs | 46 ++--- src/librustc_save_analysis/lib.rs | 10 +- src/librustc_traits/chalk_context.rs | 2 +- src/librustc_traits/dropck_outlives.rs | 32 +-- src/librustc_typeck/astconv.rs | 8 +- src/librustc_typeck/check/_match.rs | 32 +-- src/librustc_typeck/check/autoderef.rs | 2 +- src/librustc_typeck/check/callee.rs | 14 +- src/librustc_typeck/check/cast.rs | 34 ++-- src/librustc_typeck/check/closure.rs | 14 +- src/librustc_typeck/check/coercion.rs | 34 ++-- src/librustc_typeck/check/demand.rs | 16 +- src/librustc_typeck/check/dropck.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 6 +- src/librustc_typeck/check/method/confirm.rs | 8 +- src/librustc_typeck/check/method/probe.rs | 20 +- src/librustc_typeck/check/method/suggest.rs | 16 +- src/librustc_typeck/check/mod.rs | 84 ++++---- src/librustc_typeck/check/op.rs | 22 +-- src/librustc_typeck/check/regionck.rs | 20 +- src/librustc_typeck/check/upvar.rs | 6 +- src/librustc_typeck/check/wfcheck.rs | 4 +- src/librustc_typeck/check/writeback.rs | 2 +- src/librustc_typeck/coherence/builtin.rs | 10 +- .../coherence/inherent_impls.rs | 14 +- src/librustc_typeck/coherence/mod.rs | 2 +- src/librustc_typeck/coherence/orphan.rs | 2 +- .../constrained_type_params.rs | 2 +- src/librustc_typeck/lib.rs | 4 +- .../outlives/implicit_infer.rs | 20 +- src/librustc_typeck/variance/constraints.rs | 40 ++-- src/librustc_typeck/variance/solve.rs | 2 +- src/librustdoc/clean/def_ctor.rs | 2 +- src/librustdoc/clean/mod.rs | 48 ++--- .../passes/collect_intra_doc_links.rs | 2 +- src/test/run-pass/auxiliary/issue13507.rs | 18 +- .../unboxed-closures-unique-type-id.rs | 2 +- 157 files changed, 1430 insertions(+), 1430 deletions(-) diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 7e40d634def20..0cc1df2b8c24e 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -809,8 +809,8 @@ for ty::TyKind<'gcx> TyBool | TyChar | TyStr | - TyError | - TyNever => { + Error | + Never => { // Nothing more to hash. } TyInt(int_ty) => { @@ -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); } @@ -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); } } diff --git a/src/librustc/infer/anon_types/mod.rs b/src/librustc/infer/anon_types/mod.rs index 205f8c5ad068c..96c64c05ccfbd 100644 --- a/src/librustc/infer/anon_types/mod.rs +++ b/src/librustc/infer/anon_types/mod.rs @@ -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 @@ -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 @@ -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: @@ -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; @@ -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); diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index 7d5b0a8de8b87..062c12579d963 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -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 { diff --git a/src/librustc/infer/canonical/query_result.rs b/src/librustc/infer/canonical/query_result.rs index f0b6d25e9dae8..341089d8a815f 100644 --- a/src/librustc/infer/canonical/query_result.rs +++ b/src/librustc/infer/canonical/query_result.rs @@ -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); } diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index 679829f43c529..f3fe01d5fd121 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -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), diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index ccba5a09cf6cc..6d4293216a440 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -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))) } @@ -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); @@ -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. diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index 2ae8f8ae93357..26eb2ffbf6aba 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -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) } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index b9b48505efbea..4275e56db4e3c 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -484,7 +484,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // if they are both "path types", there's a chance of ambiguity // due to different versions of the same crate match (&exp_found.expected.sty, &exp_found.found.sty) { - (&ty::TyAdt(exp_adt, _), &ty::TyAdt(found_adt, _)) => { + (&ty::Adt(exp_adt, _), &ty::Adt(found_adt, _)) => { report_path_match(err, exp_adt.did, found_adt.did); } _ => (), @@ -636,7 +636,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty); return Some(()); } - if let &ty::TyAdt(def, _) = &ta.sty { + if let &ty::Adt(def, _) = &ta.sty { let path_ = self.tcx.item_path_str(def.did.clone()); if path_ == other_path { self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty); @@ -704,14 +704,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn equals<'tcx>(a: &Ty<'tcx>, b: &Ty<'tcx>) -> bool { match (&a.sty, &b.sty) { (a, b) if *a == *b => true, - (&ty::TyInt(_), &ty::TyInfer(ty::InferTy::IntVar(_))) - | (&ty::TyInfer(ty::InferTy::IntVar(_)), &ty::TyInt(_)) - | (&ty::TyInfer(ty::InferTy::IntVar(_)), &ty::TyInfer(ty::InferTy::IntVar(_))) - | (&ty::TyFloat(_), &ty::TyInfer(ty::InferTy::FloatVar(_))) - | (&ty::TyInfer(ty::InferTy::FloatVar(_)), &ty::TyFloat(_)) + (&ty::TyInt(_), &ty::Infer(ty::InferTy::IntVar(_))) + | (&ty::Infer(ty::InferTy::IntVar(_)), &ty::TyInt(_)) + | (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Infer(ty::InferTy::IntVar(_))) + | (&ty::TyFloat(_), &ty::Infer(ty::InferTy::FloatVar(_))) + | (&ty::Infer(ty::InferTy::FloatVar(_)), &ty::TyFloat(_)) | ( - &ty::TyInfer(ty::InferTy::FloatVar(_)), - &ty::TyInfer(ty::InferTy::FloatVar(_)), + &ty::Infer(ty::InferTy::FloatVar(_)), + &ty::Infer(ty::InferTy::FloatVar(_)), ) => true, _ => false, } @@ -738,7 +738,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } match (&t1.sty, &t2.sty) { - (&ty::TyAdt(def1, sub1), &ty::TyAdt(def2, sub2)) => { + (&ty::Adt(def1, sub1), &ty::Adt(def2, sub2)) => { let sub_no_defaults_1 = self.strip_generic_default_params(def1.did, sub1); let sub_no_defaults_2 = self.strip_generic_default_params(def2.did, sub2); let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); @@ -877,13 +877,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } // When finding T != &T, highlight only the borrow - (&ty::TyRef(r1, ref_ty1, mutbl1), _) if equals(&ref_ty1, &t2) => { + (&ty::Ref(r1, ref_ty1, mutbl1), _) if equals(&ref_ty1, &t2) => { let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); push_ty_ref(&r1, ref_ty1, mutbl1, &mut values.0); values.1.push_normal(t2.to_string()); values } - (_, &ty::TyRef(r2, ref_ty2, mutbl2)) if equals(&t1, &ref_ty2) => { + (_, &ty::Ref(r2, ref_ty2, mutbl2)) if equals(&t1, &ref_ty2) => { let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); values.0.push_normal(t1.to_string()); push_ty_ref(&r2, ref_ty2, mutbl2, &mut values.1); @@ -891,8 +891,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } // When encountering &T != &mut T, highlight only the borrow - (&ty::TyRef(r1, ref_ty1, mutbl1), - &ty::TyRef(r2, ref_ty2, mutbl2)) if equals(&ref_ty1, &ref_ty2) => { + (&ty::Ref(r1, ref_ty1, mutbl1), + &ty::Ref(r2, ref_ty2, mutbl2)) if equals(&ref_ty1, &ref_ty2) => { let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new()); push_ty_ref(&r1, ref_ty1, mutbl1, &mut values.0); push_ty_ref(&r2, ref_ty2, mutbl2, &mut values.1); @@ -979,14 +979,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { (_, false, _) => { if let Some(exp_found) = exp_found { let (def_id, ret_ty) = match exp_found.found.sty { - TyKind::TyFnDef(def, _) => { + TyKind::FnDef(def, _) => { (Some(def), Some(self.tcx.fn_sig(def).output())) } _ => (None, None), }; let exp_is_struct = match exp_found.expected.sty { - TyKind::TyAdt(def, _) => def.is_struct(), + TyKind::Adt(def, _) => def.is_struct(), _ => false, }; diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index bd2c81c7fb64f..505b1bc032d20 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -12,7 +12,7 @@ use hir::{self, Local, Pat, Body, HirId}; use hir::intravisit::{self, Visitor, NestedVisitorMap}; use infer::InferCtxt; use infer::type_variable::TypeVariableOrigin; -use ty::{self, Ty, TyInfer, TyVar}; +use ty::{self, Ty, Infer, TyVar}; use syntax::source_map::CompilerDesugaringKind; use syntax_pos::Span; use errors::DiagnosticBuilder; @@ -35,7 +35,7 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> { let ty = self.infcx.resolve_type_vars_if_possible(&ty); ty.walk().any(|inner_ty| { inner_ty == *self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) { - (&TyInfer(TyVar(a_vid)), &TyInfer(TyVar(b_vid))) => { + (&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => { self.infcx .type_variables .borrow_mut() @@ -75,7 +75,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn extract_type_name(&self, ty: &'a Ty<'tcx>) -> String { - if let ty::TyInfer(ty::TyVar(ty_vid)) = (*ty).sty { + if let ty::Infer(ty::TyVar(ty_vid)) = (*ty).sty { let ty_vars = self.type_variables.borrow(); if let TypeVariableOrigin::TypeParameterDefinition(_, name) = *ty_vars.var_origin(ty_vid) { diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index 28320ce3ad1ba..8cb0df18bc8ff 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -162,7 +162,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { ) -> Option { let ret_ty = self.tcx.type_of(scope_def_id); match ret_ty.sty { - ty::TyFnDef(_, _) => { + ty::FnDef(_, _) => { let sig = ret_ty.fn_sig(self.tcx); let late_bound_regions = self.tcx .collect_referenced_late_bound_regions(&sig.output()); @@ -181,7 +181,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { ) -> bool { let ret_ty = self.tcx.type_of(scope_def_id); match ret_ty.sty { - ty::TyFnDef(_, _) => { + ty::FnDef(_, _) => { let sig = ret_ty.fn_sig(self.tcx); let output = self.tcx.erase_late_bound_regions(&sig.output()); return output.is_impl_trait(); diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index 6074bfd083d46..06bc1bfbaf471 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -133,7 +133,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { let tcx = self.infcx.tcx; match t.sty { - ty::TyInfer(ty::TyVar(v)) => { + ty::Infer(ty::TyVar(v)) => { let opt_ty = self.infcx.type_variables.borrow_mut().probe(v).known(); self.freshen( opt_ty, @@ -141,7 +141,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { ty::FreshTy) } - ty::TyInfer(ty::IntVar(v)) => { + ty::Infer(ty::IntVar(v)) => { self.freshen( self.infcx.int_unification_table.borrow_mut() .probe_value(v) @@ -150,7 +150,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { ty::FreshIntTy) } - ty::TyInfer(ty::FloatVar(v)) => { + ty::Infer(ty::FloatVar(v)) => { self.freshen( self.infcx.float_unification_table.borrow_mut() .probe_value(v) @@ -159,9 +159,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { ty::FreshFloatTy) } - ty::TyInfer(ty::FreshTy(c)) | - ty::TyInfer(ty::FreshIntTy(c)) | - ty::TyInfer(ty::FreshFloatTy(c)) => { + ty::Infer(ty::FreshTy(c)) | + ty::Infer(ty::FreshIntTy(c)) | + ty::Infer(ty::FreshFloatTy(c)) => { if c >= self.freshen_count { bug!("Encountered a freshend type with id {} \ but our counter is only at {}", @@ -171,33 +171,33 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { t } - ty::TyInfer(ty::CanonicalTy(..)) => + ty::Infer(ty::CanonicalTy(..)) => bug!("encountered canonical ty during freshening"), - ty::TyGenerator(..) | + ty::Generator(..) | 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::TyClosure(..) | - ty::TyGeneratorWitness(..) | - ty::TyAnon(..) => { + ty::Closure(..) | + ty::GeneratorWitness(..) | + ty::Anon(..) => { t.super_fold_with(self) } } diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index 961dd70a46852..39dc24b86e72a 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -123,7 +123,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> { fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { match ty.sty { - ty::TyInfer(ty::InferTy::TyVar(vid)) => { + ty::Infer(ty::InferTy::TyVar(vid)) => { match self.type_variables.get(&vid) { None => { // This variable was created before the diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index 28aba51ab3724..6848c625b5a1f 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -88,12 +88,12 @@ pub fn super_lattice_tys<'a, 'gcx, 'tcx, L>(this: &mut L, // is (e.g.) `Box`. A more obvious solution might be to // iterate on the subtype obligations that are returned, but I // think this suffices. -nmatsakis - (&ty::TyInfer(TyVar(..)), _) => { + (&ty::Infer(TyVar(..)), _) => { let v = infcx.next_ty_var(TypeVariableOrigin::LatticeVariable(this.cause().span)); this.relate_bound(v, b, a)?; Ok(v) } - (_, &ty::TyInfer(TyVar(..))) => { + (_, &ty::Infer(TyVar(..))) => { let v = infcx.next_ty_var(TypeVariableOrigin::LatticeVariable(this.cause().span)); this.relate_bound(v, a, b)?; Ok(v) diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index eed6215150fdb..a3c9d14eef295 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -546,7 +546,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn type_var_diverges(&'a self, ty: Ty) -> bool { match ty.sty { - ty::TyInfer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid), + ty::Infer(ty::TyVar(vid)) => self.type_variables.borrow().var_diverges(vid), _ => false } } @@ -559,14 +559,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { use ty::error::UnconstrainedNumeric::Neither; use ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat}; match ty.sty { - ty::TyInfer(ty::IntVar(vid)) => { + ty::Infer(ty::IntVar(vid)) => { if self.int_unification_table.borrow_mut().probe_value(vid).is_some() { Neither } else { UnconstrainedInt } }, - ty::TyInfer(ty::FloatVar(vid)) => { + ty::Infer(ty::FloatVar(vid)) => { if self.float_unification_table.borrow_mut().probe_value(vid).is_some() { Neither } else { @@ -1118,7 +1118,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> { match typ.sty { - ty::TyInfer(ty::TyVar(v)) => { + ty::Infer(ty::TyVar(v)) => { // Not entirely obvious: if `typ` is a type variable, // it can be resolved to an int/float variable, which // can then be recursively resolved, hence the @@ -1135,7 +1135,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .unwrap_or(typ) } - ty::TyInfer(ty::IntVar(v)) => { + ty::Infer(ty::IntVar(v)) => { self.int_unification_table .borrow_mut() .probe_value(v) @@ -1143,7 +1143,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .unwrap_or(typ) } - ty::TyInfer(ty::FloatVar(v)) => { + ty::Infer(ty::FloatVar(v)) => { self.float_unification_table .borrow_mut() .probe_value(v) @@ -1210,12 +1210,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } // [Note-Type-error-reporting] - // An invariant is that anytime the expected or actual type is TyError (the special + // An invariant is that anytime the expected or actual type is Error (the special // error type, meaning that an error occurred when typechecking this expression), // this is a derived error. The error cascaded from another error (that was already // reported), so it's not useful to display it to the user. // The following methods implement this logic. - // They check if either the actual or expected type is TyError, and don't print the error + // They check if either the actual or expected type is Error, and don't print the error // in this case. The typechecker should only ever report type errors involving mismatched // types using one of these methods, and should not call span_err directly for such // errors. @@ -1230,7 +1230,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let actual_ty = self.resolve_type_vars_if_possible(&actual_ty); debug!("type_error_struct_with_diag({:?}, {:?})", sp, actual_ty); - // Don't report an error if actual type is TyError. + // Don't report an error if actual type is Error. if actual_ty.references_error() { return self.tcx.sess.diagnostic().struct_dummy(); } diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 3598d66060bf2..c1006c17ba287 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -451,7 +451,7 @@ where fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> { match ty.sty { ty::TyParam(p) => self.param_bound(p), - ty::TyProjection(data) => { + ty::Projection(data) => { let declared_bounds = self.projection_declared_bounds(data); self.projection_bound(declared_bounds, data) } diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 77b722c5695f8..be13fb9a2a5eb 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -104,7 +104,7 @@ impl<'a, 'gcx, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'gcx, 'tcx> fn visit_ty(&mut self, t: Ty<'tcx>) -> bool { let t = self.infcx.shallow_resolve(t); if t.has_infer_types() { - if let ty::TyInfer(_) = t.sty { + if let ty::Infer(_) = t.sty { // Since we called `shallow_resolve` above, this must // be an (as yet...) unresolved inference variable. true @@ -158,19 +158,19 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> } else { let t = self.infcx.shallow_resolve(t); match t.sty { - ty::TyInfer(ty::TyVar(vid)) => { + ty::Infer(ty::TyVar(vid)) => { self.err = Some(FixupError::UnresolvedTy(vid)); self.tcx().types.err } - ty::TyInfer(ty::IntVar(vid)) => { + ty::Infer(ty::IntVar(vid)) => { self.err = Some(FixupError::UnresolvedIntTy(vid)); self.tcx().types.err } - ty::TyInfer(ty::FloatVar(vid)) => { + ty::Infer(ty::FloatVar(vid)) => { self.err = Some(FixupError::UnresolvedFloatTy(vid)); self.tcx().types.err } - ty::TyInfer(_) => { + ty::Infer(_) => { bug!("Unexpected type in full type resolver: {:?}", t); } _ => { diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index 58eae5e6a5b94..048810c042722 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -80,7 +80,7 @@ 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_vid)), &ty::TyInfer(TyVar(b_vid))) => { + (&ty::Infer(TyVar(a_vid)), &ty::Infer(TyVar(b_vid))) => { // Shouldn't have any LBR here, so we can safely put // this under a binder below without fear of accidental // capture. @@ -106,17 +106,17 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> Ok(a) } - (&ty::TyInfer(TyVar(a_id)), _) => { + (&ty::Infer(TyVar(a_id)), _) => { self.fields .instantiate(b, RelationDir::SupertypeOf, a_id, !self.a_is_expected)?; Ok(a) } - (_, &ty::TyInfer(TyVar(b_id))) => { + (_, &ty::Infer(TyVar(b_id))) => { self.fields.instantiate(a, RelationDir::SubtypeOf, b_id, self.a_is_expected)?; Ok(a) } - (&ty::TyError, _) | (_, &ty::TyError) => { + (&ty::Error, _) | (_, &ty::Error) => { infcx.set_tainted_by_errors(); Ok(self.tcx().types.err) } diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index d40e1b3760f03..b1e4fc7c7fc7b 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -245,7 +245,7 @@ impl<'tcx> TypeVariableTable<'tcx> { /// instantiated. Otherwise, returns `t`. pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { match t.sty { - ty::TyInfer(ty::TyVar(v)) => { + ty::Infer(ty::TyVar(v)) => { match self.probe(v) { TypeVariableValue::Unknown { .. } => t, TypeVariableValue::Known { value } => value, diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index a85170c1edf67..26f83bb9a3a45 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -105,11 +105,11 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn handle_field_access(&mut self, lhs: &hir::Expr, node_id: ast::NodeId) { match self.tables.expr_ty_adjusted(lhs).sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { let index = self.tcx.field_index(node_id, self.tables); self.insert_def_id(def.non_enum_variant().fields[index].did); } - ty::TyTuple(..) => {} + ty::Tuple(..) => {} _ => span_bug!(lhs.span, "named field access on non-ADT"), } } @@ -117,7 +117,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, def: Def, pats: &[source_map::Spanned]) { let variant = match self.tables.node_id_to_type(lhs.hir_id).sty { - ty::TyAdt(adt, _) => adt.variant_of_def(def), + ty::Adt(adt, _) => adt.variant_of_def(def), _ => span_bug!(lhs.span, "non-ADT in struct pattern") }; for pat in pats { @@ -236,7 +236,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { self.handle_field_access(&lhs, expr.id); } hir::ExprKind::Struct(_, ref fields, _) => { - if let ty::TyKind::TyAdt(ref adt, _) = self.tables.expr_ty(expr).sty { + if let ty::TyKind::Adt(ref adt, _) = self.tables.expr_ty(expr).sty { self.mark_as_used_if_union(adt, fields); } } diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 5beafe2b601bf..90692bcd30103 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -457,7 +457,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // make sure that the thing we are pointing out stays valid // for the lifetime `scope_r` of the resulting ptr: let expr_ty = return_if_err!(self.mc.expr_ty(expr)); - if let ty::TyRef(r, _, _) = expr_ty.sty { + if let ty::Ref(r, _, _) = expr_ty.sty { let bk = ty::BorrowKind::from_mutbl(m); self.borrow_expr(&base, r, bk, AddrOf); } @@ -551,10 +551,10 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { debug!("walk_callee: callee={:?} callee_ty={:?}", callee, callee_ty); match callee_ty.sty { - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { self.consume_expr(callee); } - ty::TyError => { } + ty::Error => { } _ => { if let Some(def) = self.mc.tables.type_dependent_defs().get(call.hir_id) { let def_id = def.def_id(); @@ -659,7 +659,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // Select just those fields of the `with` // expression that will actually be used match with_cmt.ty.sty { - ty::TyAdt(adt, substs) if adt.is_struct() => { + ty::Adt(adt, substs) if adt.is_struct() => { // Consume those fields of the with expression that are needed. for (f_index, with_field) in adt.non_enum_variant().fields.iter().enumerate() { let is_mentioned = fields.iter().any(|f| { @@ -867,7 +867,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { // It is also a borrow or copy/move of the value being matched. match bm { ty::BindByReference(m) => { - if let ty::TyRef(r, _, _) = pat_ty.sty { + if let ty::Ref(r, _, _) = pat_ty.sty { let bk = ty::BorrowKind::from_mutbl(m); delegate.borrow(pat.id, pat.span, &cmt_pat, r, bk, RefBinding); } diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index 8e4fb547d4164..8058f3dde668d 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -41,7 +41,7 @@ fn unpack_option_like<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { - ty::TyAdt(def, substs) => (def, substs), + ty::Adt(def, substs) => (def, substs), _ => return ty }; @@ -83,7 +83,7 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> { // Special-case transmutting from `typeof(function)` and // `Option` to present a clearer error. let from = unpack_option_like(self.tcx.global_tcx(), from); - if let (&ty::TyFnDef(..), SizeSkeleton::Known(size_to)) = (&from.sty, sk_to) { + if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (&from.sty, sk_to) { if size_to == Pointer.size(self.tcx) { struct_span_err!(self.tcx.sess, span, E0591, "can't transmute zero-sized type") diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 8feefdf5a1ddb..e0ed0f1da509e 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -214,8 +214,8 @@ impl<'tcx> cmt_<'tcx> { fn resolve_field(&self, field_index: usize) -> Option<(&'tcx ty::AdtDef, &'tcx ty::FieldDef)> { let adt_def = match self.ty.sty { - ty::TyAdt(def, _) => def, - ty::TyTuple(..) => return None, + ty::Adt(def, _) => def, + ty::Tuple(..) => return None, // closures get `Categorization::Upvar` rather than `Categorization::Interior` _ => bug!("interior cmt {:?} is not an ADT", self) }; @@ -783,8 +783,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // FnOnce | copied | upvar -> &'up bk let kind = match self.node_ty(fn_hir_id)?.sty { - ty::TyGenerator(..) => ty::ClosureKind::FnOnce, - ty::TyClosure(closure_def_id, closure_substs) => { + ty::Generator(..) => ty::ClosureKind::FnOnce, + ty::Closure(closure_def_id, closure_substs) => { match self.infcx { // During upvar inference we may not know the // closure kind, just use the LATTICE_BOTTOM value. @@ -893,7 +893,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // that the above is actually immutable and // has a ref type. However, nothing should // actually look at the type, so we can get - // away with stuffing a `TyError` in there + // away with stuffing a `Error` in there // instead of bothering to construct a proper // one. let cmt_result = cmt_ { @@ -956,7 +956,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // Always promote `[T; 0]` (even when e.g. borrowed mutably). let promotable = match expr_ty.sty { - ty::TyArray(_, len) if len.assert_usize(self.tcx) == Some(0) => true, + ty::Array(_, len) if len.assert_usize(self.tcx) == Some(0) => true, _ => promotable, }; @@ -1035,7 +1035,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { let base_ty = self.expr_ty_adjusted(base)?; let (region, mutbl) = match base_ty.sty { - ty::TyRef(region, _, mutbl) => (region, mutbl), + ty::Ref(region, _, mutbl) => (region, mutbl), _ => { span_bug!(expr.span, "cat_overloaded_place: base is not a reference") } @@ -1068,9 +1068,9 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { }; let ptr = match base_cmt.ty.sty { - ty::TyAdt(def, ..) if def.is_box() => Unique, - ty::TyRawPtr(ref mt) => UnsafePtr(mt.mutbl), - ty::TyRef(r, _, mutbl) => { + ty::Adt(def, ..) if def.is_box() => Unique, + ty::RawPtr(ref mt) => UnsafePtr(mt.mutbl), + ty::Ref(r, _, mutbl) => { let bk = ty::BorrowKind::from_mutbl(mutbl); BorrowedPtr(bk, r) } @@ -1290,7 +1290,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { } Def::StructCtor(_, CtorKind::Fn) => { match self.pat_ty_unadjusted(&pat)?.sty { - ty::TyAdt(adt_def, _) => { + ty::Adt(adt_def, _) => { (cmt, adt_def.non_enum_variant().fields.len()) } ref ty => { @@ -1343,7 +1343,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { PatKind::Tuple(ref subpats, ddpos) => { // (p1, ..., pN) let expected_len = match self.pat_ty_unadjusted(&pat)?.sty { - ty::TyTuple(ref tys) => tys.len(), + ty::Tuple(ref tys) => tys.len(), ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty), }; for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index dc491db9eeca6..9d556902e43db 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2248,14 +2248,14 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result { } } // print function definitons - if let TyFnDef(did, _) = ty.sty { + if let FnDef(did, _) = ty.sty { return write!(f, "{}", item_path_str(did)); } // print string literals if let ConstValue::ScalarPair(ptr, len) = value { if let Scalar::Ptr(ptr) = ptr { if let ScalarMaybeUndef::Scalar(Scalar::Bits { bits: len, .. }) = len { - if let TyRef(_, &ty::TyS { sty: TyStr, .. }, _) = ty.sty { + if let Ref(_, &ty::TyS { sty: TyStr, .. }, _) = ty.sty { return ty::tls::with(|tcx| { let alloc = tcx.alloc_map.lock().get(ptr.alloc_id); if let Some(interpret::AllocType::Memory(alloc)) = alloc { diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 5991845d265b2..ec395478ec6b5 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -68,12 +68,12 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { let ty = self.to_ty(tcx); PlaceTy::Ty { ty: match ty.sty { - ty::TyArray(inner, size) => { + ty::Array(inner, size) => { let size = size.unwrap_usize(tcx); let len = size - (from as u64) - (to as u64); tcx.mk_array(inner, len) } - ty::TySlice(..) => ty, + ty::Slice(..) => ty, _ => { bug!("cannot subslice non-array type: `{:?}`", self) } @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { } ProjectionElem::Downcast(adt_def1, index) => match self.to_ty(tcx).sty { - ty::TyAdt(adt_def, substs) => { + ty::Adt(adt_def, substs) => { assert!(adt_def.is_enum()); assert!(index < adt_def.variants.len()); assert_eq!(adt_def, adt_def1); @@ -199,7 +199,7 @@ impl<'tcx> Rvalue<'tcx> { } Rvalue::Discriminant(ref place) => { let ty = place.ty(local_decls, tcx).to_ty(tcx); - if let ty::TyAdt(adt_def, _) = ty.sty { + if let ty::Adt(adt_def, _) = ty.sty { adt_def.repr.discr_type().to_ty(tcx) } else { // This can only be `0`, for now, so `u8` will suffice. diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index a0882f8f92b46..87296f631bdab 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -607,7 +607,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { return match substs.type_at(0).sty { ty::TyParam(_) => true, - ty::TyProjection(p) => self.is_of_param(p.substs), + ty::Projection(p) => self.is_of_param(p.substs), _ => false, }; } diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 02bfab033efc8..2e82bad877cb7 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -407,7 +407,7 @@ fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate) fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool { match ty.sty { - ty::TyProjection(..) | ty::TyParam(..) => true, + ty::Projection(..) | ty::TyParam(..) => true, _ => false, } } @@ -419,9 +419,9 @@ fn ty_is_local(tcx: TyCtxt, ty: Ty, in_crate: InCrate) -> bool { fn fundamental_ty(tcx: TyCtxt, ty: Ty) -> bool { match ty.sty { - ty::TyRef(..) => true, - ty::TyAdt(def, _) => def.is_fundamental(), - ty::TyDynamic(ref data, ..) => { + ty::Ref(..) => true, + ty::Adt(def, _) => def.is_fundamental(), + ty::Dynamic(ref data, ..) => { data.principal().map_or(false, |p| tcx.has_attr(p.def_id(), "fundamental")) } _ => false @@ -447,43 +447,43 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool { ty::TyUint(..) | ty::TyFloat(..) | ty::TyStr | - ty::TyFnDef(..) | - ty::TyFnPtr(_) | - ty::TyArray(..) | - ty::TySlice(..) | - ty::TyRawPtr(..) | - ty::TyRef(..) | - ty::TyNever | - ty::TyTuple(..) | + ty::FnDef(..) | + ty::FnPtr(_) | + ty::Array(..) | + ty::Slice(..) | + ty::RawPtr(..) | + ty::Ref(..) | + ty::Never | + ty::Tuple(..) | ty::TyParam(..) | - ty::TyProjection(..) => { + ty::Projection(..) => { false } - ty::TyInfer(..) => match in_crate { + ty::Infer(..) => match in_crate { InCrate::Local => false, // The inference variable might be unified with a local // type in that remote crate. InCrate::Remote => true, }, - ty::TyAdt(def, _) => def_id_is_local(def.did, in_crate), + ty::Adt(def, _) => def_id_is_local(def.did, in_crate), ty::TyForeign(did) => def_id_is_local(did, in_crate), - ty::TyDynamic(ref tt, ..) => { + ty::Dynamic(ref tt, ..) => { tt.principal().map_or(false, |p| { def_id_is_local(p.def_id(), in_crate) }) } - ty::TyError => { + ty::Error => { true } - ty::TyClosure(..) | - ty::TyGenerator(..) | - ty::TyGeneratorWitness(..) | - ty::TyAnon(..) => { + ty::Closure(..) | + ty::Generator(..) | + ty::GeneratorWitness(..) | + ty::Anon(..) => { bug!("ty_is_local invoked on unexpected type: {:?}", ty) } } diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 961a66b229f56..cfb4e049e92b0 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -247,33 +247,33 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::TyBool => Some(0), ty::TyChar => Some(1), ty::TyStr => Some(2), - ty::TyInt(..) | ty::TyUint(..) | ty::TyInfer(ty::IntVar(..)) => Some(3), - ty::TyFloat(..) | ty::TyInfer(ty::FloatVar(..)) => Some(4), - ty::TyRef(..) | ty::TyRawPtr(..) => Some(5), - ty::TyArray(..) | ty::TySlice(..) => Some(6), - ty::TyFnDef(..) | ty::TyFnPtr(..) => Some(7), - ty::TyDynamic(..) => Some(8), - ty::TyClosure(..) => Some(9), - ty::TyTuple(..) => Some(10), - ty::TyProjection(..) => Some(11), + ty::TyInt(..) | ty::TyUint(..) | ty::Infer(ty::IntVar(..)) => Some(3), + ty::TyFloat(..) | ty::Infer(ty::FloatVar(..)) => Some(4), + ty::Ref(..) | ty::RawPtr(..) => Some(5), + ty::Array(..) | ty::Slice(..) => Some(6), + ty::FnDef(..) | ty::FnPtr(..) => Some(7), + ty::Dynamic(..) => Some(8), + ty::Closure(..) => Some(9), + ty::Tuple(..) => Some(10), + ty::Projection(..) => Some(11), ty::TyParam(..) => Some(12), - ty::TyAnon(..) => Some(13), - ty::TyNever => Some(14), - ty::TyAdt(adt, ..) => match adt.adt_kind() { + ty::Anon(..) => Some(13), + ty::Never => Some(14), + ty::Adt(adt, ..) => match adt.adt_kind() { AdtKind::Struct => Some(15), AdtKind::Union => Some(16), AdtKind::Enum => Some(17), }, - ty::TyGenerator(..) => Some(18), + ty::Generator(..) => Some(18), ty::TyForeign(..) => Some(19), - ty::TyGeneratorWitness(..) => Some(20), - ty::TyInfer(..) | ty::TyError => None + ty::GeneratorWitness(..) => Some(20), + ty::Infer(..) | ty::Error => None } } match (type_category(a), type_category(b)) { (Some(cat_a), Some(cat_b)) => match (&a.sty, &b.sty) { - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) => def_a == def_b, + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => def_a == def_b, _ => cat_a == cat_b }, // infer and error can be equated to all types @@ -784,10 +784,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let found_trait_ty = found_trait_ref.self_ty(); let found_did = match found_trait_ty.sty { - ty::TyClosure(did, _) | + ty::Closure(did, _) | ty::TyForeign(did) | - ty::TyFnDef(did, _) => Some(did), - ty::TyAdt(def, _) => Some(def.did), + ty::FnDef(did, _) => Some(did), + ty::Adt(def, _) => Some(def.did), _ => None, }; let found_span = found_did.and_then(|did| { @@ -795,14 +795,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }).map(|sp| self.tcx.sess.source_map().def_span(sp)); // the sp could be an fn def let found = match found_trait_ref.skip_binder().substs.type_at(1).sty { - ty::TyTuple(ref tys) => tys.iter() + ty::Tuple(ref tys) => tys.iter() .map(|_| ArgKind::empty()).collect::>(), _ => vec![ArgKind::empty()], }; let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty { - ty::TyTuple(ref tys) => tys.iter() + ty::Tuple(ref tys) => tys.iter() .map(|t| match t.sty { - ty::TyKind::TyTuple(ref tys) => ArgKind::Tuple( + ty::TyKind::Tuple(ref tys) => ArgKind::Tuple( Some(span), tys.iter() .map(|ty| ("_".to_owned(), ty.sty.to_string())) @@ -899,7 +899,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let mut trait_type = trait_ref.self_ty(); for refs_remaining in 0..refs_number { - if let ty::TyKind::TyRef(_, t_type, _) = trait_type.sty { + if let ty::TyKind::Ref(_, t_type, _) = trait_type.sty { trait_type = t_type; let substs = self.tcx.mk_substs_trait(trait_type, &[]); @@ -1143,7 +1143,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String { let inputs = trait_ref.substs.type_at(1); - let sig = if let ty::TyTuple(inputs) = inputs.sty { + let sig = if let ty::Tuple(inputs) = inputs.sty { tcx.mk_fn_sig( inputs.iter().map(|&x| x), tcx.mk_infer(ty::TyVar(ty::TyVid { index: 0 })), @@ -1594,7 +1594,7 @@ impl ArgKind { /// argument. This has no name (`_`) and no source spans.. pub fn from_expected_ty(t: Ty<'_>) -> ArgKind { match t.sty { - ty::TyTuple(ref tys) => ArgKind::Tuple( + ty::Tuple(ref tys) => ArgKind::Tuple( None, tys.iter() .map(|ty| ("_".to_owned(), ty.sty.to_string())) diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 5113f3cde3284..5c977e1bf624b 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -540,7 +540,7 @@ fn trait_ref_type_vars<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 't .map(|t| selcx.infcx().resolve_type_vars_if_possible(&t)) .filter(|t| t.has_infer_types()) .flat_map(|t| t.walk()) - .filter(|t| match t.sty { ty::TyInfer(_) => true, _ => false }) + .filter(|t| match t.sty { ty::Infer(_) => true, _ => false }) .collect() } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index aa4f63675d734..dc1da5b0461b6 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -379,7 +379,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { false // no contained types to walk } - ty::TyProjection(ref data) => { + ty::Projection(ref data) => { // This is a projected type `::X`. // Compute supertraits of current trait lazily. diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 1224cdd76d85b..939ba92c7badf 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -366,7 +366,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, let ty = ty.super_fold_with(self); match ty.sty { - ty::TyAnon(def_id, substs) if !substs.has_escaping_regions() => { // (*) + ty::Anon(def_id, substs) if !substs.has_escaping_regions() => { // (*) // Only normalize `impl Trait` after type-checking, usually in codegen. match self.param_env.reveal { Reveal::UserFacing => ty, @@ -393,7 +393,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, } } - ty::TyProjection(ref data) if !data.has_escaping_regions() => { // (*) + ty::Projection(ref data) if !data.has_escaping_regions() => { // (*) // (*) This is kind of hacky -- we need to be able to // handle normalization within binders because @@ -812,10 +812,10 @@ fn get_paranoid_cache_value_obligation<'a, 'gcx, 'tcx>( /// return an associated obligation that, when fulfilled, will lead to /// an error. /// -/// Note that we used to return `TyError` here, but that was quite +/// Note that we used to return `Error` here, but that was quite /// dubious -- the premise was that an error would *eventually* be /// reported, when the obligation was processed. But in general once -/// you see a `TyError` you are supposed to be able to assume that an +/// you see a `Error` you are supposed to be able to assume that an /// error *has been* reported, so that you can take whatever heuristic /// paths you want to take. To make things worse, it was possible for /// cycles to arise, where you basically had a setup like ` @@ -983,11 +983,11 @@ fn assemble_candidates_from_trait_def<'cx, 'gcx, 'tcx>( let tcx = selcx.tcx(); // Check whether the self-type is itself a projection. let (def_id, substs) = match obligation_trait_ref.self_ty().sty { - ty::TyProjection(ref data) => { + ty::Projection(ref data) => { (data.trait_ref(tcx).def_id, data.substs) } - ty::TyAnon(def_id, substs) => (def_id, substs), - ty::TyInfer(ty::TyVar(_)) => { + ty::Anon(def_id, substs) => (def_id, substs), + ty::Infer(ty::TyVar(_)) => { // If the self-type is an inference variable, then it MAY wind up // being a projected type, so induce an ambiguity. candidate_set.mark_ambiguous(); @@ -1265,7 +1265,7 @@ fn confirm_object_candidate<'cx, 'gcx, 'tcx>( debug!("confirm_object_candidate(object_ty={:?})", object_ty); let data = match object_ty.sty { - ty::TyDynamic(ref data, ..) => data, + ty::Dynamic(ref data, ..) => data, _ => { span_bug!( obligation.cause.span, @@ -1506,7 +1506,7 @@ fn confirm_impl_candidate<'cx, 'gcx, 'tcx>( // This means that the impl is missing a definition for the // associated type. This error will be reported by the type // checker method `check_impl_items_against_trait`, so here we - // just return TyError. + // just return Error. debug!("confirm_impl_candidate: no associated type {:?} for {:?}", assoc_ty.item.ident, obligation.predicate); diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 3a1d50a6584ef..1d51f165aefcb 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -214,34 +214,34 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> // None of these types have a destructor and hence they do not // require anything in particular to outlive the dtor's // execution. - ty::TyInfer(ty::FreshIntTy(_)) - | ty::TyInfer(ty::FreshFloatTy(_)) + ty::Infer(ty::FreshIntTy(_)) + | ty::Infer(ty::FreshFloatTy(_)) | ty::TyBool | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) - | ty::TyNever - | ty::TyFnDef(..) - | ty::TyFnPtr(_) + | ty::Never + | ty::FnDef(..) + | ty::FnPtr(_) | ty::TyChar - | ty::TyGeneratorWitness(..) - | ty::TyRawPtr(_) - | ty::TyRef(..) + | ty::GeneratorWitness(..) + | ty::RawPtr(_) + | ty::Ref(..) | ty::TyStr | ty::TyForeign(..) - | ty::TyError => true, + | ty::Error => true, // [T; N] and [T] have same properties as T. - ty::TyArray(ty, _) | ty::TySlice(ty) => trivial_dropck_outlives(tcx, ty), + ty::Array(ty, _) | ty::Slice(ty) => trivial_dropck_outlives(tcx, ty), // (T1..Tn) and closures have same properties as T1..Tn -- // check if *any* of those are trivial. - ty::TyTuple(ref tys) => tys.iter().cloned().all(|t| trivial_dropck_outlives(tcx, t)), - ty::TyClosure(def_id, ref substs) => substs + ty::Tuple(ref tys) => tys.iter().cloned().all(|t| trivial_dropck_outlives(tcx, t)), + ty::Closure(def_id, ref substs) => substs .upvar_tys(def_id, tcx) .all(|t| trivial_dropck_outlives(tcx, t)), - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { if Some(def.did) == tcx.lang_items().manually_drop() { // `ManuallyDrop` never has a dtor. true @@ -255,11 +255,11 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> } // The following *might* require a destructor: it would deeper inspection to tell. - ty::TyDynamic(..) - | ty::TyProjection(..) + ty::Dynamic(..) + | ty::Projection(..) | ty::TyParam(_) - | ty::TyAnon(..) - | ty::TyInfer(_) - | ty::TyGenerator(..) => false, + | ty::Anon(..) + | ty::Infer(_) + | ty::Generator(..) => false, } } diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index fab7289409c4f..7b81989c6415b 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -99,7 +99,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { let ty = ty.super_fold_with(self); match ty.sty { - ty::TyAnon(def_id, substs) if !substs.has_escaping_regions() => { + ty::Anon(def_id, substs) if !substs.has_escaping_regions() => { // (*) // Only normalize `impl Trait` after type-checking, usually in codegen. match self.param_env.reveal { @@ -159,7 +159,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx } } - ty::TyProjection(ref data) if !data.has_escaping_regions() => { + ty::Projection(ref data) if !data.has_escaping_regions() => { // (*) // (*) This is kind of hacky -- we need to be able to // handle normalization within binders because diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index ea96c30502680..55858cca1d157 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1128,7 +1128,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { -> SelectionResult<'tcx, SelectionCandidate<'tcx>> { if stack.obligation.predicate.references_error() { - // If we encounter a `TyError`, we generally prefer the + // If we encounter a `Error`, we generally prefer the // most "optimistic" result in response -- that is, the // one least likely to report downstream errors. But // because this routine is shared by coherence and by @@ -1492,8 +1492,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // before we go into the whole skolemization thing, just // quickly check if the self-type is a projection at all. match obligation.predicate.skip_binder().trait_ref.self_ty().sty { - ty::TyProjection(_) | ty::TyAnon(..) => {} - ty::TyInfer(ty::TyVar(_)) => { + ty::Projection(_) | ty::Anon(..) => {} + ty::Infer(ty::TyVar(_)) => { span_bug!(obligation.cause.span, "Self=_ should have been handled by assemble_candidates"); } @@ -1526,9 +1526,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { skol_map); let (def_id, substs) = match skol_trait_predicate.trait_ref.self_ty().sty { - ty::TyProjection(ref data) => + ty::Projection(ref data) => (data.trait_ref(self.tcx()).def_id, data.substs), - ty::TyAnon(def_id, substs) => (def_id, substs), + ty::Anon(def_id, substs) => (def_id, substs), _ => { span_bug!( obligation.cause.span, @@ -1661,7 +1661,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // type/region parameters let self_ty = *obligation.self_ty().skip_binder(); match self_ty.sty { - ty::TyGenerator(..) => { + ty::Generator(..) => { debug!("assemble_generator_candidates: self_ty={:?} obligation={:?}", self_ty, obligation); @@ -1669,7 +1669,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { candidates.vec.push(GeneratorCandidate); Ok(()) } - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { debug!("assemble_generator_candidates: ambiguous self-type"); candidates.ambiguous = true; return Ok(()); @@ -1698,7 +1698,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // touch bound regions, they just capture the in-scope // type/region parameters match obligation.self_ty().skip_binder().sty { - ty::TyClosure(closure_def_id, closure_substs) => { + ty::Closure(closure_def_id, closure_substs) => { debug!("assemble_unboxed_candidates: kind={:?} obligation={:?}", kind, obligation); match self.infcx.closure_kind(closure_def_id, closure_substs) { @@ -1715,7 +1715,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { }; Ok(()) } - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { debug!("assemble_unboxed_closure_candidates: ambiguous self-type"); candidates.ambiguous = true; return Ok(()); @@ -1738,13 +1738,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // ok to skip binder because what we are inspecting doesn't involve bound regions let self_ty = *obligation.self_ty().skip_binder(); match self_ty.sty { - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { debug!("assemble_fn_pointer_candidates: ambiguous self-type"); candidates.ambiguous = true; // could wind up being a fn() type } // provide an impl, but only for suitable `fn` pointers - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { if let ty::FnSig { unsafety: hir::Unsafety::Normal, abi: Abi::Rust, @@ -1804,7 +1804,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { if self.tcx().trait_is_auto(def_id) { match self_ty.sty { - ty::TyDynamic(..) => { + ty::Dynamic(..) => { // For object types, we don't know what the closed // over types are. This means we conservatively // say nothing; a candidate may be added by @@ -1817,7 +1817,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // this trait and type. } ty::TyParam(..) | - ty::TyProjection(..) => { + ty::Projection(..) => { // In these cases, we don't know what the actual // type is. Therefore, we cannot break it down // into its constituent types. So we don't @@ -1832,7 +1832,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // for an example of a test case that exercises // this path. } - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { // the auto impl might apply, we don't know candidates.ambiguous = true; } @@ -1871,7 +1871,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // any LBR. let self_ty = this.tcx().erase_late_bound_regions(&obligation.self_ty()); let poly_trait_ref = match self_ty.sty { - ty::TyDynamic(ref data, ..) => { + ty::Dynamic(ref data, ..) => { if data.auto_traits().any(|did| did == obligation.predicate.def_id()) { debug!("assemble_candidates_from_object_ty: matched builtin bound, \ pushing candidate"); @@ -1884,7 +1884,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { None => return, } } - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { debug!("assemble_candidates_from_object_ty: ambiguous"); candidates.ambiguous = true; // could wind up being an object type return; @@ -1953,7 +1953,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let may_apply = match (&source.sty, &target.sty) { // Trait+Kx+'a -> Trait+Ky+'b (upcasts). - (&ty::TyDynamic(ref data_a, ..), &ty::TyDynamic(ref data_b, ..)) => { + (&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => { // Upcasts permit two things: // // 1. Dropping builtin bounds, e.g. `Foo+Send` to `Foo` @@ -1975,28 +1975,28 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // T -> Trait. - (_, &ty::TyDynamic(..)) => true, + (_, &ty::Dynamic(..)) => true, // Ambiguous handling is below T -> Trait, because inference // variables can still implement Unsize and nested // obligations will have the final say (likely deferred). - (&ty::TyInfer(ty::TyVar(_)), _) | - (_, &ty::TyInfer(ty::TyVar(_))) => { + (&ty::Infer(ty::TyVar(_)), _) | + (_, &ty::Infer(ty::TyVar(_))) => { debug!("assemble_candidates_for_unsizing: ambiguous"); candidates.ambiguous = true; false } // [T; n] -> [T]. - (&ty::TyArray(..), &ty::TySlice(_)) => true, + (&ty::Array(..), &ty::Slice(_)) => true, // Struct -> Struct. - (&ty::TyAdt(def_id_a, _), &ty::TyAdt(def_id_b, _)) if def_id_a.is_struct() => { + (&ty::Adt(def_id_a, _), &ty::Adt(def_id_b, _)) if def_id_a.is_struct() => { def_id_a == def_id_b } // (.., T) -> (.., U). - (&ty::TyTuple(tys_a), &ty::TyTuple(tys_b)) => { + (&ty::Tuple(tys_a), &ty::Tuple(tys_b)) => { tys_a.len() == tys_b.len() } @@ -2179,23 +2179,23 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation.predicate.skip_binder().self_ty()); match self_ty.sty { - ty::TyInfer(ty::IntVar(_)) | ty::TyInfer(ty::FloatVar(_)) | + ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) | - ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyRawPtr(..) | - ty::TyChar | ty::TyRef(..) | ty::TyGenerator(..) | - ty::TyGeneratorWitness(..) | ty::TyArray(..) | ty::TyClosure(..) | - ty::TyNever | ty::TyError => { + ty::FnDef(..) | ty::FnPtr(_) | ty::RawPtr(..) | + ty::TyChar | ty::Ref(..) | ty::Generator(..) | + ty::GeneratorWitness(..) | ty::Array(..) | ty::Closure(..) | + ty::Never | ty::Error => { // safe for everything Where(ty::Binder::dummy(Vec::new())) } - ty::TyStr | ty::TySlice(_) | ty::TyDynamic(..) | ty::TyForeign(..) => None, + ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => None, - ty::TyTuple(tys) => { + ty::Tuple(tys) => { Where(ty::Binder::bind(tys.last().into_iter().cloned().collect())) } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { let sized_crit = def.sized_constraint(self.tcx()); // (*) binder moved here Where(ty::Binder::bind( @@ -2203,13 +2203,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { )) } - ty::TyProjection(_) | ty::TyParam(_) | ty::TyAnon(..) => None, - ty::TyInfer(ty::TyVar(_)) => Ambiguous, + ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => None, + ty::Infer(ty::TyVar(_)) => Ambiguous, - ty::TyInfer(ty::CanonicalTy(_)) | - ty::TyInfer(ty::FreshTy(_)) | - ty::TyInfer(ty::FreshIntTy(_)) | - ty::TyInfer(ty::FreshFloatTy(_)) => { + ty::Infer(ty::CanonicalTy(_)) | + ty::Infer(ty::FreshTy(_)) | + ty::Infer(ty::FreshIntTy(_)) | + ty::Infer(ty::FreshFloatTy(_)) => { bug!("asked to assemble builtin bounds of unexpected type: {:?}", self_ty); } @@ -2226,35 +2226,35 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { use self::BuiltinImplConditions::{Ambiguous, None, Where}; match self_ty.sty { - ty::TyInfer(ty::IntVar(_)) | ty::TyInfer(ty::FloatVar(_)) | - ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyError => { + ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | + ty::FnDef(..) | ty::FnPtr(_) | ty::Error => { Where(ty::Binder::dummy(Vec::new())) } ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) | - ty::TyChar | ty::TyRawPtr(..) | ty::TyNever | - ty::TyRef(_, _, hir::MutImmutable) => { + ty::TyChar | ty::RawPtr(..) | ty::Never | + ty::Ref(_, _, hir::MutImmutable) => { // Implementations provided in libcore None } - ty::TyDynamic(..) | ty::TyStr | ty::TySlice(..) | - ty::TyGenerator(..) | ty::TyGeneratorWitness(..) | ty::TyForeign(..) | - ty::TyRef(_, _, hir::MutMutable) => { + ty::Dynamic(..) | ty::TyStr | ty::Slice(..) | + ty::Generator(..) | ty::GeneratorWitness(..) | ty::TyForeign(..) | + ty::Ref(_, _, hir::MutMutable) => { None } - ty::TyArray(element_ty, _) => { + ty::Array(element_ty, _) => { // (*) binder moved here Where(ty::Binder::bind(vec![element_ty])) } - ty::TyTuple(tys) => { + ty::Tuple(tys) => { // (*) binder moved here Where(ty::Binder::bind(tys.to_vec())) } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let trait_id = obligation.predicate.def_id(); let is_copy_trait = Some(trait_id) == self.tcx().lang_items().copy_trait(); let is_clone_trait = Some(trait_id) == self.tcx().lang_items().clone_trait(); @@ -2265,22 +2265,22 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } } - ty::TyAdt(..) | ty::TyProjection(..) | ty::TyParam(..) | ty::TyAnon(..) => { + ty::Adt(..) | ty::Projection(..) | ty::TyParam(..) | ty::Anon(..) => { // Fallback to whatever user-defined impls exist in this case. None } - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { // Unbound type variable. Might or might not have // applicable impls and so forth, depending on what // those type variables wind up being bound to. Ambiguous } - ty::TyInfer(ty::CanonicalTy(_)) | - ty::TyInfer(ty::FreshTy(_)) | - ty::TyInfer(ty::FreshIntTy(_)) | - ty::TyInfer(ty::FreshFloatTy(_)) => { + ty::Infer(ty::CanonicalTy(_)) | + ty::Infer(ty::FreshTy(_)) | + ty::Infer(ty::FreshIntTy(_)) | + ty::Infer(ty::FreshFloatTy(_)) => { bug!("asked to assemble builtin bounds of unexpected type: {:?}", self_ty); } @@ -2304,54 +2304,54 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) | - ty::TyFnDef(..) | - ty::TyFnPtr(_) | + ty::FnDef(..) | + ty::FnPtr(_) | ty::TyStr | - ty::TyError | - ty::TyInfer(ty::IntVar(_)) | - ty::TyInfer(ty::FloatVar(_)) | - ty::TyNever | + ty::Error | + ty::Infer(ty::IntVar(_)) | + ty::Infer(ty::FloatVar(_)) | + ty::Never | ty::TyChar => { Vec::new() } - ty::TyDynamic(..) | + ty::Dynamic(..) | ty::TyParam(..) | ty::TyForeign(..) | - ty::TyProjection(..) | - ty::TyInfer(ty::CanonicalTy(_)) | - ty::TyInfer(ty::TyVar(_)) | - ty::TyInfer(ty::FreshTy(_)) | - ty::TyInfer(ty::FreshIntTy(_)) | - ty::TyInfer(ty::FreshFloatTy(_)) => { + ty::Projection(..) | + ty::Infer(ty::CanonicalTy(_)) | + ty::Infer(ty::TyVar(_)) | + ty::Infer(ty::FreshTy(_)) | + ty::Infer(ty::FreshIntTy(_)) | + ty::Infer(ty::FreshFloatTy(_)) => { bug!("asked to assemble constituent types of unexpected type: {:?}", t); } - ty::TyRawPtr(ty::TypeAndMut { ty: element_ty, ..}) | - ty::TyRef(_, element_ty, _) => { + ty::RawPtr(ty::TypeAndMut { ty: element_ty, ..}) | + ty::Ref(_, element_ty, _) => { vec![element_ty] }, - ty::TyArray(element_ty, _) | ty::TySlice(element_ty) => { + ty::Array(element_ty, _) | ty::Slice(element_ty) => { vec![element_ty] } - ty::TyTuple(ref tys) => { + ty::Tuple(ref tys) => { // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet tys.to_vec() } - ty::TyClosure(def_id, ref substs) => { + ty::Closure(def_id, ref substs) => { substs.upvar_tys(def_id, self.tcx()).collect() } - ty::TyGenerator(def_id, ref substs, _) => { + ty::Generator(def_id, ref substs, _) => { let witness = substs.witness(def_id, self.tcx()); substs.upvar_tys(def_id, self.tcx()).chain(iter::once(witness)).collect() } - ty::TyGeneratorWitness(types) => { + ty::GeneratorWitness(types) => { // This is sound because no regions in the witness can refer to // the binder outside the witness. So we'll effectivly reuse // the implicit binder around the witness. @@ -2359,17 +2359,17 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // for `PhantomData`, we pass `T` - ty::TyAdt(def, substs) if def.is_phantom_data() => { + ty::Adt(def, substs) if def.is_phantom_data() => { substs.types().collect() } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { def.all_fields() .map(|f| f.ty(self.tcx(), substs)) .collect() } - ty::TyAnon(def_id, substs) => { + ty::Anon(def_id, substs) => { // We can resolve the `impl Trait` to its concrete type, // which enforces a DAG between the functions requiring // the auto trait bounds in question. @@ -2728,7 +2728,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // case that results. -nmatsakis let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder()); let poly_trait_ref = match self_ty.sty { - ty::TyDynamic(ref data, ..) => { + ty::Dynamic(ref data, ..) => { data.principal().unwrap().with_self_ty(self.tcx(), self_ty) } _ => { @@ -2823,7 +2823,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // type/region parameters let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder()); let (generator_def_id, substs) = match self_ty.sty { - ty::TyGenerator(id, substs, _) => (id, substs), + ty::Generator(id, substs, _) => (id, substs), _ => bug!("closure candidate for non-closure {:?}", obligation) }; @@ -2879,7 +2879,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // type/region parameters let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder()); let (closure_def_id, substs) = match self_ty.sty { - ty::TyClosure(id, substs) => (id, substs), + ty::Closure(id, substs) => (id, substs), _ => bug!("closure candidate for non-closure {:?}", obligation) }; @@ -2976,7 +2976,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let mut nested = vec![]; match (&source.sty, &target.sty) { // Trait+Kx+'a -> Trait+Ky+'b (upcasts). - (&ty::TyDynamic(ref data_a, r_a), &ty::TyDynamic(ref data_b, r_b)) => { + (&ty::Dynamic(ref data_a, r_a), &ty::Dynamic(ref data_b, r_b)) => { // See assemble_candidates_for_unsizing for more info. let existential_predicates = data_a.map_bound(|data_a| { let principal = data_a.principal(); @@ -3005,7 +3005,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // T -> Trait. - (_, &ty::TyDynamic(ref data, r)) => { + (_, &ty::Dynamic(ref data, r)) => { let mut object_dids = data.auto_traits().chain(data.principal().map(|p| p.def_id())); if let Some(did) = object_dids.find(|did| { @@ -3048,7 +3048,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // [T; n] -> [T]. - (&ty::TyArray(a, _), &ty::TySlice(b)) => { + (&ty::Array(a, _), &ty::Slice(b)) => { let InferOk { obligations, .. } = self.infcx.at(&obligation.cause, obligation.param_env) .eq(b, a) @@ -3057,7 +3057,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // Struct -> Struct. - (&ty::TyAdt(def, substs_a), &ty::TyAdt(_, substs_b)) => { + (&ty::Adt(def, substs_a), &ty::Adt(_, substs_b)) => { let fields = def .all_fields() .map(|f| tcx.type_of(f.did)) @@ -3082,7 +3082,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // Replace type parameters used in unsizing with - // TyError and ensure they do not affect any other fields. + // Error and ensure they do not affect any other fields. // This could be checked after type collection for any struct // with a potentially unsized trailing field. let params = substs_a.iter().enumerate().map(|(i, &k)| { @@ -3130,7 +3130,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } // (.., T) -> (.., U). - (&ty::TyTuple(tys_a), &ty::TyTuple(tys_b)) => { + (&ty::Tuple(tys_a), &ty::Tuple(tys_b)) => { assert_eq!(tys_a.len(), tys_b.len()); // The last field of the tuple has to exist. diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index 047bfcc8c6f59..c9b0e97c9b05c 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -67,18 +67,18 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for Match<'a, 'gcx, 'tcx> { if a == b { return Ok(a); } match (&a.sty, &b.sty) { - (_, &ty::TyInfer(ty::FreshTy(_))) | - (_, &ty::TyInfer(ty::FreshIntTy(_))) | - (_, &ty::TyInfer(ty::FreshFloatTy(_))) => { + (_, &ty::Infer(ty::FreshTy(_))) | + (_, &ty::Infer(ty::FreshIntTy(_))) | + (_, &ty::Infer(ty::FreshFloatTy(_))) => { Ok(a) } - (&ty::TyInfer(_), _) | - (_, &ty::TyInfer(_)) => { + (&ty::Infer(_), _) | + (_, &ty::Infer(_)) => { Err(TypeError::Sorts(relate::expected_found(self, &a, &b))) } - (&ty::TyError, _) | (_, &ty::TyError) => { + (&ty::Error, _) | (_, &ty::Error) => { Ok(self.tcx().types.err) } diff --git a/src/librustc/ty/cast.rs b/src/librustc/ty/cast.rs index 7593d4ed24e76..56ca13404aa9c 100644 --- a/src/librustc/ty/cast.rs +++ b/src/librustc/ty/cast.rs @@ -63,15 +63,15 @@ impl<'tcx> CastTy<'tcx> { ty::TyBool => Some(CastTy::Int(IntTy::Bool)), ty::TyChar => Some(CastTy::Int(IntTy::Char)), ty::TyInt(_) => Some(CastTy::Int(IntTy::I)), - ty::TyInfer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)), - ty::TyInfer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float), + ty::Infer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)), + ty::Infer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float), ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))), ty::TyFloat(_) => Some(CastTy::Float), - ty::TyAdt(d,_) if d.is_enum() && d.is_payloadfree() => + ty::Adt(d,_) if d.is_enum() && d.is_payloadfree() => Some(CastTy::Int(IntTy::CEnum)), - ty::TyRawPtr(mt) => Some(CastTy::Ptr(mt)), - ty::TyRef(_, ty, mutbl) => Some(CastTy::RPtr(ty::TypeAndMut { ty, mutbl })), - ty::TyFnPtr(..) => Some(CastTy::FnPtr), + ty::RawPtr(mt) => Some(CastTy::Ptr(mt)), + ty::Ref(_, ty, mutbl) => Some(CastTy::RPtr(ty::TypeAndMut { ty, mutbl })), + ty::FnPtr(..) => Some(CastTy::FnPtr), _ => None, } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 099c05a61ef19..b0c3f7f7edb18 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -819,8 +819,8 @@ impl<'tcx> CommonTypes<'tcx> { CommonTypes { bool: mk(TyBool), char: mk(TyChar), - never: mk(TyNever), - err: mk(TyError), + never: mk(Never), + err: mk(Error), isize: mk(TyInt(ast::IntTy::Isize)), i8: mk(TyInt(ast::IntTy::I8)), i16: mk(TyInt(ast::IntTy::I16)), @@ -2036,8 +2036,8 @@ macro_rules! sty_debug_print { for &Interned(t) in tcx.interners.type_.borrow().iter() { let variant = match t.sty { ty::TyBool | ty::TyChar | ty::TyInt(..) | ty::TyUint(..) | - ty::TyFloat(..) | ty::TyStr | ty::TyNever => continue, - ty::TyError => /* unimportant */ continue, + ty::TyFloat(..) | ty::TyStr | ty::Never => continue, + ty::Error => /* unimportant */ continue, $(ty::$variant(..) => &mut $variant,)* }; let region = t.flags.intersects(ty::TypeFlags::HAS_RE_INFER); @@ -2076,9 +2076,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, - TyAdt, TyArray, TySlice, TyRawPtr, TyRef, TyFnDef, TyFnPtr, - TyGenerator, TyGeneratorWitness, TyDynamic, TyClosure, TyTuple, - TyParam, TyInfer, TyProjection, TyAnon, TyForeign); + Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, + Generator, GeneratorWitness, Dynamic, Closure, Tuple, + TyParam, Infer, Projection, Anon, TyForeign); println!("Substs interner: #{}", self.interners.substs.borrow().len()); println!("Region interner: #{}", self.interners.region.borrow().len()); @@ -2323,7 +2323,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn coerce_closure_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> { let converted_sig = sig.map_bound(|s| { let params_iter = match s.inputs()[0].sty { - ty::TyTuple(params) => { + ty::Tuple(params) => { params.into_iter().cloned() } _ => bug!(), @@ -2383,7 +2383,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { // take a copy of substs so that we own the vectors inside - self.mk_ty(TyAdt(def, substs)) + self.mk_ty(Adt(def, substs)) } pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> { @@ -2406,15 +2406,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } }); - self.mk_ty(TyAdt(adt_def, substs)) + self.mk_ty(Adt(adt_def, substs)) } pub fn mk_ptr(self, tm: TypeAndMut<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyRawPtr(tm)) + self.mk_ty(RawPtr(tm)) } pub fn mk_ref(self, r: Region<'tcx>, tm: TypeAndMut<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyRef(r, tm.ty, tm.mutbl)) + self.mk_ty(Ref(r, tm.ty, tm.mutbl)) } pub fn mk_mut_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { @@ -2438,19 +2438,19 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> { - self.mk_ty(TyArray(ty, ty::Const::from_usize(self, n))) + self.mk_ty(Array(ty, ty::Const::from_usize(self, n))) } pub fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx> { - self.mk_ty(TySlice(ty)) + self.mk_ty(Slice(ty)) } pub fn intern_tup(self, ts: &[Ty<'tcx>]) -> Ty<'tcx> { - self.mk_ty(TyTuple(self.intern_type_list(ts))) + self.mk_ty(Tuple(self.intern_type_list(ts))) } pub fn mk_tup], Ty<'tcx>>>(self, iter: I) -> I::Output { - iter.intern_with(|ts| self.mk_ty(TyTuple(self.intern_type_list(ts)))) + iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(ts)))) } pub fn mk_nil(self) -> Ty<'tcx> { @@ -2471,11 +2471,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_fn_def(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyFnDef(def_id, substs)) + self.mk_ty(FnDef(def_id, substs)) } pub fn mk_fn_ptr(self, fty: PolyFnSig<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyFnPtr(fty)) + self.mk_ty(FnPtr(fty)) } pub fn mk_dynamic( @@ -2483,14 +2483,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { obj: ty::Binder<&'tcx List>>, reg: ty::Region<'tcx> ) -> Ty<'tcx> { - self.mk_ty(TyDynamic(obj, reg)) + self.mk_ty(Dynamic(obj, reg)) } pub fn mk_projection(self, item_def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyProjection(ProjectionTy { + self.mk_ty(Projection(ProjectionTy { item_def_id, substs, })) @@ -2498,7 +2498,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn mk_closure(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyClosure(closure_id, closure_substs)) + self.mk_ty(Closure(closure_id, closure_substs)) } pub fn mk_generator(self, @@ -2506,11 +2506,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { generator_substs: GeneratorSubsts<'tcx>, movability: hir::GeneratorMovability) -> Ty<'tcx> { - self.mk_ty(TyGenerator(id, generator_substs, movability)) + self.mk_ty(Generator(id, generator_substs, movability)) } pub fn mk_generator_witness(self, types: ty::Binder<&'tcx List>>) -> Ty<'tcx> { - self.mk_ty(TyGeneratorWitness(types)) + self.mk_ty(GeneratorWitness(types)) } pub fn mk_var(self, v: TyVid) -> Ty<'tcx> { @@ -2526,7 +2526,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_infer(self, it: InferTy) -> Ty<'tcx> { - self.mk_ty(TyInfer(it)) + self.mk_ty(Infer(it)) } pub fn mk_ty_param(self, @@ -2549,7 +2549,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_anon(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { - self.mk_ty(TyAnon(def_id, substs)) + self.mk_ty(Anon(def_id, substs)) } pub fn intern_existential_predicates(self, eps: &[ExistentialPredicate<'tcx>]) diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 5ba697ee79532..51d0a6819f662 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -176,20 +176,20 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { pub fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> String { match self.sty { ty::TyBool | ty::TyChar | ty::TyInt(_) | - ty::TyUint(_) | ty::TyFloat(_) | ty::TyStr | ty::TyNever => self.to_string(), - ty::TyTuple(ref tys) if tys.is_empty() => self.to_string(), + ty::TyUint(_) | ty::TyFloat(_) | ty::TyStr | ty::Never => self.to_string(), + ty::Tuple(ref tys) if tys.is_empty() => self.to_string(), - ty::TyAdt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)), + ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)), ty::TyForeign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)), - ty::TyArray(_, n) => { + ty::Array(_, n) => { match n.assert_usize(tcx) { Some(n) => format!("array of {} elements", n), None => "array".to_string(), } } - ty::TySlice(_) => "slice".to_string(), - ty::TyRawPtr(_) => "*-ptr".to_string(), - ty::TyRef(region, ty, mutbl) => { + ty::Slice(_) => "slice".to_string(), + ty::RawPtr(_) => "*-ptr".to_string(), + ty::Ref(region, ty, mutbl) => { let tymut = ty::TypeAndMut { ty, mutbl }; let tymut_string = tymut.to_string(); if tymut_string == "_" || //unknown type name, @@ -204,24 +204,24 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { format!("&{}", tymut_string) } } - ty::TyFnDef(..) => "fn item".to_string(), - ty::TyFnPtr(_) => "fn pointer".to_string(), - ty::TyDynamic(ref inner, ..) => { + ty::FnDef(..) => "fn item".to_string(), + ty::FnPtr(_) => "fn pointer".to_string(), + ty::Dynamic(ref inner, ..) => { inner.principal().map_or_else(|| "trait".to_string(), |p| format!("trait {}", tcx.item_path_str(p.def_id()))) } - ty::TyClosure(..) => "closure".to_string(), - ty::TyGenerator(..) => "generator".to_string(), - ty::TyGeneratorWitness(..) => "generator witness".to_string(), - ty::TyTuple(..) => "tuple".to_string(), - ty::TyInfer(ty::TyVar(_)) => "inferred type".to_string(), - ty::TyInfer(ty::IntVar(_)) => "integral variable".to_string(), - ty::TyInfer(ty::FloatVar(_)) => "floating-point variable".to_string(), - ty::TyInfer(ty::CanonicalTy(_)) | - ty::TyInfer(ty::FreshTy(_)) => "skolemized type".to_string(), - ty::TyInfer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(), - ty::TyInfer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(), - ty::TyProjection(_) => "associated type".to_string(), + ty::Closure(..) => "closure".to_string(), + ty::Generator(..) => "generator".to_string(), + ty::GeneratorWitness(..) => "generator witness".to_string(), + ty::Tuple(..) => "tuple".to_string(), + ty::Infer(ty::TyVar(_)) => "inferred type".to_string(), + ty::Infer(ty::IntVar(_)) => "integral variable".to_string(), + ty::Infer(ty::FloatVar(_)) => "floating-point variable".to_string(), + ty::Infer(ty::CanonicalTy(_)) | + ty::Infer(ty::FreshTy(_)) => "skolemized type".to_string(), + ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(), + ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(), + ty::Projection(_) => "associated type".to_string(), ty::TyParam(ref p) => { if p.is_self() { "Self".to_string() @@ -229,8 +229,8 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { "type parameter".to_string() } } - ty::TyAnon(..) => "anonymized type".to_string(), - ty::TyError => "type error".to_string(), + ty::Anon(..) => "anonymized type".to_string(), + ty::Error => "type error".to_string(), } } } @@ -251,7 +251,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { db.help("consider boxing your closure and/or using it as a trait object"); } match (&values.found.sty, &values.expected.sty) { // Issue #53280 - (ty::TyInfer(ty::IntVar(_)), ty::TyFloat(_)) => { + (ty::Infer(ty::IntVar(_)), ty::TyFloat(_)) => { if let Ok(snippet) = self.sess.source_map().span_to_snippet(sp) { if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') { db.span_suggestion_with_applicability( diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index cf5e55a59f713..cdafdfeddea47 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -73,37 +73,37 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::TyInt(int_type) => Some(IntSimplifiedType(int_type)), ty::TyUint(uint_type) => Some(UintSimplifiedType(uint_type)), ty::TyFloat(float_type) => Some(FloatSimplifiedType(float_type)), - ty::TyAdt(def, _) => Some(AdtSimplifiedType(def.did)), + ty::Adt(def, _) => Some(AdtSimplifiedType(def.did)), ty::TyStr => Some(StrSimplifiedType), - ty::TyArray(..) | ty::TySlice(_) => Some(ArraySimplifiedType), - ty::TyRawPtr(_) => Some(PtrSimplifiedType), - ty::TyDynamic(ref trait_info, ..) => { + ty::Array(..) | ty::Slice(_) => Some(ArraySimplifiedType), + ty::RawPtr(_) => Some(PtrSimplifiedType), + ty::Dynamic(ref trait_info, ..) => { trait_info.principal().map(|p| TraitSimplifiedType(p.def_id())) } - ty::TyRef(_, ty, _) => { + ty::Ref(_, ty, _) => { // since we introduce auto-refs during method lookup, we // just treat &T and T as equivalent from the point of // view of possibly unifying simplify_type(tcx, ty, can_simplify_params) } - ty::TyFnDef(def_id, _) | - ty::TyClosure(def_id, _) => { + ty::FnDef(def_id, _) | + ty::Closure(def_id, _) => { Some(ClosureSimplifiedType(def_id)) } - ty::TyGenerator(def_id, _, _) => { + ty::Generator(def_id, _, _) => { Some(GeneratorSimplifiedType(def_id)) } - ty::TyGeneratorWitness(ref tys) => { + ty::GeneratorWitness(ref tys) => { Some(GeneratorWitnessSimplifiedType(tys.skip_binder().len())) } - ty::TyNever => Some(NeverSimplifiedType), - ty::TyTuple(ref tys) => { + ty::Never => Some(NeverSimplifiedType), + ty::Tuple(ref tys) => { Some(TupleSimplifiedType(tys.len())) } - ty::TyFnPtr(ref f) => { + ty::FnPtr(ref f) => { Some(FunctionSimplifiedType(f.skip_binder().inputs().len())) } - ty::TyProjection(_) | ty::TyParam(_) => { + ty::Projection(_) | ty::TyParam(_) => { if can_simplify_params { // In normalized types, projections don't unify with // anything. when lazy normalization happens, this @@ -115,13 +115,13 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, None } } - ty::TyAnon(def_id, _) => { + ty::Anon(def_id, _) => { Some(AnonSimplifiedType(def_id)) } ty::TyForeign(def_id) => { Some(ForeignSimplifiedType(def_id)) } - ty::TyInfer(_) | ty::TyError => None, + ty::Infer(_) | ty::Error => None, } } diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 7dbd509f4f2ad..067d7cc00c5f0 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -74,19 +74,19 @@ impl FlagComputation { &ty::TyInt(_) | &ty::TyFloat(_) | &ty::TyUint(_) | - &ty::TyNever | + &ty::Never | &ty::TyStr | &ty::TyForeign(..) => { } - // You might think that we could just return TyError for - // any type containing TyError as a component, and get + // You might think that we could just return Error for + // any type containing Error as a component, and get // rid of the TypeFlags::HAS_TY_ERR flag -- likewise for ty_bot (with // the exception of function types that return bot). // But doing so caused sporadic memory corruption, and // neither I (tjc) nor nmatsakis could figure out why, // so we're doing it this way. - &ty::TyError => { + &ty::Error => { self.add_flags(TypeFlags::HAS_TY_ERR) } @@ -99,25 +99,25 @@ impl FlagComputation { } } - &ty::TyGenerator(_, ref substs, _) => { + &ty::Generator(_, ref substs, _) => { self.add_flags(TypeFlags::HAS_TY_CLOSURE); self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); self.add_substs(&substs.substs); } - &ty::TyGeneratorWitness(ref ts) => { + &ty::GeneratorWitness(ref ts) => { let mut computation = FlagComputation::new(); computation.add_tys(&ts.skip_binder()[..]); self.add_bound_computation(&computation); } - &ty::TyClosure(_, ref substs) => { + &ty::Closure(_, ref substs) => { self.add_flags(TypeFlags::HAS_TY_CLOSURE); self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); self.add_substs(&substs.substs); } - &ty::TyInfer(infer) => { + &ty::Infer(infer) => { self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); // it might, right? self.add_flags(TypeFlags::HAS_TY_INFER); match infer { @@ -136,11 +136,11 @@ impl FlagComputation { } } - &ty::TyAdt(_, substs) => { + &ty::Adt(_, substs) => { self.add_substs(substs); } - &ty::TyProjection(ref data) => { + &ty::Projection(ref data) => { // currently we can't normalize projections that // include bound regions, so track those separately. if !data.has_escaping_regions() { @@ -150,12 +150,12 @@ impl FlagComputation { self.add_projection_ty(data); } - &ty::TyAnon(_, substs) => { + &ty::Anon(_, substs) => { self.add_flags(TypeFlags::HAS_PROJECTION); self.add_substs(substs); } - &ty::TyDynamic(ref obj, r) => { + &ty::Dynamic(ref obj, r) => { let mut computation = FlagComputation::new(); for predicate in obj.skip_binder().iter() { match *predicate { @@ -172,33 +172,33 @@ impl FlagComputation { self.add_region(r); } - &ty::TyArray(tt, len) => { + &ty::Array(tt, len) => { self.add_ty(tt); self.add_const(len); } - &ty::TySlice(tt) => { + &ty::Slice(tt) => { self.add_ty(tt) } - &ty::TyRawPtr(ref m) => { + &ty::RawPtr(ref m) => { self.add_ty(m.ty); } - &ty::TyRef(r, ty, _) => { + &ty::Ref(r, ty, _) => { self.add_region(r); self.add_ty(ty); } - &ty::TyTuple(ref ts) => { + &ty::Tuple(ref ts) => { self.add_tys(&ts[..]); } - &ty::TyFnDef(_, substs) => { + &ty::FnDef(_, substs) => { self.add_substs(substs); } - &ty::TyFnPtr(f) => { + &ty::FnPtr(f) => { self.add_fn_sig(f); } } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index e4484041b065c..26010c3d5f55c 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -771,7 +771,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector { // in the normalized form if self.just_constrained { match t.sty { - ty::TyProjection(..) | ty::TyAnon(..) => { return false; } + ty::Projection(..) | ty::Anon(..) => { return false; } _ => { } } } diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index f8b0b1cc88713..ef5b223620032 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -226,7 +226,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest { match self.sty { - TyAdt(def, substs) => { + Adt(def, substs) => { { let substs_set = visited.entry(def.did).or_default(); if !substs_set.insert(substs) { @@ -255,13 +255,13 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { ret }, - TyNever => DefIdForest::full(tcx), - TyTuple(ref tys) => { + Never => DefIdForest::full(tcx), + Tuple(ref tys) => { DefIdForest::union(tcx, tys.iter().map(|ty| { ty.uninhabited_from(visited, tcx) })) }, - TyArray(ty, len) => { + Array(ty, len) => { match len.assert_usize(tcx) { // If the array is definitely non-empty, it's uninhabited if // the type of its elements is uninhabited. @@ -269,7 +269,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { _ => DefIdForest::empty() } } - TyRef(_, ty, _) => { + Ref(_, ty, _) => { ty.uninhabited_from(visited, tcx) } diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 7329f4832f2e2..68996f52b867a 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -194,7 +194,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { ); let def = match item_type.sty { - ty::TyFnDef(..) if { + ty::FnDef(..) if { let f = item_type.fn_sig(tcx); f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 593470b5d1ecd..ce426c4749bd3 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -299,7 +299,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // impl on `Foo`, but fallback to `::bar` if self-type is // anything other than a simple path. match self_ty.sty { - ty::TyAdt(adt_def, substs) => { + ty::Adt(adt_def, substs) => { if substs.types().next().is_none() { // ignore regions self.push_item_path(buffer, adt_def.did); } else { @@ -357,24 +357,24 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// decisions and we may want to adjust it later. pub fn characteristic_def_id_of_type(ty: Ty) -> Option { match ty.sty { - ty::TyAdt(adt_def, _) => Some(adt_def.did), + ty::Adt(adt_def, _) => Some(adt_def.did), - ty::TyDynamic(data, ..) => data.principal().map(|p| p.def_id()), + ty::Dynamic(data, ..) => data.principal().map(|p| p.def_id()), - ty::TyArray(subty, _) | - ty::TySlice(subty) => characteristic_def_id_of_type(subty), + ty::Array(subty, _) | + ty::Slice(subty) => characteristic_def_id_of_type(subty), - ty::TyRawPtr(mt) => characteristic_def_id_of_type(mt.ty), + ty::RawPtr(mt) => characteristic_def_id_of_type(mt.ty), - ty::TyRef(_, ty, _) => characteristic_def_id_of_type(ty), + ty::Ref(_, ty, _) => characteristic_def_id_of_type(ty), - ty::TyTuple(ref tys) => tys.iter() + ty::Tuple(ref tys) => tys.iter() .filter_map(|ty| characteristic_def_id_of_type(ty)) .next(), - ty::TyFnDef(def_id, _) | - ty::TyClosure(def_id, _) | - ty::TyGenerator(def_id, _, _) | + ty::FnDef(def_id, _) | + ty::Closure(def_id, _) | + ty::Generator(def_id, _, _) | ty::TyForeign(def_id) => Some(def_id), ty::TyBool | @@ -382,14 +382,14 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option { ty::TyInt(_) | ty::TyUint(_) | ty::TyStr | - ty::TyFnPtr(_) | - ty::TyProjection(_) | + ty::FnPtr(_) | + ty::Projection(_) | ty::TyParam(_) | - ty::TyAnon(..) | - ty::TyInfer(_) | - ty::TyError | - ty::TyGeneratorWitness(..) | - ty::TyNever | + ty::Anon(..) | + ty::Infer(_) | + ty::Error | + ty::GeneratorWitness(..) | + ty::Never | ty::TyFloat(_) => None, } } diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 0da4d5ddea2f2..77a737c986098 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -489,14 +489,14 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { scalar(Int(Integer::from_attr(dl, attr::UnsignedInt(ity)), false)) } ty::TyFloat(fty) => scalar(Float(fty)), - ty::TyFnPtr(_) => { + ty::FnPtr(_) => { let mut ptr = scalar_unit(Pointer); ptr.valid_range = 1..=*ptr.valid_range.end(); tcx.intern_layout(LayoutDetails::scalar(self, ptr)) } // The never type. - ty::TyNever => { + ty::Never => { tcx.intern_layout(LayoutDetails { variants: Variants::Single { index: 0 }, fields: FieldPlacement::Union(0), @@ -507,8 +507,8 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Potentially-fat pointers. - ty::TyRef(_, pointee, _) | - ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => { + ty::Ref(_, pointee, _) | + ty::RawPtr(ty::TypeAndMut { ty: pointee, .. }) => { let mut data_ptr = scalar_unit(Pointer); if !ty.is_unsafe_ptr() { data_ptr.valid_range = 1..=*data_ptr.valid_range.end(); @@ -524,10 +524,10 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { ty::TyForeign(..) => { return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr))); } - ty::TySlice(_) | ty::TyStr => { + ty::Slice(_) | ty::TyStr => { scalar_unit(Int(dl.ptr_sized_integer(), false)) } - ty::TyDynamic(..) => { + ty::Dynamic(..) => { let mut vtable = scalar_unit(Pointer); vtable.valid_range = 1..=*vtable.valid_range.end(); vtable @@ -540,7 +540,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Arrays and slices. - ty::TyArray(element, mut count) => { + ty::Array(element, mut count) => { if count.has_projections() { count = tcx.normalize_erasing_regions(param_env, count); if count.has_projections() { @@ -564,7 +564,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { size }) } - ty::TySlice(element) => { + ty::Slice(element) => { let element = self.layout_of(element)?; tcx.intern_layout(LayoutDetails { variants: Variants::Single { index: 0 }, @@ -591,10 +591,10 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Odd unit types. - ty::TyFnDef(..) => { + ty::FnDef(..) => { univariant(&[], &ReprOptions::default(), StructKind::AlwaysSized)? } - ty::TyDynamic(..) | ty::TyForeign(..) => { + ty::Dynamic(..) | ty::TyForeign(..) => { let mut unit = univariant_uninterned(&[], &ReprOptions::default(), StructKind::AlwaysSized)?; match unit.abi { @@ -605,21 +605,21 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Tuples, generators and closures. - ty::TyGenerator(def_id, ref substs, _) => { + ty::Generator(def_id, ref substs, _) => { let tys = substs.field_tys(def_id, tcx); univariant(&tys.map(|ty| self.layout_of(ty)).collect::, _>>()?, &ReprOptions::default(), StructKind::AlwaysSized)? } - ty::TyClosure(def_id, ref substs) => { + ty::Closure(def_id, ref substs) => { let tys = substs.upvar_tys(def_id, tcx); univariant(&tys.map(|ty| self.layout_of(ty)).collect::, _>>()?, &ReprOptions::default(), StructKind::AlwaysSized)? } - ty::TyTuple(tys) => { + ty::Tuple(tys) => { let kind = if tys.len() == 0 { StructKind::AlwaysSized } else { @@ -631,7 +631,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // SIMD vector types. - ty::TyAdt(def, ..) if def.repr.simd() => { + ty::Adt(def, ..) if def.repr.simd() => { let element = self.layout_of(ty.simd_type(tcx))?; let count = ty.simd_size(tcx) as u64; assert!(count > 0); @@ -664,7 +664,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // ADTs. - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { // Cache the field layouts. let variants = def.variants.iter().map(|v| { v.fields.iter().map(|field| { @@ -1103,17 +1103,17 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Types with no meaningful known layout. - ty::TyProjection(_) | ty::TyAnon(..) => { + ty::Projection(_) | ty::Anon(..) => { let normalized = tcx.normalize_erasing_regions(param_env, ty); if ty == normalized { return Err(LayoutError::Unknown(ty)); } tcx.layout_raw(param_env.and(normalized))? } - ty::TyGeneratorWitness(..) | ty::TyInfer(_) => { + ty::GeneratorWitness(..) | ty::Infer(_) => { bug!("LayoutDetails::compute: unexpected type `{}`", ty) } - ty::TyParam(_) | ty::TyError => { + ty::TyParam(_) | ty::Error => { return Err(LayoutError::Unknown(ty)); } }) @@ -1153,12 +1153,12 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { }; let adt_def = match layout.ty.sty { - ty::TyAdt(ref adt_def, _) => { + ty::Adt(ref adt_def, _) => { debug!("print-type-size t: `{:?}` process adt", layout.ty); adt_def } - ty::TyClosure(..) => { + ty::Closure(..) => { debug!("print-type-size t: `{:?}` record closure", layout.ty); record(DataTypeKind::Closure, false, None, vec![]); return; @@ -1294,12 +1294,12 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> { }; match ty.sty { - ty::TyRef(_, pointee, _) | - ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => { + ty::Ref(_, pointee, _) | + ty::RawPtr(ty::TypeAndMut { ty: pointee, .. }) => { let non_zero = !ty.is_unsafe_ptr(); let tail = tcx.struct_tail(pointee); match tail.sty { - ty::TyParam(_) | ty::TyProjection(_) => { + ty::TyParam(_) | ty::Projection(_) => { debug_assert!(tail.has_param_types() || tail.has_self_ty()); Ok(SizeSkeleton::Pointer { non_zero, @@ -1314,7 +1314,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> { } } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { // Only newtypes and enums w/ nullable pointer optimization. if def.is_union() || def.variants.is_empty() || def.variants.len() > 2 { return Err(err); @@ -1373,7 +1373,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> { } } - ty::TyProjection(_) | ty::TyAnon(..) => { + ty::Projection(_) | ty::Anon(..) => { let normalized = tcx.normalize_erasing_regions(param_env, ty); if ty == normalized { Err(err) @@ -1552,7 +1552,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> }); let fields = match this.ty.sty { - ty::TyAdt(def, _) => def.variants[variant_index].fields.len(), + ty::Adt(def, _) => def.variants[variant_index].fields.len(), _ => bug!() }; let tcx = cx.tcx(); @@ -1587,18 +1587,18 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | - ty::TyFnPtr(_) | - ty::TyNever | - ty::TyFnDef(..) | - ty::TyGeneratorWitness(..) | + ty::FnPtr(_) | + ty::Never | + ty::FnDef(..) | + ty::GeneratorWitness(..) | ty::TyForeign(..) | - ty::TyDynamic(..) => { + ty::Dynamic(..) => { bug!("TyLayout::field_type({:?}): not applicable", this) } // Potentially-fat pointers. - ty::TyRef(_, pointee, _) | - ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => { + ty::Ref(_, pointee, _) | + ty::RawPtr(ty::TypeAndMut { ty: pointee, .. }) => { assert!(i < this.fields.count()); // Reuse the fat *T type as its own thin pointer data field. @@ -1619,9 +1619,9 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> } match tcx.struct_tail(pointee).sty { - ty::TySlice(_) | + ty::Slice(_) | ty::TyStr => tcx.types.usize, - ty::TyDynamic(data, _) => { + ty::Dynamic(data, _) => { let trait_def_id = data.principal().unwrap().def_id(); let num_fns: u64 = crate::traits::supertrait_def_ids(tcx, trait_def_id) .map(|trait_def_id| { @@ -1646,28 +1646,28 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> } // Arrays and slices. - ty::TyArray(element, _) | - ty::TySlice(element) => element, + ty::Array(element, _) | + ty::Slice(element) => element, ty::TyStr => tcx.types.u8, // Tuples, generators and closures. - ty::TyClosure(def_id, ref substs) => { + ty::Closure(def_id, ref substs) => { substs.upvar_tys(def_id, tcx).nth(i).unwrap() } - ty::TyGenerator(def_id, ref substs, _) => { + ty::Generator(def_id, ref substs, _) => { substs.field_tys(def_id, tcx).nth(i).unwrap() } - ty::TyTuple(tys) => tys[i], + ty::Tuple(tys) => tys[i], // SIMD vector types. - ty::TyAdt(def, ..) if def.repr.simd() => { + ty::Adt(def, ..) if def.repr.simd() => { this.ty.simd_type(tcx) } // ADTs. - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { match this.variants { Variants::Single { index } => { def.variants[index].fields[i].ty(tcx, substs) @@ -1686,8 +1686,8 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> } } - ty::TyProjection(_) | ty::TyAnon(..) | ty::TyParam(_) | - ty::TyInfer(_) | ty::TyError => { + ty::Projection(_) | ty::Anon(..) | ty::TyParam(_) | + ty::Infer(_) | ty::Error => { bug!("TyLayout::field_type: unexpected type `{}`", this.ty) } }) @@ -1749,7 +1749,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { // Locals variables which live across yields are stored // in the generator type as fields. These may be uninitialized // so we don't look for niches there. - if let ty::TyGenerator(..) = layout.ty.sty { + if let ty::Generator(..) = layout.ty.sty { return Ok(None); } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 74c09c25f4e21..17ce9ef87cbcf 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -450,7 +450,7 @@ bitflags! { const HAS_FREE_LOCAL_NAMES = 1 << 10; // Present if the type belongs in a local type context. - // Only set for TyInfer other than Fresh. + // Only set for Infer other than Fresh. const KEEP_IN_LOCAL_TCX = 1 << 11; // Is there a projection that does not involve a bound region? @@ -547,24 +547,24 @@ impl<'tcx> TyS<'tcx> { TyKind::TyInt(_) | TyKind::TyUint(_) | TyKind::TyFloat(_) | - TyKind::TyInfer(InferTy::IntVar(_)) | - TyKind::TyInfer(InferTy::FloatVar(_)) | - TyKind::TyInfer(InferTy::FreshIntTy(_)) | - TyKind::TyInfer(InferTy::FreshFloatTy(_)) => true, - TyKind::TyRef(_, x, _) => x.is_primitive_ty(), + TyKind::Infer(InferTy::IntVar(_)) | + TyKind::Infer(InferTy::FloatVar(_)) | + TyKind::Infer(InferTy::FreshIntTy(_)) | + TyKind::Infer(InferTy::FreshFloatTy(_)) => true, + TyKind::Ref(_, x, _) => x.is_primitive_ty(), _ => false, } } pub fn is_suggestable(&self) -> bool { match self.sty { - TyKind::TyAnon(..) | - TyKind::TyFnDef(..) | - TyKind::TyFnPtr(..) | - TyKind::TyDynamic(..) | - TyKind::TyClosure(..) | - TyKind::TyInfer(..) | - TyKind::TyProjection(..) => false, + TyKind::Anon(..) | + TyKind::FnDef(..) | + TyKind::FnPtr(..) | + TyKind::Dynamic(..) | + TyKind::Closure(..) | + TyKind::Infer(..) | + TyKind::Projection(..) => false, _ => true, } } @@ -2231,29 +2231,29 @@ impl<'a, 'gcx, 'tcx> AdtDef { -> Vec> { let result = match ty.sty { TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) | - TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) | - TyArray(..) | TyClosure(..) | TyGenerator(..) | TyNever => { + RawPtr(..) | Ref(..) | FnDef(..) | FnPtr(_) | + Array(..) | Closure(..) | Generator(..) | Never => { vec![] } TyStr | - TyDynamic(..) | - TySlice(_) | + Dynamic(..) | + Slice(_) | TyForeign(..) | - TyError | - TyGeneratorWitness(..) => { + Error | + GeneratorWitness(..) => { // these are never sized - return the target type vec![ty] } - TyTuple(ref tys) => { + Tuple(ref tys) => { match tys.last() { None => vec![], Some(ty) => self.sized_constraint_for_ty(tcx, ty) } } - TyAdt(adt, substs) => { + Adt(adt, substs) => { // recursive case let adt_tys = adt.sized_constraint(tcx); debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", @@ -2264,7 +2264,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { .collect() } - TyProjection(..) | TyAnon(..) => { + Projection(..) | Anon(..) => { // must calculate explicitly. // FIXME: consider special-casing always-Sized projections vec![ty] @@ -2291,7 +2291,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } - TyInfer(..) => { + Infer(..) => { bug!("unexpected type `{:?}` in sized_constraint_for_ty", ty) } @@ -2833,7 +2833,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) /// - a type parameter or projection whose Sizedness can't be known /// - a tuple of type parameters or projections, if there are multiple /// such. -/// - a TyError, if a type contained itself. The representability +/// - a Error, if a type contained itself. The representability /// check should catch this case. fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index ff99a4b7ff638..6803e15022de5 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -72,14 +72,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // in the `subtys` iterator (e.g., when encountering a // projection). match ty.sty { - ty::TyClosure(def_id, ref substs) => { + ty::Closure(def_id, ref substs) => { for upvar_ty in substs.upvar_tys(def_id, *self) { self.compute_components(upvar_ty, out); } } - ty::TyGenerator(def_id, ref substs, _) => { + ty::Generator(def_id, ref substs, _) => { // Same as the closure case for upvar_ty in substs.upvar_tys(def_id, *self) { self.compute_components(upvar_ty, out); @@ -90,7 +90,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } // All regions are bound inside a witness - ty::TyGeneratorWitness(..) => (), + ty::GeneratorWitness(..) => (), // OutlivesTypeParameterEnv -- the actual checking that `X:'a` // is implied by the environment is done in regionck. @@ -106,7 +106,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // trait-ref. Therefore, if we see any higher-ranke regions, // we simply fallback to the most restrictive rule, which // requires that `Pi: 'a` for all `i`. - ty::TyProjection(ref data) => { + ty::Projection(ref data) => { if !data.has_escaping_regions() { // best case: no escaping regions, so push the // projection and skip the subtree (thus generating no @@ -127,7 +127,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // We assume that inference variables are fully resolved. // So, if we encounter an inference variable, just record // the unresolved variable as a component. - ty::TyInfer(infer_ty) => { + ty::Infer(infer_ty) => { out.push(Component::UnresolvedInferenceVariable(infer_ty)); } @@ -142,20 +142,20 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::TyInt(..) | // OutlivesScalar ty::TyUint(..) | // OutlivesScalar ty::TyFloat(..) | // OutlivesScalar - ty::TyNever | // ... - ty::TyAdt(..) | // OutlivesNominalType - ty::TyAnon(..) | // OutlivesNominalType (ish) + ty::Never | // ... + ty::Adt(..) | // OutlivesNominalType + ty::Anon(..) | // OutlivesNominalType (ish) ty::TyForeign(..) | // OutlivesNominalType ty::TyStr | // OutlivesScalar (ish) - ty::TyArray(..) | // ... - ty::TySlice(..) | // ... - ty::TyRawPtr(..) | // ... - ty::TyRef(..) | // OutlivesReference - ty::TyTuple(..) | // ... - ty::TyFnDef(..) | // OutlivesFunction (*) - ty::TyFnPtr(_) | // OutlivesFunction (*) - ty::TyDynamic(..) | // OutlivesObject, OutlivesFragment (*) - ty::TyError => { + ty::Array(..) | // ... + ty::Slice(..) | // ... + ty::RawPtr(..) | // ... + ty::Ref(..) | // OutlivesReference + ty::Tuple(..) | // ... + ty::FnDef(..) | // OutlivesFunction (*) + ty::FnPtr(_) | // OutlivesFunction (*) + ty::Dynamic(..) | // OutlivesObject, OutlivesFragment (*) + ty::Error => { // (*) Bare functions and traits are both binders. In the // RFC, this means we would add the bound regions to the // "bound regions list". In our representation, no such diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 85f72203da817..baa7485d33a93 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -363,19 +363,19 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, let b_sty = &b.sty; debug!("super_tys: a_sty={:?} b_sty={:?}", a_sty, b_sty); match (a_sty, b_sty) { - (&ty::TyInfer(_), _) | - (_, &ty::TyInfer(_)) => + (&ty::Infer(_), _) | + (_, &ty::Infer(_)) => { // The caller should handle these cases! bug!("var types encountered in super_relate_tys") } - (&ty::TyError, _) | (_, &ty::TyError) => + (&ty::Error, _) | (_, &ty::Error) => { Ok(tcx.types.err) } - (&ty::TyNever, _) | + (&ty::Never, _) | (&ty::TyChar, _) | (&ty::TyBool, _) | (&ty::TyInt(_), _) | @@ -393,7 +393,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(a) } - (&ty::TyAdt(a_def, a_substs), &ty::TyAdt(b_def, b_substs)) + (&ty::Adt(a_def, a_substs), &ty::Adt(b_def, b_substs)) if a_def == b_def => { let substs = relation.relate_item_substs(a_def.did, a_substs, b_substs)?; @@ -406,7 +406,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_foreign(a_id)) } - (&ty::TyDynamic(ref a_obj, ref a_region), &ty::TyDynamic(ref b_obj, ref b_region)) => { + (&ty::Dynamic(ref a_obj, ref a_region), &ty::Dynamic(ref b_obj, ref b_region)) => { let region_bound = relation.with_cause(Cause::ExistentialRegionBound, |relation| { relation.relate_with_variance( @@ -417,18 +417,18 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_dynamic(relation.relate(a_obj, b_obj)?, region_bound)) } - (&ty::TyGenerator(a_id, a_substs, movability), - &ty::TyGenerator(b_id, b_substs, _)) + (&ty::Generator(a_id, a_substs, movability), + &ty::Generator(b_id, b_substs, _)) if a_id == b_id => { - // All TyGenerator types with the same id represent + // All Generator types with the same id represent // the (anonymous) type of the same generator expression. So // all of their regions should be equated. let substs = relation.relate(&a_substs, &b_substs)?; Ok(tcx.mk_generator(a_id, substs, movability)) } - (&ty::TyGeneratorWitness(a_types), &ty::TyGeneratorWitness(b_types)) => + (&ty::GeneratorWitness(a_types), &ty::GeneratorWitness(b_types)) => { // Wrap our types with a temporary GeneratorWitness struct // inside the binder so we can related them @@ -439,24 +439,24 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_generator_witness(types)) } - (&ty::TyClosure(a_id, a_substs), - &ty::TyClosure(b_id, b_substs)) + (&ty::Closure(a_id, a_substs), + &ty::Closure(b_id, b_substs)) if a_id == b_id => { - // All TyClosure types with the same id represent + // All Closure types with the same id represent // the (anonymous) type of the same closure expression. So // all of their regions should be equated. let substs = relation.relate(&a_substs, &b_substs)?; Ok(tcx.mk_closure(a_id, substs)) } - (&ty::TyRawPtr(ref a_mt), &ty::TyRawPtr(ref b_mt)) => + (&ty::RawPtr(ref a_mt), &ty::RawPtr(ref b_mt)) => { let mt = relation.relate(a_mt, b_mt)?; Ok(tcx.mk_ptr(mt)) } - (&ty::TyRef(a_r, a_ty, a_mutbl), &ty::TyRef(b_r, b_ty, b_mutbl)) => + (&ty::Ref(a_r, a_ty, a_mutbl), &ty::Ref(b_r, b_ty, b_mutbl)) => { let r = relation.relate_with_variance(ty::Contravariant, &a_r, &b_r)?; let a_mt = ty::TypeAndMut { ty: a_ty, mutbl: a_mutbl }; @@ -465,7 +465,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_ref(r, mt)) } - (&ty::TyArray(a_t, sz_a), &ty::TyArray(b_t, sz_b)) => + (&ty::Array(a_t, sz_a), &ty::Array(b_t, sz_b)) => { let t = relation.relate(&a_t, &b_t)?; assert_eq!(sz_a.ty, tcx.types.usize); @@ -514,26 +514,26 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, match (to_u64(sz_a), to_u64(sz_b)) { (Ok(sz_a_u64), Ok(sz_b_u64)) => { if sz_a_u64 == sz_b_u64 { - Ok(tcx.mk_ty(ty::TyArray(t, sz_a))) + Ok(tcx.mk_ty(ty::Array(t, sz_a))) } else { Err(TypeError::FixedArraySize( expected_found(relation, &sz_a_u64, &sz_b_u64))) } } - // We reported an error or will ICE, so we can return TyError. + // We reported an error or will ICE, so we can return Error. (Err(ErrorReported), _) | (_, Err(ErrorReported)) => { Ok(tcx.types.err) } } } - (&ty::TySlice(a_t), &ty::TySlice(b_t)) => + (&ty::Slice(a_t), &ty::Slice(b_t)) => { let t = relation.relate(&a_t, &b_t)?; Ok(tcx.mk_slice(t)) } - (&ty::TyTuple(as_), &ty::TyTuple(bs)) => + (&ty::Tuple(as_), &ty::Tuple(bs)) => { if as_.len() == bs.len() { Ok(tcx.mk_tup(as_.iter().zip(bs).map(|(a, b)| relation.relate(a, b)))?) @@ -545,26 +545,26 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, } } - (&ty::TyFnDef(a_def_id, a_substs), &ty::TyFnDef(b_def_id, b_substs)) + (&ty::FnDef(a_def_id, a_substs), &ty::FnDef(b_def_id, b_substs)) if a_def_id == b_def_id => { let substs = relation.relate_item_substs(a_def_id, a_substs, b_substs)?; Ok(tcx.mk_fn_def(a_def_id, substs)) } - (&ty::TyFnPtr(a_fty), &ty::TyFnPtr(b_fty)) => + (&ty::FnPtr(a_fty), &ty::FnPtr(b_fty)) => { let fty = relation.relate(&a_fty, &b_fty)?; Ok(tcx.mk_fn_ptr(fty)) } - (&ty::TyProjection(ref a_data), &ty::TyProjection(ref b_data)) => + (&ty::Projection(ref a_data), &ty::Projection(ref b_data)) => { let projection_ty = relation.relate(a_data, b_data)?; Ok(tcx.mk_projection(projection_ty.item_def_id, projection_ty.substs)) } - (&ty::TyAnon(a_def_id, a_substs), &ty::TyAnon(b_def_id, b_substs)) + (&ty::Anon(a_def_id, a_substs), &ty::Anon(b_def_id, b_substs)) if a_def_id == b_def_id => { let substs = relate_substs(relation, None, a_substs, b_substs)?; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 9fad583050f3b..367e4c5cc7a5c 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -836,33 +836,33 @@ impl<'tcx> TypeFoldable<'tcx> for interpret::GlobalId<'tcx> { impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let sty = match self.sty { - ty::TyRawPtr(tm) => ty::TyRawPtr(tm.fold_with(folder)), - ty::TyArray(typ, sz) => ty::TyArray(typ.fold_with(folder), sz.fold_with(folder)), - ty::TySlice(typ) => ty::TySlice(typ.fold_with(folder)), - ty::TyAdt(tid, substs) => ty::TyAdt(tid, substs.fold_with(folder)), - ty::TyDynamic(ref trait_ty, ref region) => - ty::TyDynamic(trait_ty.fold_with(folder), region.fold_with(folder)), - ty::TyTuple(ts) => ty::TyTuple(ts.fold_with(folder)), - ty::TyFnDef(def_id, substs) => { - ty::TyFnDef(def_id, substs.fold_with(folder)) + 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)), + ty::Adt(tid, substs) => ty::Adt(tid, substs.fold_with(folder)), + ty::Dynamic(ref trait_ty, ref region) => + ty::Dynamic(trait_ty.fold_with(folder), region.fold_with(folder)), + ty::Tuple(ts) => ty::Tuple(ts.fold_with(folder)), + ty::FnDef(def_id, substs) => { + ty::FnDef(def_id, substs.fold_with(folder)) } - ty::TyFnPtr(f) => ty::TyFnPtr(f.fold_with(folder)), - ty::TyRef(ref r, ty, mutbl) => { - ty::TyRef(r.fold_with(folder), ty.fold_with(folder), mutbl) + ty::FnPtr(f) => ty::FnPtr(f.fold_with(folder)), + ty::Ref(ref r, ty, mutbl) => { + ty::Ref(r.fold_with(folder), ty.fold_with(folder), mutbl) } - ty::TyGenerator(did, substs, movability) => { - ty::TyGenerator( + ty::Generator(did, substs, movability) => { + ty::Generator( did, substs.fold_with(folder), movability) } - ty::TyGeneratorWitness(types) => ty::TyGeneratorWitness(types.fold_with(folder)), - ty::TyClosure(did, substs) => ty::TyClosure(did, substs.fold_with(folder)), - ty::TyProjection(ref data) => ty::TyProjection(data.fold_with(folder)), - ty::TyAnon(did, substs) => ty::TyAnon(did, substs.fold_with(folder)), + ty::GeneratorWitness(types) => ty::GeneratorWitness(types.fold_with(folder)), + ty::Closure(did, substs) => ty::Closure(did, substs.fold_with(folder)), + ty::Projection(ref data) => ty::Projection(data.fold_with(folder)), + ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)), ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | - ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) | - ty::TyParam(..) | ty::TyNever | ty::TyForeign(..) => return self + ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | + ty::TyParam(..) | ty::Never | ty::TyForeign(..) => return self }; if self.sty == sty { @@ -878,26 +878,26 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { fn super_visit_with>(&self, visitor: &mut V) -> bool { match self.sty { - ty::TyRawPtr(ref tm) => tm.visit_with(visitor), - ty::TyArray(typ, sz) => typ.visit_with(visitor) || sz.visit_with(visitor), - ty::TySlice(typ) => typ.visit_with(visitor), - ty::TyAdt(_, substs) => substs.visit_with(visitor), - ty::TyDynamic(ref trait_ty, ref reg) => + ty::RawPtr(ref tm) => tm.visit_with(visitor), + ty::Array(typ, sz) => typ.visit_with(visitor) || sz.visit_with(visitor), + ty::Slice(typ) => typ.visit_with(visitor), + ty::Adt(_, substs) => substs.visit_with(visitor), + ty::Dynamic(ref trait_ty, ref reg) => trait_ty.visit_with(visitor) || reg.visit_with(visitor), - ty::TyTuple(ts) => ts.visit_with(visitor), - ty::TyFnDef(_, substs) => substs.visit_with(visitor), - ty::TyFnPtr(ref f) => f.visit_with(visitor), - ty::TyRef(r, ty, _) => r.visit_with(visitor) || ty.visit_with(visitor), - ty::TyGenerator(_did, ref substs, _) => { + ty::Tuple(ts) => ts.visit_with(visitor), + ty::FnDef(_, substs) => substs.visit_with(visitor), + ty::FnPtr(ref f) => f.visit_with(visitor), + ty::Ref(r, ty, _) => r.visit_with(visitor) || ty.visit_with(visitor), + ty::Generator(_did, ref substs, _) => { substs.visit_with(visitor) } - ty::TyGeneratorWitness(ref types) => types.visit_with(visitor), - ty::TyClosure(_did, ref substs) => substs.visit_with(visitor), - ty::TyProjection(ref data) => data.visit_with(visitor), - ty::TyAnon(_, ref substs) => substs.visit_with(visitor), + ty::GeneratorWitness(ref types) => types.visit_with(visitor), + ty::Closure(_did, ref substs) => substs.visit_with(visitor), + ty::Projection(ref data) => data.visit_with(visitor), + ty::Anon(_, ref substs) => substs.visit_with(visitor), ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | - ty::TyUint(_) | ty::TyFloat(_) | ty::TyError | ty::TyInfer(_) | - ty::TyParam(..) | ty::TyNever | ty::TyForeign(..) => false, + ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | + ty::TyParam(..) | ty::Never | ty::TyForeign(..) => false, } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 144abf2d7bd59..8a9302aa2d60d 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -103,9 +103,9 @@ pub enum TyKind<'tcx> { /// /// Substs here, possibly against intuition, *may* contain `TyParam`s. /// That is, even after substitution it is possible that there are type - /// variables. This happens when the `TyAdt` corresponds to an ADT + /// variables. This happens when the `Adt` corresponds to an ADT /// definition and not a concrete use of it. - TyAdt(&'tcx AdtDef, &'tcx Substs<'tcx>), + Adt(&'tcx AdtDef, &'tcx Substs<'tcx>), TyForeign(DefId), @@ -113,49 +113,49 @@ pub enum TyKind<'tcx> { TyStr, /// An array with the given length. Written as `[T; n]`. - TyArray(Ty<'tcx>, &'tcx ty::Const<'tcx>), + Array(Ty<'tcx>, &'tcx ty::Const<'tcx>), /// The pointee of an array slice. Written as `[T]`. - TySlice(Ty<'tcx>), + Slice(Ty<'tcx>), /// A raw pointer. Written as `*mut T` or `*const T` - TyRawPtr(TypeAndMut<'tcx>), + RawPtr(TypeAndMut<'tcx>), /// A reference; a pointer with an associated lifetime. Written as /// `&'a mut T` or `&'a T`. - TyRef(Region<'tcx>, Ty<'tcx>, hir::Mutability), + Ref(Region<'tcx>, Ty<'tcx>, hir::Mutability), /// The anonymous type of a function declaration/definition. Each /// function has a unique type. - TyFnDef(DefId, &'tcx Substs<'tcx>), + FnDef(DefId, &'tcx Substs<'tcx>), /// A pointer to a function. Written as `fn() -> i32`. - TyFnPtr(PolyFnSig<'tcx>), + FnPtr(PolyFnSig<'tcx>), /// A trait, defined with `trait`. - TyDynamic(Binder<&'tcx List>>, ty::Region<'tcx>), + Dynamic(Binder<&'tcx List>>, ty::Region<'tcx>), /// The anonymous type of a closure. Used to represent the type of /// `|a| a`. - TyClosure(DefId, ClosureSubsts<'tcx>), + Closure(DefId, ClosureSubsts<'tcx>), /// The anonymous type of a generator. Used to represent the type of /// `|a| yield a`. - TyGenerator(DefId, GeneratorSubsts<'tcx>, hir::GeneratorMovability), + Generator(DefId, GeneratorSubsts<'tcx>, hir::GeneratorMovability), /// A type representin the types stored inside a generator. /// This should only appear in GeneratorInteriors. - TyGeneratorWitness(Binder<&'tcx List>>), + GeneratorWitness(Binder<&'tcx List>>), /// The never type `!` - TyNever, + Never, /// A tuple type. For example, `(i32, bool)`. - TyTuple(&'tcx List>), + Tuple(&'tcx List>), /// The projection of an associated type. For example, /// `>::N`. - TyProjection(ProjectionTy<'tcx>), + Projection(ProjectionTy<'tcx>), /// Anonymized (`impl Trait`) type found in a return type. /// The DefId comes either from @@ -163,17 +163,17 @@ pub enum TyKind<'tcx> { /// * or the `existential type` declaration /// The substitutions are for the generics of the function in question. /// After typeck, the concrete type can be found in the `types` map. - TyAnon(DefId, &'tcx Substs<'tcx>), + Anon(DefId, &'tcx Substs<'tcx>), /// A type parameter; for example, `T` in `fn f(x: T) {} TyParam(ParamTy), /// A type variable used during type-checking. - TyInfer(InferTy), + Infer(InferTy), /// A placeholder for a type which could not be computed; this is /// propagated to avoid useless error messages. - TyError, + Error, } /// A closure can be modeled as a struct that looks like: @@ -348,7 +348,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// If you have an inference context, use `infcx.closure_sig()`. pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { match self.closure_sig_ty(def_id, tcx).sty { - ty::TyFnPtr(sig) => sig, + ty::FnPtr(sig) => sig, ref t => bug!("closure_sig_ty is not a fn-ptr: {:?}", t), } } @@ -1469,14 +1469,14 @@ impl RegionKind { impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_nil(&self) -> bool { match self.sty { - TyTuple(ref tys) => tys.is_empty(), + Tuple(ref tys) => tys.is_empty(), _ => false, } } pub fn is_never(&self) -> bool { match self.sty { - TyNever => true, + Never => true, _ => false, } } @@ -1490,20 +1490,20 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_ty_var(&self) -> bool { match self.sty { - TyInfer(TyVar(_)) => true, + Infer(TyVar(_)) => true, _ => false, } } pub fn is_ty_infer(&self) -> bool { match self.sty { - TyInfer(_) => true, + Infer(_) => true, _ => false, } } pub fn is_phantom_data(&self) -> bool { - if let TyAdt(def, _) = self.sty { + if let Adt(def, _) = self.sty { def.is_phantom_data() } else { false @@ -1528,8 +1528,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_slice(&self) -> bool { match self.sty { - TyRawPtr(TypeAndMut { ty, .. }) | TyRef(_, ty, _) => match ty.sty { - TySlice(_) | TyStr => true, + RawPtr(TypeAndMut { ty, .. }) | Ref(_, ty, _) => match ty.sty { + Slice(_) | TyStr => true, _ => false, }, _ => false @@ -1539,14 +1539,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { #[inline] pub fn is_simd(&self) -> bool { match self.sty { - TyAdt(def, _) => def.repr.simd(), + Adt(def, _) => def.repr.simd(), _ => false, } } pub fn sequence_element_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { - TyArray(ty, _) | TySlice(ty) => ty, + Array(ty, _) | Slice(ty) => ty, TyStr => tcx.mk_mach_uint(ast::UintTy::U8), _ => bug!("sequence_element_type called on non-sequence value: {}", self), } @@ -1554,7 +1554,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn simd_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { - TyAdt(def, substs) => { + Adt(def, substs) => { def.non_enum_variant().fields[0].ty(tcx, substs) } _ => bug!("simd_type called on invalid type") @@ -1563,36 +1563,36 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn simd_size(&self, _cx: TyCtxt) -> usize { match self.sty { - TyAdt(def, _) => def.non_enum_variant().fields.len(), + Adt(def, _) => def.non_enum_variant().fields.len(), _ => bug!("simd_size called on invalid type") } } pub fn is_region_ptr(&self) -> bool { match self.sty { - TyRef(..) => true, + Ref(..) => true, _ => false, } } pub fn is_mutable_pointer(&self) -> bool { match self.sty { - TyRawPtr(TypeAndMut { mutbl: hir::Mutability::MutMutable, .. }) | - TyRef(_, _, hir::Mutability::MutMutable) => true, + RawPtr(TypeAndMut { mutbl: hir::Mutability::MutMutable, .. }) | + Ref(_, _, hir::Mutability::MutMutable) => true, _ => false } } pub fn is_unsafe_ptr(&self) -> bool { match self.sty { - TyRawPtr(_) => return true, + RawPtr(_) => return true, _ => return false, } } pub fn is_box(&self) -> bool { match self.sty { - TyAdt(def, _) => def.is_box(), + Adt(def, _) => def.is_box(), _ => false, } } @@ -1600,19 +1600,19 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// panics if called on any type other than `Box` pub fn boxed_ty(&self) -> Ty<'tcx> { match self.sty { - TyAdt(def, substs) if def.is_box() => substs.type_at(0), + Adt(def, substs) if def.is_box() => substs.type_at(0), _ => bug!("`boxed_ty` is called on non-box type {:?}", self), } } /// A scalar type is one that denotes an atomic datum, with no sub-components. - /// (A TyRawPtr is scalar because it represents a non-managed pointer, so its + /// (A RawPtr is scalar because it represents a non-managed pointer, so its /// contents are abstract to rustc.) pub fn is_scalar(&self) -> bool { match self.sty { TyBool | TyChar | TyInt(_) | TyFloat(_) | TyUint(_) | - TyInfer(IntVar(_)) | TyInfer(FloatVar(_)) | - TyFnDef(..) | TyFnPtr(_) | TyRawPtr(_) => true, + Infer(IntVar(_)) | Infer(FloatVar(_)) | + FnDef(..) | FnPtr(_) | RawPtr(_) => true, _ => false } } @@ -1621,21 +1621,21 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_floating_point(&self) -> bool { match self.sty { TyFloat(_) | - TyInfer(FloatVar(_)) => true, + Infer(FloatVar(_)) => true, _ => false, } } pub fn is_trait(&self) -> bool { match self.sty { - TyDynamic(..) => true, + Dynamic(..) => true, _ => false, } } pub fn is_enum(&self) -> bool { match self.sty { - TyAdt(adt_def, _) => { + Adt(adt_def, _) => { adt_def.is_enum() } _ => false, @@ -1644,37 +1644,37 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_closure(&self) -> bool { match self.sty { - TyClosure(..) => true, + Closure(..) => true, _ => false, } } pub fn is_generator(&self) -> bool { match self.sty { - TyGenerator(..) => true, + Generator(..) => true, _ => false, } } pub fn is_integral(&self) -> bool { match self.sty { - TyInfer(IntVar(_)) | TyInt(_) | TyUint(_) => true, + Infer(IntVar(_)) | TyInt(_) | TyUint(_) => true, _ => false } } pub fn is_fresh_ty(&self) -> bool { match self.sty { - TyInfer(FreshTy(_)) => true, + Infer(FreshTy(_)) => true, _ => false, } } pub fn is_fresh(&self) -> bool { match self.sty { - TyInfer(FreshTy(_)) => true, - TyInfer(FreshIntTy(_)) => true, - TyInfer(FreshFloatTy(_)) => true, + Infer(FreshTy(_)) => true, + Infer(FreshIntTy(_)) => true, + Infer(FreshFloatTy(_)) => true, _ => false, } } @@ -1688,7 +1688,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn is_fp(&self) -> bool { match self.sty { - TyInfer(FloatVar(_)) | TyFloat(_) => true, + Infer(FloatVar(_)) | TyFloat(_) => true, _ => false } } @@ -1714,7 +1714,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { pub fn has_concrete_skeleton(&self) -> bool { match self.sty { - TyParam(_) | TyInfer(_) | TyError => false, + TyParam(_) | Infer(_) | Error => false, _ => true, } } @@ -1725,14 +1725,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// Some types---notably unsafe ptrs---can only be dereferenced explicitly. pub fn builtin_deref(&self, explicit: bool) -> Option> { match self.sty { - TyAdt(def, _) if def.is_box() => { + Adt(def, _) if def.is_box() => { Some(TypeAndMut { ty: self.boxed_ty(), mutbl: hir::MutImmutable, }) }, - TyRef(_, ty, mutbl) => Some(TypeAndMut { ty, mutbl }), - TyRawPtr(mt) if explicit => Some(mt), + Ref(_, ty, mutbl) => Some(TypeAndMut { ty, mutbl }), + RawPtr(mt) if explicit => Some(mt), _ => None, } } @@ -1740,38 +1740,38 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// Returns the type of `ty[i]`. pub fn builtin_index(&self) -> Option> { match self.sty { - TyArray(ty, _) | TySlice(ty) => Some(ty), + Array(ty, _) | Slice(ty) => Some(ty), _ => None, } } pub fn fn_sig(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PolyFnSig<'tcx> { match self.sty { - TyFnDef(def_id, substs) => { + FnDef(def_id, substs) => { tcx.fn_sig(def_id).subst(tcx, substs) } - TyFnPtr(f) => f, + FnPtr(f) => f, _ => bug!("Ty::fn_sig() called on non-fn type: {:?}", self) } } pub fn is_fn(&self) -> bool { match self.sty { - TyFnDef(..) | TyFnPtr(_) => true, + FnDef(..) | FnPtr(_) => true, _ => false, } } pub fn is_impl_trait(&self) -> bool { match self.sty { - TyAnon(..) => true, + Anon(..) => true, _ => false, } } pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> { match self.sty { - TyAdt(adt, _) => Some(adt), + Adt(adt, _) => Some(adt), _ => None, } } @@ -1781,44 +1781,44 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// ignores late-bound regions binders. pub fn regions(&self) -> Vec> { match self.sty { - TyRef(region, _, _) => { + Ref(region, _, _) => { vec![region] } - TyDynamic(ref obj, region) => { + Dynamic(ref obj, region) => { let mut v = vec![region]; if let Some(p) = obj.principal() { v.extend(p.skip_binder().substs.regions()); } v } - TyAdt(_, substs) | TyAnon(_, substs) => { + Adt(_, substs) | Anon(_, substs) => { substs.regions().collect() } - TyClosure(_, ClosureSubsts { ref substs }) | - TyGenerator(_, GeneratorSubsts { ref substs }, _) => { + Closure(_, ClosureSubsts { ref substs }) | + Generator(_, GeneratorSubsts { ref substs }, _) => { substs.regions().collect() } - TyProjection(ref data) => { + Projection(ref data) => { data.substs.regions().collect() } - TyFnDef(..) | - TyFnPtr(_) | - TyGeneratorWitness(..) | + FnDef(..) | + FnPtr(_) | + GeneratorWitness(..) | TyBool | TyChar | TyInt(_) | TyUint(_) | TyFloat(_) | TyStr | - TyArray(..) | - TySlice(_) | - TyRawPtr(_) | - TyNever | - TyTuple(..) | + Array(..) | + Slice(_) | + RawPtr(_) | + Never | + Tuple(..) | TyForeign(..) | TyParam(_) | - TyInfer(_) | - TyError => { + Infer(_) | + Error => { vec![] } } @@ -1845,9 +1845,9 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { _ => bug!("cannot convert type `{:?}` to a closure kind", self), }, - TyInfer(_) => None, + Infer(_) => None, - TyError => Some(ty::ClosureKind::Fn), + Error => Some(ty::ClosureKind::Fn), _ => bug!("cannot convert type `{:?}` to a closure kind", self), } @@ -1859,31 +1859,31 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// `false` means nothing -- could be sized, might not be. pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> bool { match self.sty { - ty::TyInfer(ty::IntVar(_)) | ty::TyInfer(ty::FloatVar(_)) | + ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) | - ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyRawPtr(..) | - ty::TyChar | ty::TyRef(..) | ty::TyGenerator(..) | - ty::TyGeneratorWitness(..) | ty::TyArray(..) | ty::TyClosure(..) | - ty::TyNever | ty::TyError => + ty::FnDef(..) | ty::FnPtr(_) | ty::RawPtr(..) | + ty::TyChar | ty::Ref(..) | ty::Generator(..) | + ty::GeneratorWitness(..) | ty::Array(..) | ty::Closure(..) | + ty::Never | ty::Error => true, - ty::TyStr | ty::TySlice(_) | ty::TyDynamic(..) | ty::TyForeign(..) => + ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => false, - ty::TyTuple(tys) => + ty::Tuple(tys) => tys.iter().all(|ty| ty.is_trivially_sized(tcx)), - ty::TyAdt(def, _substs) => + ty::Adt(def, _substs) => def.sized_constraint(tcx).is_empty(), - ty::TyProjection(_) | ty::TyParam(_) | ty::TyAnon(..) => false, + ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => false, - ty::TyInfer(ty::TyVar(_)) => false, + ty::Infer(ty::TyVar(_)) => false, - ty::TyInfer(ty::CanonicalTy(_)) | - ty::TyInfer(ty::FreshTy(_)) | - ty::TyInfer(ty::FreshIntTy(_)) | - ty::TyInfer(ty::FreshFloatTy(_)) => + ty::Infer(ty::CanonicalTy(_)) | + ty::Infer(ty::FreshTy(_)) | + ty::Infer(ty::FreshIntTy(_)) | + ty::Infer(ty::FreshFloatTy(_)) => bug!("is_trivially_sized applied to unexpected type: {:?}", self), } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index ea0b00483620b..d1f91b423acf0 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -194,10 +194,10 @@ impl<'tcx> ty::ParamEnv<'tcx> { // These types used to have a builtin impl. // Now libcore provides that impl. ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) | - ty::TyChar | ty::TyRawPtr(..) | ty::TyNever | - ty::TyRef(_, _, hir::MutImmutable) => return Ok(()), + ty::TyChar | ty::RawPtr(..) | ty::Never | + ty::Ref(_, _, hir::MutImmutable) => return Ok(()), - ty::TyAdt(adt, substs) => (adt, substs), + ty::Adt(adt, substs) => (adt, substs), _ => return Err(CopyImplementationError::NotAnAdt), }; @@ -258,10 +258,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn has_error_field(self, ty: Ty<'tcx>) -> bool { match ty.sty { - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { for field in def.all_fields() { let field_ty = field.ty(self, substs); - if let TyError = field_ty.sty { + if let Error = field_ty.sty { return true; } } @@ -277,7 +277,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> { loop { match ty.sty { - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { if !def.is_struct() { break; } @@ -287,7 +287,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - ty::TyTuple(tys) => { + ty::Tuple(tys) => { if let Some((&last_ty, _)) = tys.split_last() { ty = last_ty; } else { @@ -315,7 +315,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let (mut a, mut b) = (source, target); loop { match (&a.sty, &b.sty) { - (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs)) + (&Adt(a_def, a_substs), &Adt(b_def, b_substs)) if a_def == b_def && a_def.is_struct() => { if let Some(f) = a_def.non_enum_variant().fields.last() { a = f.ty(self, a_substs); @@ -324,7 +324,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { break; } }, - (&TyTuple(a_tys), &TyTuple(b_tys)) + (&Tuple(a_tys), &Tuple(b_tys)) if a_tys.len() == b_tys.len() => { if let Some(a_last) = a_tys.last() { a = a_last; @@ -487,12 +487,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // parameters marked as pure. let impl_substs = match self.type_of(impl_def_id).sty { - ty::TyAdt(def_, substs) if def_ == def => substs, + ty::Adt(def_, substs) if def_ == def => substs, _ => bug!() }; let item_substs = match self.type_of(def.did).sty { - ty::TyAdt(def_, substs) if def_ == def => substs, + ty::Adt(def_, substs) if def_ == def => substs, _ => bug!() }; @@ -697,7 +697,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { -> Representability { match ty.sty { - TyTuple(ref ts) => { + Tuple(ref ts) => { // Find non representable fold_repr(ts.iter().map(|ty| { is_type_structurally_recursive(tcx, sp, seen, representable_cache, ty) @@ -705,10 +705,10 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } // Fixed-length vectors. // FIXME(#11924) Behavior undecided for zero-length vectors. - TyArray(ty, _) => { + Array(ty, _) => { is_type_structurally_recursive(tcx, sp, seen, representable_cache, ty) } - TyAdt(def, substs) => { + Adt(def, substs) => { // Find non representable fields with their spans fold_repr(def.all_fields().map(|field| { let ty = field.ty(tcx, substs); @@ -723,7 +723,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } })) } - TyClosure(..) => { + Closure(..) => { // this check is run on type definitions, so we don't expect // to see closure types bug!("requires check invoked on inapplicable type: {:?}", ty) @@ -734,7 +734,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { fn same_struct_or_enum<'tcx>(ty: Ty<'tcx>, def: &'tcx ty::AdtDef) -> bool { match ty.sty { - TyAdt(ty_def, _) => { + Adt(ty_def, _) => { ty_def == def } _ => false @@ -743,7 +743,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { fn same_type<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { match (&a.sty, &b.sty) { - (&TyAdt(did_a, substs_a), &TyAdt(did_b, substs_b)) => { + (&Adt(did_a, substs_a), &Adt(did_b, substs_b)) => { if did_a != did_b { return false; } @@ -785,7 +785,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { ty: Ty<'tcx>) -> Representability { match ty.sty { - TyAdt(def, _) => { + Adt(def, _) => { { // Iterate through stack of previously seen types. let mut iter = seen.iter(); @@ -924,16 +924,16 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, match ty.sty { // Fast-path for primitive types - ty::TyInfer(ty::FreshIntTy(_)) | ty::TyInfer(ty::FreshFloatTy(_)) | - ty::TyBool | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::TyNever | - ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyChar | ty::TyGeneratorWitness(..) | - ty::TyRawPtr(_) | ty::TyRef(..) | ty::TyStr => false, + ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) | + ty::TyBool | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::Never | + ty::FnDef(..) | ty::FnPtr(_) | ty::TyChar | ty::GeneratorWitness(..) | + ty::RawPtr(_) | ty::Ref(..) | ty::TyStr => false, // Foreign types can never have destructors ty::TyForeign(..) => false, // `ManuallyDrop` doesn't have a destructor regardless of field types. - ty::TyAdt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, + ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, // Issue #22536: We first query type_moves_by_default. It sees a // normalized version of the type, and therefore will definitely @@ -951,30 +951,30 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // (see above), it is sound to treat it as having a destructor. // User destructors are the only way to have concrete drop types. - ty::TyAdt(def, _) if def.has_dtor(tcx) => true, + ty::Adt(def, _) if def.has_dtor(tcx) => true, // Can refer to a type which may drop. // FIXME(eddyb) check this against a ParamEnv. - ty::TyDynamic(..) | ty::TyProjection(..) | ty::TyParam(_) | - ty::TyAnon(..) | ty::TyInfer(_) | ty::TyError => true, + ty::Dynamic(..) | ty::Projection(..) | ty::TyParam(_) | + ty::Anon(..) | ty::Infer(_) | ty::Error => true, // Structural recursion. - ty::TyArray(ty, _) | ty::TySlice(ty) => needs_drop(ty), + ty::Array(ty, _) | ty::Slice(ty) => needs_drop(ty), - ty::TyClosure(def_id, ref substs) => substs.upvar_tys(def_id, tcx).any(needs_drop), + ty::Closure(def_id, ref substs) => substs.upvar_tys(def_id, tcx).any(needs_drop), // Pessimistically assume that all generators will require destructors // as we don't know if a destructor is a noop or not until after the MIR // state transformation pass - ty::TyGenerator(..) => true, + ty::Generator(..) => true, - ty::TyTuple(ref tys) => tys.iter().cloned().any(needs_drop), + ty::Tuple(ref tys) => tys.iter().cloned().any(needs_drop), // unions don't have destructors because of the child types, // only if they manually implement `Drop` (handled above). - ty::TyAdt(def, _) if def.is_union() => false, + ty::Adt(def, _) if def.is_union() => false, - ty::TyAdt(def, substs) => + ty::Adt(def, substs) => def.variants.iter().any( |variant| variant.fields.iter().any( |field| needs_drop(field.ty(tcx, substs)))), @@ -1025,13 +1025,13 @@ impl<'tcx> ExplicitSelf<'tcx> { match self_arg_ty.sty { _ if is_self_ty(self_arg_ty) => ByValue, - ty::TyRef(region, ty, mutbl) if is_self_ty(ty) => { + ty::Ref(region, ty, mutbl) if is_self_ty(ty) => { ByReference(region, mutbl) } - ty::TyRawPtr(ty::TypeAndMut { ty, mutbl }) if is_self_ty(ty) => { + ty::RawPtr(ty::TypeAndMut { ty, mutbl }) if is_self_ty(ty) => { ByRawPointer(mutbl) } - ty::TyAdt(def, _) if def.is_box() && is_self_ty(self_arg_ty.boxed_ty()) => { + ty::Adt(def, _) if def.is_box() && is_self_ty(self_arg_ty.boxed_ty()) => { ByBox } _ => Other diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index d12f73144269b..eafe4a81f7593 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -82,26 +82,26 @@ pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> AccIntoIter> { fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { match parent_ty.sty { ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | - ty::TyStr | ty::TyInfer(_) | ty::TyParam(_) | ty::TyNever | ty::TyError | + ty::TyStr | ty::Infer(_) | ty::TyParam(_) | ty::Never | ty::Error | ty::TyForeign(..) => { } - ty::TyArray(ty, len) => { + ty::Array(ty, len) => { push_const(stack, len); stack.push(ty); } - ty::TySlice(ty) => { + ty::Slice(ty) => { stack.push(ty); } - ty::TyRawPtr(ref mt) => { + ty::RawPtr(ref mt) => { stack.push(mt.ty); } - ty::TyRef(_, ty, _) => { + ty::Ref(_, ty, _) => { stack.push(ty); } - ty::TyProjection(ref data) => { + ty::Projection(ref data) => { stack.extend(data.substs.types().rev()); } - ty::TyDynamic(ref obj, ..) => { + ty::Dynamic(ref obj, ..) => { stack.extend(obj.iter().rev().flat_map(|predicate| { let (substs, opt_ty) = match *predicate.skip_binder() { ty::ExistentialPredicate::Trait(tr) => (tr.substs, None), @@ -115,25 +115,25 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { substs.types().rev().chain(opt_ty) })); } - ty::TyAdt(_, substs) | ty::TyAnon(_, substs) => { + ty::Adt(_, substs) | ty::Anon(_, substs) => { stack.extend(substs.types().rev()); } - ty::TyClosure(_, ref substs) => { + ty::Closure(_, ref substs) => { stack.extend(substs.substs.types().rev()); } - ty::TyGenerator(_, ref substs, _) => { + ty::Generator(_, ref substs, _) => { stack.extend(substs.substs.types().rev()); } - ty::TyGeneratorWitness(ts) => { + ty::GeneratorWitness(ts) => { stack.extend(ts.skip_binder().iter().cloned().rev()); } - ty::TyTuple(ts) => { + ty::Tuple(ts) => { stack.extend(ts.iter().cloned().rev()); } - ty::TyFnDef(_, substs) => { + ty::FnDef(_, substs) => { stack.extend(substs.types().rev()); } - ty::TyFnPtr(sig) => { + ty::FnPtr(sig) => { stack.push(sig.skip_binder().output()); stack.extend(sig.skip_binder().inputs().iter().cloned().rev()); } diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index d97553d62515e..0ebde35b134f1 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -253,26 +253,26 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { ty::TyInt(..) | ty::TyUint(..) | ty::TyFloat(..) | - ty::TyError | + ty::Error | ty::TyStr | - ty::TyGeneratorWitness(..) | - ty::TyNever | + ty::GeneratorWitness(..) | + ty::Never | ty::TyParam(_) | ty::TyForeign(..) => { // WfScalar, WfParameter, etc } - ty::TySlice(subty) => { + ty::Slice(subty) => { self.require_sized(subty, traits::SliceOrArrayElem); } - ty::TyArray(subty, len) => { + ty::Array(subty, len) => { self.require_sized(subty, traits::SliceOrArrayElem); assert_eq!(len.ty, self.infcx.tcx.types.usize); self.compute_const(len); } - ty::TyTuple(ref tys) => { + ty::Tuple(ref tys) => { if let Some((_last, rest)) = tys.split_last() { for elem in rest { self.require_sized(elem, traits::TupleElem); @@ -280,22 +280,22 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - ty::TyRawPtr(_) => { + ty::RawPtr(_) => { // simple cases that are WF if their type args are WF } - ty::TyProjection(data) => { + ty::Projection(data) => { subtys.skip_current_subtree(); // subtree handled by compute_projection self.compute_projection(data); } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { // WfNominalType let obligations = self.nominal_obligations(def.did, substs); self.out.extend(obligations); } - ty::TyRef(r, rty, _) => { + ty::Ref(r, rty, _) => { // WfReference if !r.has_escaping_regions() && !rty.has_escaping_regions() { let cause = self.cause(traits::ReferenceOutlivesReferent(ty)); @@ -309,7 +309,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - ty::TyGenerator(..) => { + ty::Generator(..) => { // Walk ALL the types in the generator: this will // include the upvar types as well as the yield // type. Note that this is mildly distinct from @@ -319,7 +319,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { // generators don't take arguments. } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { // Only check the upvar types for WF, not the rest // of the types within. This is needed because we // capture the signature and it may not be WF @@ -355,12 +355,12 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { // let the loop iterate into the argument/return // types appearing in the fn signature } - ty::TyAnon(did, substs) => { + ty::Anon(did, substs) => { // all of the requirements on type parameters // should've been checked by the instantiation // of whatever returned this exact `impl Trait`. @@ -372,7 +372,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - ty::TyDynamic(data, r) => { + ty::Dynamic(data, r) => { // WfObject // // Here, we defer WF checking due to higher-ranked @@ -408,9 +408,9 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { // register a pending obligation and keep // moving. (Goal is that an "inductive hypothesis" // is satisfied to ensure termination.) - ty::TyInfer(_) => { + ty::Infer(_) => { let ty = self.infcx.shallow_resolve(ty); - if let ty::TyInfer(_) = ty.sty { // not yet resolved... + if let ty::Infer(_) = ty.sty { // not yet resolved... if ty == ty0 { // ...this is the type we started from! no progress. return false; } @@ -423,7 +423,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } else { // Yes, resolved, proceed with the // result. Should never return false because - // `ty` is not a TyInfer. + // `ty` is not a Infer. assert!(self.compute(ty)); } } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 9be3dd731cd83..c096e1430a343 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -14,11 +14,11 @@ use mir::interpret::ConstValue; use middle::region::{self, BlockRemainder}; use ty::subst::{self, Subst}; use ty::{BrAnon, BrEnv, BrFresh, BrNamed}; -use ty::{TyBool, TyChar, TyAdt}; -use ty::{TyError, TyStr, TyArray, TySlice, TyFloat, TyFnDef, TyFnPtr}; -use ty::{TyParam, TyRawPtr, TyRef, TyNever, TyTuple}; -use ty::{TyClosure, TyGenerator, TyGeneratorWitness, TyForeign, TyProjection, TyAnon}; -use ty::{TyDynamic, TyInt, TyUint, TyInfer}; +use ty::{TyBool, TyChar, Adt}; +use ty::{Error, TyStr, Array, Slice, TyFloat, FnDef, FnPtr}; +use ty::{TyParam, RawPtr, Ref, Never, Tuple}; +use ty::{Closure, Generator, GeneratorWitness, TyForeign, Projection, Anon}; +use ty::{Dynamic, TyInt, TyUint, Infer}; use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; use util::nodemap::FxHashSet; @@ -371,7 +371,7 @@ impl PrintContext { if !verbose && fn_trait_kind.is_some() && projections.len() == 1 { let projection_ty = projections[0].ty; - if let TyTuple(ref args) = substs.type_at(1).sty { + if let Tuple(ref args) = substs.type_at(1).sty { return self.fn_sig(f, args, false, projection_ty); } } @@ -1037,14 +1037,14 @@ define_print! { TyInt(t) => write!(f, "{}", t.ty_to_string()), TyUint(t) => write!(f, "{}", t.ty_to_string()), TyFloat(t) => write!(f, "{}", t.ty_to_string()), - TyRawPtr(ref tm) => { + RawPtr(ref tm) => { write!(f, "*{} ", match tm.mutbl { hir::MutMutable => "mut", hir::MutImmutable => "const", })?; tm.ty.print(f, cx) } - TyRef(r, ty, mutbl) => { + Ref(r, ty, mutbl) => { write!(f, "&")?; let s = r.print_to_string(cx); if s != "'_" { @@ -1055,8 +1055,8 @@ define_print! { } ty::TypeAndMut { ty, mutbl }.print(f, cx) } - TyNever => write!(f, "!"), - TyTuple(ref tys) => { + Never => write!(f, "!"), + Tuple(ref tys) => { write!(f, "(")?; let mut tys = tys.iter(); if let Some(&ty) = tys.next() { @@ -1070,7 +1070,7 @@ define_print! { } write!(f, ")") } - TyFnDef(def_id, substs) => { + FnDef(def_id, substs) => { ty::tls::with(|tcx| { let mut sig = tcx.fn_sig(def_id); if let Some(substs) = tcx.lift(&substs) { @@ -1081,14 +1081,14 @@ define_print! { cx.parameterized(f, substs, def_id, &[])?; write!(f, "}}") } - TyFnPtr(ref bare_fn) => { + FnPtr(ref bare_fn) => { bare_fn.print(f, cx) } - TyInfer(infer_ty) => write!(f, "{}", infer_ty), - TyError => write!(f, "[type error]"), + Infer(infer_ty) => write!(f, "{}", infer_ty), + Error => write!(f, "[type error]"), TyParam(ref param_ty) => write!(f, "{}", param_ty), - TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]), - TyDynamic(data, r) => { + Adt(def, substs) => cx.parameterized(f, substs, def.did, &[]), + Dynamic(data, r) => { let r = r.print_to_string(cx); if !r.is_empty() { write!(f, "(")?; @@ -1102,10 +1102,10 @@ define_print! { } } TyForeign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]), - TyProjection(ref data) => data.print(f, cx), - TyAnon(def_id, substs) => { + Projection(ref data) => data.print(f, cx), + Anon(def_id, substs) => { if cx.is_verbose { - return write!(f, "TyAnon({:?}, {:?})", def_id, substs); + return write!(f, "Anon({:?}, {:?})", def_id, substs); } ty::tls::with(|tcx| { @@ -1155,7 +1155,7 @@ define_print! { }) } TyStr => write!(f, "str"), - TyGenerator(did, substs, movability) => ty::tls::with(|tcx| { + Generator(did, substs, movability) => ty::tls::with(|tcx| { let upvar_tys = substs.upvar_tys(did, tcx); let witness = substs.witness(did, tcx); if movability == hir::GeneratorMovability::Movable { @@ -1193,10 +1193,10 @@ define_print! { print!(f, cx, write(" "), print(witness), write("]")) }), - TyGeneratorWitness(types) => { + GeneratorWitness(types) => { ty::tls::with(|tcx| cx.in_binder(f, tcx, &types, tcx.lift(&types))) } - TyClosure(did, substs) => ty::tls::with(|tcx| { + Closure(did, substs) => ty::tls::with(|tcx| { let upvar_tys = substs.upvar_tys(did, tcx); write!(f, "[closure")?; @@ -1233,7 +1233,7 @@ define_print! { write!(f, "]") }), - TyArray(ty, sz) => { + Array(ty, sz) => { print!(f, cx, write("["), print(ty), write("; "))?; match sz.val { ConstValue::Unevaluated(_def_id, _substs) => { @@ -1245,7 +1245,7 @@ define_print! { } write!(f, "]") } - TySlice(ty) => { + Slice(ty) => { print!(f, cx, write("["), print(ty), write("]")) } } diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index dab60ef16613d..847d37be89933 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -843,7 +843,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { } LpExtend(ref lp_base, _, LpInterior(_, InteriorField(_))) => { match lp_base.to_type().sty { - ty::TyAdt(def, _) if def.has_dtor(self.tcx()) => { + ty::Adt(def, _) if def.has_dtor(self.tcx()) => { // In the case where the owner implements drop, then // the path must be initialized to prevent a case of // partial reinitialization diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index b76931c301748..5c165fbad6943 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -191,14 +191,14 @@ fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, Categorization::Interior(ref b, mc::InteriorField(_)) | Categorization::Interior(ref b, mc::InteriorElement(Kind::Pattern)) => { match b.ty.sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { if def.has_dtor(bccx.tcx) { Some(cmt.clone()) } else { check_and_get_illegal_move_origin(bccx, b) } } - ty::TySlice(..) => Some(cmt.clone()), + ty::Slice(..) => Some(cmt.clone()), _ => { check_and_get_illegal_move_origin(bccx, b) } diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs index e1c3ac839902f..31778668e6da0 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs @@ -154,7 +154,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &'a BorrowckCtxt<'a, 'tcx>, Categorization::Downcast(ref b, _) | Categorization::Interior(ref b, mc::InteriorField(_)) => { match b.ty.sty { - ty::TyAdt(def, _) if def.has_dtor(bccx.tcx) => { + ty::Adt(def, _) if def.has_dtor(bccx.tcx) => { bccx.cannot_move_out_of_interior_of_drop( move_from.span, b.ty, Origin::Ast) } diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index e332f68327546..d9784cc2177fd 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -104,7 +104,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { let result = self.restrict(&cmt_base); // Borrowing one union field automatically borrows all its fields. match base_ty.sty { - ty::TyAdt(adt_def, _) if adt_def.is_union() => match result { + ty::Adt(adt_def, _) if adt_def.is_union() => match result { RestrictionResult::Safe => RestrictionResult::Safe, RestrictionResult::SafeIf(base_lp, mut base_vec) => { for (i, field) in adt_def.non_enum_variant().fields.iter().enumerate() { diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 869ac44a856a8..91507c77ab396 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -697,7 +697,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { Some(nl.to_string()), Origin::Ast); let need_note = match lp.ty.sty { - ty::TyKind::TyClosure(id, _) => { + ty::TyKind::Closure(id, _) => { let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) { diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 979d71a0923c4..d9f223daf6091 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -329,7 +329,7 @@ impl<'a, 'tcx> MoveData<'tcx> { // all parent union fields, moves do not propagate upwards automatically. let mut lp = orig_lp.clone(); while let LpExtend(ref base_lp, mutbl, lp_elem) = lp.clone().kind { - if let (&ty::TyAdt(adt_def, _), LpInterior(opt_variant_id, interior)) + if let (&ty::Adt(adt_def, _), LpInterior(opt_variant_id, interior)) = (&base_lp.ty.sty, lp_elem) { if adt_def.is_union() { for (i, field) in adt_def.non_enum_variant().fields.iter().enumerate() { @@ -381,7 +381,7 @@ impl<'a, 'tcx> MoveData<'tcx> { span: Span) { // Assigning to one union field automatically assigns to all its fields. if let LpExtend(ref base_lp, mutbl, LpInterior(opt_variant_id, interior)) = lp.kind { - if let ty::TyAdt(adt_def, _) = base_lp.ty.sty { + if let ty::Adt(adt_def, _) = base_lp.ty.sty { if adt_def.is_union() { for (i, field) in adt_def.non_enum_variant().fields.iter().enumerate() { let field = diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 79343505c78a5..684f2b358858f 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -364,7 +364,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { assert!(!sig.variadic && extra_args.is_empty()); match sig.inputs().last().unwrap().sty { - ty::TyTuple(ref tupled_arguments) => { + ty::Tuple(ref tupled_arguments) => { inputs = &sig.inputs()[0..sig.inputs().len() - 1]; tupled_arguments } diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 3834672633c05..33dc94b27bde7 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -197,16 +197,16 @@ pub fn unsized_info( ) -> &'ll Value { let (source, target) = cx.tcx.struct_lockstep_tails(source, target); match (&source.sty, &target.sty) { - (&ty::TyArray(_, len), &ty::TySlice(_)) => { + (&ty::Array(_, len), &ty::Slice(_)) => { C_usize(cx, len.unwrap_usize(cx.tcx)) } - (&ty::TyDynamic(..), &ty::TyDynamic(..)) => { + (&ty::Dynamic(..), &ty::Dynamic(..)) => { // For now, upcasts are limited to changes in marker // traits, and hence never actually require an actual // change to the vtable. old_info.expect("unsized_info: missing old info for trait upcast") } - (_, &ty::TyDynamic(ref data, ..)) => { + (_, &ty::Dynamic(ref data, ..)) => { let vtable_ptr = cx.layout_of(cx.tcx.mk_mut_ptr(target)) .field(cx, abi::FAT_PTR_EXTRA); consts::ptrcast(meth::get_vtable(cx, source, data.principal()), @@ -227,23 +227,23 @@ pub fn unsize_thin_ptr( ) -> (&'ll Value, &'ll Value) { debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty); match (&src_ty.sty, &dst_ty.sty) { - (&ty::TyRef(_, a, _), - &ty::TyRef(_, b, _)) | - (&ty::TyRef(_, a, _), - &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) | - (&ty::TyRawPtr(ty::TypeAndMut { ty: a, .. }), - &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) => { + (&ty::Ref(_, a, _), + &ty::Ref(_, b, _)) | + (&ty::Ref(_, a, _), + &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) | + (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), + &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => { assert!(bx.cx.type_is_sized(a)); let ptr_ty = bx.cx.layout_of(b).llvm_type(bx.cx).ptr_to(); (bx.pointercast(src, ptr_ty), unsized_info(bx.cx, a, b, None)) } - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => { + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => { let (a, b) = (src_ty.boxed_ty(), dst_ty.boxed_ty()); assert!(bx.cx.type_is_sized(a)); let ptr_ty = bx.cx.layout_of(b).llvm_type(bx.cx).ptr_to(); (bx.pointercast(src, ptr_ty), unsized_info(bx.cx, a, b, None)) } - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) => { + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => { assert_eq!(def_a, def_b); let src_layout = bx.cx.layout_of(src_ty); @@ -299,16 +299,16 @@ pub fn coerce_unsized_into( OperandValue::Pair(base, info).store(bx, dst); }; match (&src_ty.sty, &dst_ty.sty) { - (&ty::TyRef(..), &ty::TyRef(..)) | - (&ty::TyRef(..), &ty::TyRawPtr(..)) | - (&ty::TyRawPtr(..), &ty::TyRawPtr(..)) => { + (&ty::Ref(..), &ty::Ref(..)) | + (&ty::Ref(..), &ty::RawPtr(..)) | + (&ty::RawPtr(..), &ty::RawPtr(..)) => { coerce_ptr() } - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => { + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => { coerce_ptr() } - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) => { + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) => { assert_eq!(def_a, def_b); for i in 0..def_a.variants[0].fields.len() { diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 51fc610408b52..53bb02ddd99d9 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -413,10 +413,10 @@ pub fn ty_fn_sig<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, -> ty::PolyFnSig<'tcx> { match ty.sty { - ty::TyFnDef(..) | - // Shims currently have type TyFnPtr. Not sure this should remain. - ty::TyFnPtr(_) => ty.fn_sig(cx.tcx), - ty::TyClosure(def_id, substs) => { + ty::FnDef(..) | + // Shims currently have type FnPtr. Not sure this should remain. + ty::FnPtr(_) => ty.fn_sig(cx.tcx), + ty::Closure(def_id, substs) => { let tcx = cx.tcx; let sig = substs.closure_sig(def_id, tcx); @@ -429,7 +429,7 @@ pub fn ty_fn_sig<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, sig.abi )) } - ty::TyGenerator(def_id, substs, _) => { + ty::Generator(def_id, substs, _) => { let tcx = cx.tcx; let sig = substs.poly_sig(def_id, cx.tcx); diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 770a22ad65842..6f09ebb382697 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -250,7 +250,7 @@ fn check_and_apply_linkage( // static and call it a day. Some linkages (like weak) will make it such // that the static actually has a null value. let llty2 = match ty.sty { - ty::TyRawPtr(ref mt) => cx.layout_of(mt.ty).llvm_type(cx), + ty::RawPtr(ref mt) => cx.layout_of(mt.ty).llvm_type(cx), _ => { if span.is_some() { cx.sess().span_fatal(span.unwrap(), "must have type `*const T` or `*mut T`") diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 32ea2c5eb8f35..500e659a76d95 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -435,7 +435,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> { let tail = self.tcx.struct_tail(ty); match tail.sty { ty::TyForeign(..) => false, - ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true, + ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true, _ => bug!("unexpected unsized tail: {:?}", tail.sty), } } diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index c79a1a4bd04c6..45bb951d9c184 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -309,7 +309,7 @@ fn fixed_vec_metadata( let (size, align) = cx.size_and_align_of(array_or_slice_type); let upper_bound = match array_or_slice_type.sty { - ty::TyArray(_, len) => { + ty::Array(_, len) => { len.unwrap_usize(cx.tcx) as c_longlong } _ => -1 @@ -396,7 +396,7 @@ fn subroutine_type_metadata( let signature_metadata: Vec<_> = iter::once( // return type match signature.output().sty { - ty::TyTuple(ref tys) if tys.is_empty() => None, + ty::Tuple(ref tys) if tys.is_empty() => None, _ => Some(type_metadata(cx, signature.output(), span)) } ).chain( @@ -435,7 +435,7 @@ fn trait_pointer_metadata( // But it does not describe the trait's methods. let containing_scope = match trait_type.sty { - ty::TyDynamic(ref data, ..) => if let Some(principal) = data.principal() { + ty::Dynamic(ref data, ..) => if let Some(principal) = data.principal() { let def_id = principal.def_id(); Some(get_namespace_for_item(cx, def_id)) } else { @@ -534,13 +534,13 @@ pub fn type_metadata( let ptr_metadata = |ty: Ty<'tcx>| { match ty.sty { - ty::TySlice(typ) => { + ty::Slice(typ) => { Ok(vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span)) } ty::TyStr => { Ok(vec_slice_metadata(cx, t, cx.tcx.types.u8, unique_type_id, usage_site_span)) } - ty::TyDynamic(..) => { + ty::Dynamic(..) => { Ok(MetadataCreationResult::new( trait_pointer_metadata(cx, ty, Some(t), unique_type_id), false)) @@ -562,7 +562,7 @@ pub fn type_metadata( }; let MetadataCreationResult { metadata, already_stored_in_typemap } = match t.sty { - ty::TyNever | + ty::Never | ty::TyBool | ty::TyChar | ty::TyInt(_) | @@ -570,17 +570,17 @@ pub fn type_metadata( ty::TyFloat(_) => { MetadataCreationResult::new(basic_type_metadata(cx, t), false) } - ty::TyTuple(ref elements) if elements.is_empty() => { + ty::Tuple(ref elements) if elements.is_empty() => { MetadataCreationResult::new(basic_type_metadata(cx, t), false) } - ty::TyArray(typ, _) | - ty::TySlice(typ) => { + ty::Array(typ, _) | + ty::Slice(typ) => { fixed_vec_metadata(cx, unique_type_id, t, typ, usage_site_span) } ty::TyStr => { fixed_vec_metadata(cx, unique_type_id, t, cx.tcx.types.i8, usage_site_span) } - ty::TyDynamic(..) => { + ty::Dynamic(..) => { MetadataCreationResult::new( trait_pointer_metadata(cx, t, None, unique_type_id), false) @@ -590,20 +590,20 @@ pub fn type_metadata( foreign_type_metadata(cx, t, unique_type_id), false) } - ty::TyRawPtr(ty::TypeAndMut{ty, ..}) | - ty::TyRef(_, ty, _) => { + ty::RawPtr(ty::TypeAndMut{ty, ..}) | + ty::Ref(_, ty, _) => { match ptr_metadata(ty) { Ok(res) => res, Err(metadata) => return metadata, } } - ty::TyAdt(def, _) if def.is_box() => { + ty::Adt(def, _) if def.is_box() => { match ptr_metadata(t.boxed_ty()) { Ok(res) => res, Err(metadata) => return metadata, } } - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { let fn_metadata = subroutine_type_metadata(cx, unique_type_id, t.fn_sig(cx.tcx), @@ -619,7 +619,7 @@ pub fn type_metadata( MetadataCreationResult::new(pointer_type_metadata(cx, t, fn_metadata), false) } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let upvar_tys : Vec<_> = substs.upvar_tys(def_id, cx.tcx).collect(); prepare_tuple_metadata(cx, t, @@ -627,7 +627,7 @@ pub fn type_metadata( unique_type_id, usage_site_span).finalize(cx) } - ty::TyGenerator(def_id, substs, _) => { + ty::Generator(def_id, substs, _) => { let upvar_tys : Vec<_> = substs.field_tys(def_id, cx.tcx).map(|t| { cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), t) }).collect(); @@ -637,7 +637,7 @@ pub fn type_metadata( unique_type_id, usage_site_span).finalize(cx) } - ty::TyAdt(def, ..) => match def.adt_kind() { + ty::Adt(def, ..) => match def.adt_kind() { AdtKind::Struct => { prepare_struct_metadata(cx, t, @@ -658,7 +658,7 @@ pub fn type_metadata( usage_site_span).finalize(cx) } }, - ty::TyTuple(ref elements) => { + ty::Tuple(ref elements) => { prepare_tuple_metadata(cx, t, &elements[..], @@ -765,8 +765,8 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType { debug!("basic_type_metadata: {:?}", t); let (name, encoding) = match t.sty { - ty::TyNever => ("!", DW_ATE_unsigned), - ty::TyTuple(ref elements) if elements.is_empty() => + ty::Never => ("!", DW_ATE_unsigned), + ty::Tuple(ref elements) if elements.is_empty() => ("()", DW_ATE_unsigned), ty::TyBool => ("bool", DW_ATE_boolean), ty::TyChar => ("char", DW_ATE_unsigned_char), @@ -1009,7 +1009,7 @@ fn prepare_struct_metadata( let struct_name = compute_debuginfo_type_name(cx, struct_type, false); let (struct_def_id, variant) = match struct_type.sty { - ty::TyAdt(def, _) => (def.did, def.non_enum_variant()), + ty::Adt(def, _) => (def.did, def.non_enum_variant()), _ => bug!("prepare_struct_metadata on a non-ADT") }; @@ -1126,7 +1126,7 @@ fn prepare_union_metadata( let union_name = compute_debuginfo_type_name(cx, union_type, false); let (union_def_id, variant) = match union_type.sty { - ty::TyAdt(def, _) => (def.did, def.non_enum_variant()), + ty::Adt(def, _) => (def.did, def.non_enum_variant()), _ => bug!("prepare_union_metadata on a non-ADT") }; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index fcb8bc3fe2b21..99919a940b405 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -323,7 +323,7 @@ pub fn create_function_debug_context( // Return type -- llvm::DIBuilder wants this at index 0 signature.push(match sig.output().sty { - ty::TyTuple(ref tys) if tys.is_empty() => None, + ty::Tuple(ref tys) if tys.is_empty() => None, _ => Some(type_metadata(cx, sig.output(), syntax_pos::DUMMY_SP)) }); @@ -347,7 +347,7 @@ pub fn create_function_debug_context( // already inaccurate due to ABI adjustments (see #42800). signature.extend(inputs.iter().map(|&t| { let t = match t.sty { - ty::TyArray(ct, _) + ty::Array(ct, _) if (ct == cx.tcx.types.u8) || cx.layout_of(ct).is_zst() => { cx.tcx.mk_imm_ptr(ct) } @@ -362,7 +362,7 @@ pub fn create_function_debug_context( } if sig.abi == Abi::RustCall && !sig.inputs().is_empty() { - if let ty::TyTuple(args) = sig.inputs()[sig.inputs().len() - 1].sty { + if let ty::Tuple(args) = sig.inputs()[sig.inputs().len() - 1].sty { signature.extend( args.iter().map(|argument_type| { Some(type_metadata(cx, argument_type, syntax_pos::DUMMY_SP)) @@ -460,7 +460,7 @@ pub fn create_function_debug_context( // Only "class" methods are generally understood by LLVM, // so avoid methods on other types (e.g. `<*mut T>::null`). match impl_self_ty.sty { - ty::TyAdt(def, ..) if !def.is_box() => { + ty::Adt(def, ..) if !def.is_box() => { Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP)) } _ => None diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 05a74db3a6ca9..e0ad72681ae11 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -44,16 +44,16 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ty::TyBool => output.push_str("bool"), ty::TyChar => output.push_str("char"), ty::TyStr => output.push_str("str"), - ty::TyNever => output.push_str("!"), + ty::Never => output.push_str("!"), ty::TyInt(int_ty) => output.push_str(int_ty.ty_to_string()), ty::TyUint(uint_ty) => output.push_str(uint_ty.ty_to_string()), ty::TyFloat(float_ty) => output.push_str(float_ty.ty_to_string()), ty::TyForeign(def_id) => push_item_name(cx, def_id, qualified, output), - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { push_item_name(cx, def.did, qualified, output); push_type_params(cx, substs, output); }, - ty::TyTuple(component_types) => { + ty::Tuple(component_types) => { output.push('('); for &component_type in component_types { push_debuginfo_type_name(cx, component_type, true, output); @@ -65,7 +65,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } output.push(')'); }, - ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => { + ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => { if !cpp_like_names { output.push('*'); } @@ -80,7 +80,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, output.push('*'); } }, - ty::TyRef(_, inner_type, mutbl) => { + ty::Ref(_, inner_type, mutbl) => { if !cpp_like_names { output.push('&'); } @@ -94,13 +94,13 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, output.push('*'); } }, - ty::TyArray(inner_type, len) => { + ty::Array(inner_type, len) => { output.push('['); push_debuginfo_type_name(cx, inner_type, true, output); output.push_str(&format!("; {}", len.unwrap_usize(cx.tcx))); output.push(']'); }, - ty::TySlice(inner_type) => { + ty::Slice(inner_type) => { if cpp_like_names { output.push_str("slice<"); } else { @@ -115,7 +115,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, output.push(']'); } }, - ty::TyDynamic(ref trait_data, ..) => { + ty::Dynamic(ref trait_data, ..) => { if let Some(principal) = trait_data.principal() { let principal = cx.tcx.normalize_erasing_late_bound_regions( ty::ParamEnv::reveal_all(), @@ -125,7 +125,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, push_type_params(cx, principal.substs, output); } }, - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { let sig = t.fn_sig(cx.tcx); if sig.unsafety() == hir::Unsafety::Unsafe { output.push_str("unsafe "); @@ -165,17 +165,17 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, push_debuginfo_type_name(cx, sig.output(), true, output); } }, - ty::TyClosure(..) => { + ty::Closure(..) => { output.push_str("closure"); } - ty::TyGenerator(..) => { + ty::Generator(..) => { output.push_str("generator"); } - ty::TyError | - ty::TyInfer(_) | - ty::TyProjection(..) | - ty::TyAnon(..) | - ty::TyGeneratorWitness(..) | + ty::Error | + ty::Infer(_) | + ty::Projection(..) | + ty::Anon(..) | + ty::GeneratorWitness(..) | ty::TyParam(_) => { bug!("debuginfo: Trying to create type name for \ unexpected type: {:?}", t); diff --git a/src/librustc_codegen_llvm/glue.rs b/src/librustc_codegen_llvm/glue.rs index 37ce51da77823..791d003165f07 100644 --- a/src/librustc_codegen_llvm/glue.rs +++ b/src/librustc_codegen_llvm/glue.rs @@ -35,12 +35,12 @@ pub fn size_and_align_of_dst(bx: &Builder<'_, 'll, 'tcx>, t: Ty<'tcx>, info: Opt return (size, align); } match t.sty { - ty::TyDynamic(..) => { + ty::Dynamic(..) => { // load size/align from vtable let vtable = info.unwrap(); (meth::SIZE.get_usize(bx, vtable), meth::ALIGN.get_usize(bx, vtable)) } - ty::TySlice(_) | ty::TyStr => { + ty::Slice(_) | ty::TyStr => { let unit = t.sequence_element_type(bx.tcx()); // The info in this case is the length of the str, so the size is that // times the unit size. @@ -81,7 +81,7 @@ pub fn size_and_align_of_dst(bx: &Builder<'_, 'll, 'tcx>, t: Ty<'tcx>, info: Opt let size = bx.add(sized_size, unsized_size); // Packed types ignore the alignment of their fields. - if let ty::TyAdt(def, _) = t.sty { + if let ty::Adt(def, _) = t.sty { if def.repr.packed() { unsized_align = sized_align; } diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 2fbae59a51589..06abe31327a20 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -98,7 +98,7 @@ pub fn codegen_intrinsic_call( let tcx = cx.tcx; let (def_id, substs) = match callee_ty.sty { - ty::TyFnDef(def_id, substs) => (def_id, substs), + ty::FnDef(def_id, substs) => (def_id, substs), _ => bug!("expected fn item type, found {}", callee_ty) }; @@ -1343,7 +1343,7 @@ fn generic_simd_intrinsic( // This counts how many pointers fn ptr_count(t: ty::Ty) -> usize { match t.sty { - ty::TyRawPtr(p) => 1 + ptr_count(p.ty), + ty::RawPtr(p) => 1 + ptr_count(p.ty), _ => 0, } } @@ -1351,7 +1351,7 @@ fn generic_simd_intrinsic( // Non-ptr type fn non_ptr(t: ty::Ty) -> ty::Ty { match t.sty { - ty::TyRawPtr(p) => non_ptr(p.ty), + ty::RawPtr(p) => non_ptr(p.ty), _ => t, } } @@ -1359,7 +1359,7 @@ fn generic_simd_intrinsic( // The second argument must be a simd vector with an element type that's a pointer // to the element type of the first argument let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).sty { - ty::TyRawPtr(p) if p.ty == in_elem => (ptr_count(arg_tys[1].simd_type(tcx)), + ty::RawPtr(p) if p.ty == in_elem => (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx))), _ => { require!(false, "expected element type `{}` of second argument `{}` \ @@ -1439,7 +1439,7 @@ fn generic_simd_intrinsic( // This counts how many pointers fn ptr_count(t: ty::Ty) -> usize { match t.sty { - ty::TyRawPtr(p) => 1 + ptr_count(p.ty), + ty::RawPtr(p) => 1 + ptr_count(p.ty), _ => 0, } } @@ -1447,7 +1447,7 @@ fn generic_simd_intrinsic( // Non-ptr type fn non_ptr(t: ty::Ty) -> ty::Ty { match t.sty { - ty::TyRawPtr(p) => non_ptr(p.ty), + ty::RawPtr(p) => non_ptr(p.ty), _ => t, } } @@ -1455,7 +1455,7 @@ fn generic_simd_intrinsic( // The second argument must be a simd vector with an element type that's a pointer // to the element type of the first argument let (pointer_count, underlying_ty) = match arg_tys[1].simd_type(tcx).sty { - ty::TyRawPtr(p) if p.ty == in_elem && p.mutbl == hir::MutMutable + ty::RawPtr(p) if p.ty == in_elem && p.mutbl == hir::MutMutable => (ptr_count(arg_tys[1].simd_type(tcx)), non_ptr(arg_tys[1].simd_type(tcx))), _ => { diff --git a/src/librustc_codegen_llvm/mir/analyze.rs b/src/librustc_codegen_llvm/mir/analyze.rs index 993138aee1cec..0206744eb2b6b 100644 --- a/src/librustc_codegen_llvm/mir/analyze.rs +++ b/src/librustc_codegen_llvm/mir/analyze.rs @@ -131,7 +131,7 @@ impl Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'll, 'tcx> { func: mir::Operand::Constant(ref c), ref args, .. } => match c.ty.sty { - ty::TyFnDef(did, _) => Some((did, args)), + ty::FnDef(did, _) => Some((did, args)), _ => None, }, _ => None, diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index 02de587467277..a534b4e478fb7 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -296,7 +296,7 @@ impl FunctionCx<'a, 'll, 'tcx> { &args1[..] }; let (drop_fn, fn_ty) = match ty.sty { - ty::TyDynamic(..) => { + ty::Dynamic(..) => { let fn_ty = drop_fn.ty(bx.cx.tcx); let sig = common::ty_fn_sig(bx.cx, fn_ty); let sig = bx.tcx().normalize_erasing_late_bound_regions( @@ -417,14 +417,14 @@ impl FunctionCx<'a, 'll, 'tcx> { let callee = self.codegen_operand(&bx, func); let (instance, mut llfn) = match callee.layout.ty.sty { - ty::TyFnDef(def_id, substs) => { + ty::FnDef(def_id, substs) => { (Some(ty::Instance::resolve(bx.cx.tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap()), None) } - ty::TyFnPtr(_) => { + ty::FnPtr(_) => { (None, Some(callee.immediate())) } _ => bug!("{} is not callable", callee.layout.ty) diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs index 6774ce818c1f6..2657543b2d167 100644 --- a/src/librustc_codegen_llvm/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -182,7 +182,7 @@ impl FunctionCx<'a, 'll, 'tcx> { .and_then(|c| { let field_ty = c.ty.builtin_index().unwrap(); let fields = match c.ty.sty { - ty::TyArray(_, n) => n.unwrap_usize(bx.tcx()), + ty::Array(_, n) => n.unwrap_usize(bx.tcx()), ref other => bug!("invalid simd shuffle type: {}", other), }; let values: Result, Lrc<_>> = (0..fields).map(|field| { diff --git a/src/librustc_codegen_llvm/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs index d3cb97f65ce26..9e65144bd60a1 100644 --- a/src/librustc_codegen_llvm/mir/mod.rs +++ b/src/librustc_codegen_llvm/mir/mod.rs @@ -467,7 +467,7 @@ fn arg_local_refs( let arg_ty = fx.monomorphize(&arg_decl.ty); let tupled_arg_tys = match arg_ty.sty { - ty::TyTuple(ref tys) => tys, + ty::Tuple(ref tys) => tys, _ => bug!("spread argument isn't a tuple?!") }; @@ -592,14 +592,14 @@ fn arg_local_refs( // Or is it the closure environment? let (closure_layout, env_ref) = match arg.layout.ty.sty { - ty::TyRawPtr(ty::TypeAndMut { ty, .. }) | - ty::TyRef(_, ty, _) => (bx.cx.layout_of(ty), true), + ty::RawPtr(ty::TypeAndMut { ty, .. }) | + ty::Ref(_, ty, _) => (bx.cx.layout_of(ty), true), _ => (arg.layout, false) }; let (def_id, upvar_substs) = match closure_layout.ty.sty { - ty::TyClosure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)), - ty::TyGenerator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)), + ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)), + ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)), _ => bug!("upvar_decls with non-closure arg0 type `{}`", closure_layout.ty) }; let upvar_tys = upvar_substs.upvar_tys(def_id, tcx); @@ -639,7 +639,7 @@ fn arg_local_refs( // a pointer in an alloca for debuginfo atm. let mut ops = if env_ref || env_alloca { &ops[..] } else { &ops[1..] }; - let ty = if let (true, &ty::TyRef(_, ty, _)) = (decl.by_ref, &ty.sty) { + let ty = if let (true, &ty::Ref(_, ty, _)) = (decl.by_ref, &ty.sty) { ty } else { ops = &ops[..ops.len() - 1]; diff --git a/src/librustc_codegen_llvm/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs index 89d41dcc8e994..ace907055a3ab 100644 --- a/src/librustc_codegen_llvm/mir/place.rs +++ b/src/librustc_codegen_llvm/mir/place.rs @@ -211,8 +211,8 @@ impl PlaceRef<'ll, 'tcx> { return simple(); } _ if !field.is_unsized() => return simple(), - ty::TySlice(..) | ty::TyStr | ty::TyForeign(..) => return simple(), - ty::TyAdt(def, _) => { + ty::Slice(..) | ty::TyStr | ty::TyForeign(..) => return simple(), + ty::Adt(def, _) => { if def.repr.packed() { // FIXME(eddyb) generalize the adjustment when we // start supporting packing to larger alignments. diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs index 84427d8b40f79..69263cbf416bd 100644 --- a/src/librustc_codegen_llvm/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -214,7 +214,7 @@ impl FunctionCx<'a, 'll, 'tcx> { let val = match *kind { mir::CastKind::ReifyFnPointer => { match operand.layout.ty.sty { - ty::TyFnDef(def_id, substs) => { + ty::FnDef(def_id, substs) => { if bx.cx.tcx.has_attr(def_id, "rustc_args_required_const") { bug!("reifying a fn ptr that requires \ const arguments"); @@ -229,7 +229,7 @@ impl FunctionCx<'a, 'll, 'tcx> { } mir::CastKind::ClosureFnPointer => { match operand.layout.ty.sty { - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let instance = monomorphize::resolve_closure( bx.cx.tcx, def_id, substs, ty::ClosureKind::FnOnce); OperandValue::Immediate(callee::get_fn(bx.cx, instance)) @@ -545,7 +545,7 @@ impl FunctionCx<'a, 'll, 'tcx> { // because codegen_place() panics if Local is operand. if let mir::Place::Local(index) = *place { if let LocalRef::Operand(Some(op)) = self.locals[index] { - if let ty::TyArray(_, n) = op.layout.ty.sty { + if let ty::Array(_, n) = op.layout.ty.sty { let n = n.unwrap_usize(bx.cx.tcx); return common::C_usize(bx.cx, n); } diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 69d91b327283d..a970d41c15b40 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -56,19 +56,19 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } let name = match layout.ty.sty { - ty::TyClosure(..) | - ty::TyGenerator(..) | - ty::TyAdt(..) | + ty::Closure(..) | + ty::Generator(..) | + ty::Adt(..) | // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). - // ty::TyDynamic(..) | + // ty::Dynamic(..) | ty::TyForeign(..) | ty::TyStr => { let mut name = String::with_capacity(32); let printer = DefPathBasedNames::new(cx.tcx, true, true); printer.push_type_name(layout.ty, &mut name); match (&layout.ty.sty, &layout.variants) { - (&ty::TyAdt(def, _), &layout::Variants::Single { index }) => { + (&ty::Adt(def, _), &layout::Variants::Single { index }) => { if def.is_enum() && !def.variants.is_empty() { write!(&mut name, "::{}", def.variants[index].name).unwrap(); } @@ -252,14 +252,14 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { return llty; } let llty = match self.ty.sty { - ty::TyRef(_, ty, _) | - ty::TyRawPtr(ty::TypeAndMut { ty, .. }) => { + ty::Ref(_, ty, _) | + ty::RawPtr(ty::TypeAndMut { ty, .. }) => { cx.layout_of(ty).llvm_type(cx).ptr_to() } - ty::TyAdt(def, _) if def.is_box() => { + ty::Adt(def, _) if def.is_box() => { cx.layout_of(self.ty.boxed_ty()).llvm_type(cx).ptr_to() } - ty::TyFnPtr(sig) => { + ty::FnPtr(sig) => { let sig = cx.tcx.normalize_erasing_late_bound_regions( ty::ParamEnv::reveal_all(), &sig, @@ -344,11 +344,11 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { // HACK(eddyb) special-case fat pointers until LLVM removes // pointee types, to avoid bitcasting every `OperandRef::deref`. match self.ty.sty { - ty::TyRef(..) | - ty::TyRawPtr(_) => { + ty::Ref(..) | + ty::RawPtr(_) => { return self.field(cx, index).llvm_type(cx); } - ty::TyAdt(def, _) if def.is_box() => { + ty::Adt(def, _) if def.is_box() => { let ptr_ty = cx.tcx.mk_mut_ptr(self.ty.boxed_ty()); return cx.layout_of(ptr_ty).scalar_pair_element_llvm_type(cx, index, immediate); } @@ -410,7 +410,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { let mut result = None; match self.ty.sty { - ty::TyRawPtr(mt) if offset.bytes() == 0 => { + ty::RawPtr(mt) if offset.bytes() == 0 => { let (size, align) = cx.size_and_align_of(mt.ty); result = Some(PointeeInfo { size, @@ -419,7 +419,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { }); } - ty::TyRef(_, ty, mt) if offset.bytes() == 0 => { + ty::Ref(_, ty, mt) if offset.bytes() == 0 => { let (size, align) = cx.size_and_align_of(ty); let kind = match mt { @@ -497,7 +497,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { // FIXME(eddyb) This should be for `ptr::Unique`, not `Box`. if let Some(ref mut pointee) = result { - if let ty::TyAdt(def, _) = self.ty.sty { + if let ty::Adt(def, _) = self.ty.sty { if def.is_box() && offset.bytes() == 0 { pointee.safe = Some(PointerKind::UniqueOwned); } diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index d834a6502b280..33ce06217a46e 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -171,7 +171,7 @@ fn get_symbol_hash<'a, 'tcx>( // If this is a function, we hash the signature as well. // This is not *strictly* needed, but it may help in some // situations, see the `run-make/a-b-a-linker-guard` test. - if let ty::TyFnDef(..) = item_type.sty { + if let ty::FnDef(..) = item_type.sty { item_type.fn_sig(tcx).hash_stable(&mut hcx, &mut hasher); } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index b501afbc1bd30..c26d8555214c1 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1320,7 +1320,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes { let msg = "mutating transmuted &mut T from &T may cause undefined behavior, \ consider instead using an UnsafeCell"; match get_transmute_from_to(cx, expr) { - Some((&ty::TyRef(_, _, from_mt), &ty::TyRef(_, _, to_mt))) => { + Some((&ty::Ref(_, _, from_mt), &ty::Ref(_, _, to_mt))) => { if to_mt == hir::Mutability::MutMutable && from_mt == hir::Mutability::MutImmutable { cx.span_lint(MUTABLE_TRANSMUTES, expr.span, msg); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index f56bbc9764f64..767d7430ee8d3 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -460,10 +460,10 @@ fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if def.variants[data_idx].fields.len() == 1 { match def.variants[data_idx].fields[0].ty(tcx, substs).sty { - ty::TyFnPtr(_) => { + ty::FnPtr(_) => { return true; } - ty::TyRef(..) => { + ty::Ref(..) => { return true; } _ => {} @@ -492,7 +492,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } match ty.sty { - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { if def.is_phantom_data() { return FfiPhantom(ty); } @@ -646,15 +646,15 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { }, // Primitive types with a stable representation. - ty::TyBool | ty::TyInt(..) | ty::TyUint(..) | ty::TyFloat(..) | ty::TyNever => FfiSafe, + ty::TyBool | ty::TyInt(..) | ty::TyUint(..) | ty::TyFloat(..) | ty::Never => FfiSafe, - ty::TySlice(_) => FfiUnsafe { + ty::Slice(_) => FfiUnsafe { ty: ty, reason: "slices have no C equivalent", help: Some("consider using a raw pointer instead"), }, - ty::TyDynamic(..) => FfiUnsafe { + ty::Dynamic(..) => FfiUnsafe { ty: ty, reason: "trait objects have no C equivalent", help: None, @@ -666,18 +666,18 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { help: Some("consider using `*const u8` and a length instead"), }, - ty::TyTuple(..) => FfiUnsafe { + ty::Tuple(..) => FfiUnsafe { ty: ty, reason: "tuples have unspecified layout", help: Some("consider using a struct instead"), }, - ty::TyRawPtr(ty::TypeAndMut { ty, .. }) | - ty::TyRef(_, ty, _) => self.check_type_for_ffi(cache, ty), + ty::RawPtr(ty::TypeAndMut { ty, .. }) | + ty::Ref(_, ty, _) => self.check_type_for_ffi(cache, ty), - ty::TyArray(ty, _) => self.check_type_for_ffi(cache, ty), + ty::Array(ty, _) => self.check_type_for_ffi(cache, ty), - ty::TyFnPtr(sig) => { + ty::FnPtr(sig) => { match sig.abi() { Abi::Rust | Abi::RustIntrinsic | Abi::PlatformIntrinsic | Abi::RustCall => { return FfiUnsafe { @@ -715,14 +715,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { ty::TyForeign(..) => FfiSafe, ty::TyParam(..) | - ty::TyInfer(..) | - ty::TyError | - ty::TyClosure(..) | - ty::TyGenerator(..) | - ty::TyGeneratorWitness(..) | - ty::TyProjection(..) | - ty::TyAnon(..) | - ty::TyFnDef(..) => bug!("Unexpected type in foreign function"), + ty::Infer(..) | + ty::Error | + ty::Closure(..) | + ty::Generator(..) | + ty::GeneratorWitness(..) | + ty::Projection(..) | + ty::Anon(..) | + ty::FnDef(..) => bug!("Unexpected type in foreign function"), } } @@ -746,7 +746,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { if let Some(s) = help { diag.help(s); } - if let ty::TyAdt(def, _) = unsafe_ty.sty { + if let ty::Adt(def, _) = unsafe_ty.sty { if let Some(sp) = self.cx.tcx.hir.span_if_local(def.did) { diag.span_note(sp, "type defined here"); } diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 2b8540ea3861a..7a9d18676cf6c 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -60,9 +60,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { let t = cx.tables.expr_ty(&expr); let ty_warned = match t.sty { - ty::TyTuple(ref tys) if tys.is_empty() => return, - ty::TyNever => return, - ty::TyAdt(def, _) => { + ty::Tuple(ref tys) if tys.is_empty() => return, + ty::Never => return, + ty::Adt(def, _) => { if def.variants.is_empty() { return; } else { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index a68c0692eb5e9..44d8d4a727769 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1342,7 +1342,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); let kind = match tables.node_id_to_type(hir_id).sty { - ty::TyGenerator(def_id, ..) => { + ty::Generator(def_id, ..) => { let layout = self.tcx.generator_layout(def_id); let data = GeneratorData { layout: layout.clone(), @@ -1350,7 +1350,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Generator(self.lazy(&data)) } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let sig = substs.closure_sig(def_id, self.tcx); let data = ClosureData { sig: self.lazy(&sig) }; EntryKind::Closure(self.lazy(&data)) @@ -1865,7 +1865,7 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) pub fn get_repr_options<'a, 'tcx, 'gcx>(tcx: &TyCtxt<'a, 'tcx, 'gcx>, did: DefId) -> ReprOptions { let ty = tcx.type_of(did); match ty.sty { - ty::TyAdt(ref def, _) => return def.repr, + ty::Adt(ref def, _) => return def.repr, _ => bug!("{} is not an ADT", ty), } } diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 15226a944afa1..288c540a55e2d 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -134,7 +134,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { if let Some(ty) = self.retrieve_type_for_place(place) { let needs_note = match ty.sty { - ty::TyKind::TyClosure(id, _) => { + ty::TyKind::Closure(id, _) => { let tables = self.tcx.typeck_tables_of(id); let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); @@ -834,19 +834,19 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { self.describe_field_from_ty(&ty.boxed_ty(), field) } else { match ty.sty { - ty::TyAdt(def, _) => if def.is_enum() { + ty::Adt(def, _) => if def.is_enum() { field.index().to_string() } else { def.non_enum_variant().fields[field.index()] .ident .to_string() }, - ty::TyTuple(_) => field.index().to_string(), - ty::TyRef(_, ty, _) | ty::TyRawPtr(ty::TypeAndMut { ty, .. }) => { + ty::Tuple(_) => field.index().to_string(), + ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => { self.describe_field_from_ty(&ty, field) } - ty::TyArray(ty, _) | ty::TySlice(ty) => self.describe_field_from_ty(&ty, field), - ty::TyClosure(def_id, _) | ty::TyGenerator(def_id, _, _) => { + ty::Array(ty, _) | ty::Slice(ty) => self.describe_field_from_ty(&ty, field), + ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => { // Convert the def-id into a node-id. node-ids are only valid for // the local code in the current crate, so this returns an `Option` in case // the closure comes from another crate. But in that case we wouldn't diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 4390ca371823a..f4071e02f5580 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -935,14 +935,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // individual fields instead. This way if `foo` has a // destructor but `bar` does not, we will only check for // borrows of `x.foo` and not `x.bar`. See #47703. - ty::TyAdt(def, substs) if def.is_struct() && !def.has_dtor(self.tcx) => { + ty::Adt(def, substs) if def.is_struct() && !def.has_dtor(self.tcx) => { def.all_fields() .map(|field| field.ty(gcx, substs)) .enumerate() .for_each(|field| drop_field(self, field)); } // Same as above, but for tuples. - ty::TyTuple(tys) => { + ty::Tuple(tys) => { tys.iter() .cloned() .enumerate() @@ -950,7 +950,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } // Closures also have disjoint fields, but they are only // directly accessed in the body of the closure. - ty::TyClosure(def, substs) + ty::Closure(def, substs) if *drop_place == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() => { @@ -961,7 +961,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } // Generators also have disjoint fields, but they are only // directly accessed in the body of the generator. - ty::TyGenerator(def, substs, _) + ty::Generator(def, substs, _) if *drop_place == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() => { @@ -978,7 +978,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // the base case below, we would have a Deep Write due to // the box being `needs_drop`, and that Deep Write would // touch `&mut` data in the box. - ty::TyAdt(def, _) if def.is_box() => { + ty::Adt(def, _) if def.is_box() => { // When/if we add a `&own T` type, this action would // be like running the destructor of the `&own T`. // (And the owner of backing storage referenced by the @@ -1818,7 +1818,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // be already initialized let tcx = self.tcx; match base.ty(self.mir, tcx).to_ty(tcx).sty { - ty::TyAdt(def, _) if def.has_dtor(tcx) => { + ty::Adt(def, _) if def.has_dtor(tcx) => { // FIXME: analogous code in // check_loans.rs first maps @@ -2062,7 +2062,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // Check the kind of deref to decide match base_ty.sty { - ty::TyRef(_, _, mutbl) => { + ty::Ref(_, _, mutbl) => { match mutbl { // Shared borrowed data is never mutable hir::MutImmutable => Err(place), @@ -2086,7 +2086,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } } } - ty::TyRawPtr(tnm) => { + ty::RawPtr(tnm) => { match tnm.mutbl { // `*const` raw pointers are not mutable hir::MutImmutable => return Err(place), diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index 5ef647585c38e..497e8e07853fb 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -261,10 +261,10 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { .any(|p| p.is_upvar_field_projection(self.mir, &self.tcx) .is_some()); match ty.sty { - ty::TyArray(..) | ty::TySlice(..) => self + ty::Array(..) | ty::Slice(..) => self .tcx .cannot_move_out_of_interior_noncopy(span, ty, None, origin), - ty::TyClosure(def_id, closure_substs) + ty::Closure(def_id, closure_substs) if !self.mir.upvar_decls.is_empty() && is_upvar_field_projection => { let closure_kind_ty = diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index dc37c21fdabeb..f233a17597a54 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -312,26 +312,26 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cg, 'cx, 'tcx, 'gcx> { // individual fields instead. This way if `foo` has a // destructor but `bar` does not, we will only check for // borrows of `x.foo` and not `x.bar`. See #47703. - ty::TyAdt(def, substs) if def.is_struct() && !def.has_dtor(self.infcx.tcx) => { + ty::Adt(def, substs) if def.is_struct() && !def.has_dtor(self.infcx.tcx) => { def.all_fields() .map(|field| field.ty(gcx, substs)) .enumerate() .for_each(|field| drop_field(self, field)); } // Same as above, but for tuples. - ty::TyTuple(tys) => { + ty::Tuple(tys) => { tys.iter().cloned().enumerate() .for_each(|field| drop_field(self, field)); } // Closures and generators also have disjoint fields, but they are only // directly accessed in the body of the closure/generator. - ty::TyGenerator(def, substs, ..) + ty::Generator(def, substs, ..) if *drop_place == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() => { substs.upvar_tys(def, self.infcx.tcx).enumerate() .for_each(|field| drop_field(self, field)); } - ty::TyClosure(def, substs) + ty::Closure(def, substs) if *drop_place == Place::Local(Local::new(1)) && !self.mir.upvar_decls.is_empty() => { substs.upvar_tys(def, self.infcx.tcx).enumerate() diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 532c36f427b5a..6177194ab914d 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -376,7 +376,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // & // - let's call the lifetime of this reference `'1` ( - ty::TyRef(region, referent_ty, _), + ty::Ref(region, referent_ty, _), hir::TyKind::Rptr(_lifetime, referent_hir_ty), ) => { if region.to_region_vid() == needle_fr { @@ -403,7 +403,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Match up something like `Foo<'1>` ( - ty::TyAdt(_adt_def, substs), + ty::Adt(_adt_def, substs), hir::TyKind::Path(hir::QPath::Resolved(None, path)), ) => { if let Some(last_segment) = path.segments.last() { @@ -423,16 +423,16 @@ impl<'tcx> RegionInferenceContext<'tcx> { // The following cases don't have lifetimes, so we // just worry about trying to match up the rustc type // with the HIR types: - (ty::TyTuple(elem_tys), hir::TyKind::Tup(elem_hir_tys)) => { + (ty::Tuple(elem_tys), hir::TyKind::Tup(elem_hir_tys)) => { search_stack.extend(elem_tys.iter().cloned().zip(elem_hir_tys)); } - (ty::TySlice(elem_ty), hir::TyKind::Slice(elem_hir_ty)) - | (ty::TyArray(elem_ty, _), hir::TyKind::Array(elem_hir_ty, _)) => { + (ty::Slice(elem_ty), hir::TyKind::Slice(elem_hir_ty)) + | (ty::Array(elem_ty, _), hir::TyKind::Array(elem_hir_ty, _)) => { search_stack.push((elem_ty, elem_hir_ty)); } - (ty::TyRawPtr(mut_ty), hir::TyKind::Ptr(mut_hir_ty)) => { + (ty::RawPtr(mut_ty), hir::TyKind::Ptr(mut_hir_ty)) => { search_stack.push((mut_ty.ty, &mut_hir_ty.ty)); } 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 4b8effbc2d62b..2fb5861dff444 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -320,7 +320,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { // constraints on `'a` and `'b`. These constraints // would be lost if we just look at the normalized // value. - if let ty::TyFnDef(def_id, substs) = constant.literal.ty.sty { + if let ty::FnDef(def_id, substs) = constant.literal.ty.sty { let tcx = self.tcx(); let type_checker = &mut self.cx; @@ -483,7 +483,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } ProjectionElem::Subslice { from, to } => PlaceTy::Ty { ty: match base_ty.sty { - ty::TyArray(inner, size) => { + ty::Array(inner, size) => { let size = size.unwrap_usize(tcx); let min_size = (from as u64) + (to as u64); if let Some(rest_size) = size.checked_sub(min_size) { @@ -497,12 +497,12 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { ) } } - ty::TySlice(..) => base_ty, + ty::Slice(..) => base_ty, _ => span_mirbug_and_err!(self, place, "slice of non-array {:?}", base_ty), }, }, ProjectionElem::Downcast(adt_def1, index) => match base_ty.sty { - ty::TyAdt(adt_def, substs) if adt_def.is_enum() && adt_def == adt_def1 => { + ty::Adt(adt_def, substs) if adt_def.is_enum() && adt_def == adt_def1 => { if index >= adt_def.variants.len() { PlaceTy::Ty { ty: span_mirbug_and_err!( @@ -578,8 +578,8 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { variant_index, } => (&adt_def.variants[variant_index], substs), PlaceTy::Ty { ty } => match ty.sty { - ty::TyAdt(adt_def, substs) if !adt_def.is_enum() => (&adt_def.variants[0], substs), - ty::TyClosure(def_id, substs) => { + ty::Adt(adt_def, substs) if !adt_def.is_enum() => (&adt_def.variants[0], substs), + ty::Closure(def_id, substs) => { return match substs.upvar_tys(def_id, tcx).nth(field.index()) { Some(ty) => Ok(ty), None => Err(FieldAccessError::OutOfRange { @@ -587,7 +587,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { }), } } - ty::TyGenerator(def_id, substs, _) => { + ty::Generator(def_id, substs, _) => { // Try pre-transform fields first (upvars and current state) if let Some(ty) = substs.pre_transforms_tys(def_id, tcx).nth(field.index()) { return Ok(ty); @@ -602,7 +602,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { }), }; } - ty::TyTuple(tys) => { + ty::Tuple(tys) => { return match tys.get(field.index()) { Some(&ty) => Ok(ty), None => Err(FieldAccessError::OutOfRange { @@ -917,7 +917,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } => { let place_type = place.ty(mir, tcx).to_ty(tcx); let adt = match place_type.sty { - TyKind::TyAdt(adt, _) if adt.is_enum() => adt, + TyKind::Adt(adt, _) if adt.is_enum() => adt, _ => { span_bug!( stmt.source_info.span, @@ -1032,7 +1032,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { let func_ty = func.ty(mir, tcx); debug!("check_terminator: call, func_ty={:?}", func_ty); let sig = match func_ty.sty { - ty::TyFnDef(..) | ty::TyFnPtr(_) => func_ty.fn_sig(tcx), + ty::FnDef(..) | ty::FnPtr(_) => func_ty.fn_sig(tcx), _ => { span_mirbug!(self, term, "call to non-function {:?}", func_ty); return; @@ -1472,7 +1472,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { CastKind::ClosureFnPointer => { let sig = match op.ty(mir, tcx).sty { - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { substs.closure_sig_ty(def_id, tcx).fn_sig(tcx) } _ => bug!(), @@ -1650,7 +1650,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { debug!("add_reborrow_constraint - base_ty = {:?}", base_ty); match base_ty.sty { - ty::TyRef(ref_region, _, mutbl) => { + ty::Ref(ref_region, _, mutbl) => { constraints.outlives_constraints.push(OutlivesConstraint { sup: ref_region.to_region_vid(), sub: borrow_region.to_region_vid(), @@ -1697,11 +1697,11 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } } } - ty::TyRawPtr(..) => { + ty::RawPtr(..) => { // deref of raw pointer, guaranteed to be valid break; } - ty::TyAdt(def, _) if def.is_box() => { + ty::Adt(def, _) if def.is_box() => { // deref of `Box`, need the base to be valid - propagate } _ => bug!("unexpected deref ty {:?} in {:?}", base_ty, borrowed_place), diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs index 2509ad5c906b3..deb972ee04611 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs @@ -325,7 +325,7 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { // Watch out for the case that we are matching a `?T` against the // right-hand side. - if let ty::TyInfer(ty::CanonicalTy(var)) = a.sty { + if let ty::Infer(ty::CanonicalTy(var)) = a.sty { self.equate_var(var, b.into())?; Ok(a) } else { diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index cd75cf549572b..8112b71b12752 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -64,7 +64,7 @@ pub struct UniversalRegions<'tcx> { /// The "defining" type for this function, with all universal /// regions instantiated. For a closure or generator, this is the - /// closure type, but for a top-level function it's the `TyFnDef`. + /// closure type, but for a top-level function it's the `FnDef`. pub defining_ty: DefiningTy<'tcx>, /// The return type of this function, with all regions replaced by @@ -437,11 +437,11 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { .replace_free_regions_with_nll_infer_vars(FR, &defining_ty); match defining_ty.sty { - ty::TyClosure(def_id, substs) => DefiningTy::Closure(def_id, substs), - ty::TyGenerator(def_id, substs, movability) => { + ty::Closure(def_id, substs) => DefiningTy::Closure(def_id, substs), + ty::Generator(def_id, substs, movability) => { DefiningTy::Generator(def_id, substs, movability) } - ty::TyFnDef(def_id, substs) => DefiningTy::FnDef(def_id, substs), + ty::FnDef(def_id, substs) => DefiningTy::FnDef(def_id, substs), _ => span_bug!( tcx.def_span(self.mir_def_id), "expected defining type for `{:?}`: `{:?}`", @@ -524,7 +524,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { let (&output, tuplized_inputs) = inputs_and_output.split_last().unwrap(); assert_eq!(tuplized_inputs.len(), 1, "multiple closure inputs"); let inputs = match tuplized_inputs[0].sty { - ty::TyTuple(inputs) => inputs, + ty::Tuple(inputs) => inputs, _ => bug!("closure inputs not a tuple: {:?}", tuplized_inputs[0]), }; diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index be0091068c2e2..2b4a1553e1a89 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -54,7 +54,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { // original path into a new variable and // borrowed *that* one, leaving the original // path unborrowed. - ty::TyRawPtr(..) | ty::TyRef(_, _, hir::MutImmutable) => true, + ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) => true, _ => proj.base.ignore_borrow(tcx, mir), } } diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 85abec7e7acc4..f791735690922 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -170,7 +170,7 @@ fn place_components_conflict<'gcx, 'tcx>( debug!("places_conflict: shallow access behind ptr"); return false; } - (ProjectionElem::Deref, ty::TyRef(_, _, hir::MutImmutable), _) => { + (ProjectionElem::Deref, ty::Ref(_, _, hir::MutImmutable), _) => { // the borrow goes through a dereference of a shared reference. // // I'm not sure why we are tracking these borrows - shared @@ -329,7 +329,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( } (Place::Promoted(p1), Place::Promoted(p2)) => { if p1.0 == p2.0 { - if let ty::TyArray(_, size) = p1.1.sty { + if let ty::Array(_, size) = p1.1.sty { if size.unwrap_usize(tcx) == 0 { // Ignore conflicts with promoted [T; 0]. debug!("place_element_conflict: IGNORE-LEN-0-PROMOTED"); @@ -366,7 +366,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( } else { let ty = pi1.base.ty(mir, tcx).to_ty(tcx); match ty.sty { - ty::TyAdt(def, _) if def.is_union() => { + ty::Adt(def, _) if def.is_union() => { // Different fields of a union, we are basically stuck. debug!("place_element_conflict: STUCK-UNION"); Overlap::Arbitrary diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index 9b16130d25ec4..8dcc114330621 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -155,8 +155,8 @@ impl<'cx, 'gcx, 'tcx> Iterator for Prefixes<'cx, 'gcx, 'tcx> { let ty = proj.base.ty(self.mir, self.tcx).to_ty(self.tcx); match ty.sty { - ty::TyRawPtr(_) | - ty::TyRef( + ty::RawPtr(_) | + ty::Ref( _, /*rgn*/ _, /*ty*/ hir::MutImmutable @@ -166,7 +166,7 @@ impl<'cx, 'gcx, 'tcx> Iterator for Prefixes<'cx, 'gcx, 'tcx> { return Some(cursor); } - ty::TyRef( + ty::Ref( _, /*rgn*/ _, /*ty*/ hir::MutMutable, @@ -175,7 +175,7 @@ impl<'cx, 'gcx, 'tcx> Iterator for Prefixes<'cx, 'gcx, 'tcx> { return Some(cursor); } - ty::TyAdt(..) if ty.is_box() => { + ty::Adt(..) if ty.is_box() => { self.next = Some(&proj.base); return Some(cursor); } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 59a7f49af8074..2b05e2c023a5c 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -216,7 +216,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // FIXME(canndrew): This is_never should probably be an is_uninhabited let diverges = expr.ty.is_never(); let intrinsic = match ty.sty { - ty::TyFnDef(def_id, _) => { + ty::FnDef(def_id, _) => { let f = ty.fn_sig(this.hir.tcx()); if f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic { diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 7106e02284da3..e41698f1f0d80 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -272,8 +272,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // array, so we can call `<[u8]>::eq` rather than having to find an // `<[u8; N]>::eq`. let unsize = |ty: Ty<'tcx>| match ty.sty { - ty::TyRef(region, rty, _) => match rty.sty { - ty::TyArray(inner_ty, n) => Some((region, inner_ty, n)), + ty::Ref(region, rty, _) => match rty.sty { + ty::Array(inner_ty, n) => Some((region, inner_ty, n)), _ => None, }, _ => None, diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index c0c431804d8c1..179bc2426ab4a 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -67,13 +67,13 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t let ty = tcx.type_of(tcx.hir.local_def_id(id)); let mut abi = fn_sig.abi; let implicit_argument = match ty.sty { - ty::TyClosure(..) => { + ty::Closure(..) => { // HACK(eddyb) Avoid having RustCall on closures, // as it adds unnecessary (and wrong) auto-tupling. abi = Abi::Rust; Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)) } - ty::TyGenerator(..) => { + ty::Generator(..) => { let gen_ty = tcx.body_tables(body_id).node_id_to_type(fn_hir_id); Some(ArgInfo(gen_ty, None, None, None)) } @@ -115,7 +115,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t let (yield_ty, return_ty) = if body.is_generator { let gen_sig = match ty.sty { - ty::TyGenerator(gen_def_id, gen_substs, ..) => + ty::Generator(gen_def_id, gen_substs, ..) => gen_substs.sig(gen_def_id, tcx), _ => span_bug!(tcx.hir.span(id), "generator w/o generator type: {:?}", ty), @@ -241,7 +241,7 @@ fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, let closure_ty = tcx.body_tables(body_id).node_id_to_type(closure_expr_hir_id); let (closure_def_id, closure_substs) = match closure_ty.sty { - ty::TyClosure(closure_def_id, closure_substs) => (closure_def_id, closure_substs), + ty::Closure(closure_def_id, closure_substs) => (closure_def_id, closure_substs), _ => bug!("closure expr does not have closure type: {:?}", closure_ty) }; diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index 1cbe0dcc017f9..7af1daae4cad5 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -61,17 +61,17 @@ fn place_contents_drop_state_cannot_differ<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(mir, tcx).to_ty(tcx); match ty.sty { - ty::TyArray(..) => { + ty::Array(..) => { debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} => false", place, ty); false } - ty::TySlice(..) | ty::TyRef(..) | ty::TyRawPtr(..) => { + ty::Slice(..) | ty::Ref(..) | ty::RawPtr(..) => { debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} refd => true", place, ty); true } - ty::TyAdt(def, _) if (def.has_dtor(tcx) && !def.is_box()) || def.is_union() => { + ty::Adt(def, _) if (def.has_dtor(tcx) && !def.is_box()) || def.is_union() => { debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} Drop => true", place, ty); true diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 60030f2702055..2148363c79712 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -134,19 +134,19 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { let tcx = self.builder.tcx; let place_ty = proj.base.ty(mir, tcx).to_ty(tcx); match place_ty.sty { - ty::TyRef(..) | ty::TyRawPtr(..) => + ty::Ref(..) | ty::RawPtr(..) => return Err(MoveError::cannot_move_out_of( self.loc, BorrowedContent { target_place: place.clone() })), - ty::TyAdt(adt, _) if adt.has_dtor(tcx) && !adt.is_box() => + ty::Adt(adt, _) if adt.has_dtor(tcx) && !adt.is_box() => return Err(MoveError::cannot_move_out_of(self.loc, InteriorOfTypeWithDestructor { container_ty: place_ty })), // move out of union - always move the entire union - ty::TyAdt(adt, _) if adt.is_union() => + ty::Adt(adt, _) if adt.is_union() => return Err(MoveError::UnionMove { path: base }), - ty::TySlice(_) => + ty::Slice(_) => return Err(MoveError::cannot_move_out_of( self.loc, InteriorOfSliceOrArray { @@ -155,7 +155,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { _ => false }, })), - ty::TyArray(..) => match proj.elem { + ty::Array(..) => match proj.elem { ProjectionElem::Index(..) => return Err(MoveError::cannot_move_out_of( self.loc, diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index b60da286d9555..04a3b5c115f22 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -284,7 +284,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::AddrOf(mutbl, ref expr) => { let region = match expr_ty.sty { - ty::TyRef(r, _, _) => r, + ty::Ref(r, _, _) => r, _ => span_bug!(expr.span, "type of & not region"), }; ExprKind::Borrow { @@ -418,7 +418,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::Struct(ref qpath, ref fields, ref base) => { match expr_ty.sty { - ty::TyAdt(adt, substs) => { + ty::Adt(adt, substs) => { match adt.adt_kind() { AdtKind::Struct | AdtKind::Union => { ExprKind::Adt { @@ -472,8 +472,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::Closure(..) => { let closure_ty = cx.tables().expr_ty(expr); let (def_id, substs, movability) = match closure_ty.sty { - ty::TyClosure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs), None), - ty::TyGenerator(def_id, substs, movability) => { + ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs), None), + ty::Generator(def_id, substs, movability) => { (def_id, UpvarSubsts::Generator(substs), Some(movability)) } _ => { @@ -775,7 +775,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match cx.tables().node_id_to_type(expr.hir_id).sty { // A unit struct/variant which is used as a value. // We return a completely different ExprKind here to account for this special case. - ty::TyAdt(adt_def, substs) => { + ty::Adt(adt_def, substs) => { ExprKind::Adt { adt_def, variant_index: adt_def.variant_index_with_id(def_id), @@ -827,7 +827,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }); let region = cx.tcx.mk_region(region); - let self_expr = if let ty::TyClosure(_, closure_substs) = closure_ty.sty { + let self_expr = if let ty::Closure(_, closure_substs) = closure_ty.sty { match cx.infcx.closure_kind(closure_def_id, closure_substs).unwrap() { ty::ClosureKind::Fn => { let ref_closure_ty = cx.tcx.mk_ref(region, @@ -977,7 +977,7 @@ fn overloaded_place<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // same region and mutability as the receiver. This holds for // `Deref(Mut)::Deref(_mut)` and `Index(Mut)::index(_mut)`. let (region, mutbl) = match recv_ty.sty { - ty::TyRef(region, _, mutbl) => (region, mutbl), + ty::Ref(region, _, mutbl) => (region, mutbl), _ => span_bug!(expr.span, "overloaded_place: receiver is not a reference"), }; let ref_ty = cx.tcx.mk_ref(region, ty::TypeAndMut { diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 81f7d439feb25..750ef71c974c5 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -206,7 +206,7 @@ struct LiteralExpander; impl<'tcx> PatternFolder<'tcx> for LiteralExpander { fn fold_pattern(&mut self, pat: &Pattern<'tcx>) -> Pattern<'tcx> { match (&pat.ty.sty, &*pat.kind) { - (&ty::TyRef(_, rty, _), &PatternKind::Constant { ref value }) => { + (&ty::Ref(_, rty, _), &PatternKind::Constant { ref value }) => { Pattern { ty: pat.ty, span: pat.span, @@ -381,14 +381,14 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { fn is_non_exhaustive_enum(&self, ty: Ty<'tcx>) -> bool { match ty.sty { - ty::TyAdt(adt_def, ..) => adt_def.is_enum() && adt_def.is_non_exhaustive(), + ty::Adt(adt_def, ..) => adt_def.is_enum() && adt_def.is_non_exhaustive(), _ => false, } } fn is_local(&self, ty: Ty<'tcx>) -> bool { match ty.sty { - ty::TyAdt(adt_def, ..) => adt_def.did.is_local(), + ty::Adt(adt_def, ..) => adt_def.did.is_local(), _ => false, } } @@ -548,8 +548,8 @@ impl<'tcx> Witness<'tcx> { let mut pats = self.0.drain((len - arity) as usize..).rev(); match ty.sty { - ty::TyAdt(..) | - ty::TyTuple(..) => { + ty::Adt(..) | + ty::Tuple(..) => { let pats = pats.enumerate().map(|(i, p)| { FieldPattern { field: Field::new(i), @@ -557,7 +557,7 @@ impl<'tcx> Witness<'tcx> { } }).collect(); - if let ty::TyAdt(adt, substs) = ty.sty { + if let ty::Adt(adt, substs) = ty.sty { if adt.is_enum() { PatternKind::Variant { adt_def: adt, @@ -573,11 +573,11 @@ impl<'tcx> Witness<'tcx> { } } - ty::TyRef(..) => { + ty::Ref(..) => { PatternKind::Deref { subpattern: pats.nth(0).unwrap() } } - ty::TySlice(_) | ty::TyArray(..) => { + ty::Slice(_) | ty::Array(..) => { PatternKind::Slice { prefix: pats.collect(), slice: None, @@ -624,7 +624,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, ConstantValue(ty::Const::from_bool(cx.tcx, b)) }).collect() } - ty::TyArray(ref sub_ty, len) if len.assert_usize(cx.tcx).is_some() => { + ty::Array(ref sub_ty, len) if len.assert_usize(cx.tcx).is_some() => { let len = len.unwrap_usize(cx.tcx); if len != 0 && cx.is_uninhabited(sub_ty) { vec![] @@ -633,15 +633,15 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } // Treat arrays of a constant but unknown length like slices. - ty::TyArray(ref sub_ty, _) | - ty::TySlice(ref sub_ty) => { + ty::Array(ref sub_ty, _) | + ty::Slice(ref sub_ty) => { if cx.is_uninhabited(sub_ty) { vec![Slice(0)] } else { (0..pcx.max_slice_length+1).map(|length| Slice(length)).collect() } } - ty::TyAdt(def, substs) if def.is_enum() => { + ty::Adt(def, substs) if def.is_enum() => { def.variants.iter() .filter(|v| !cx.is_variant_uninhabited(v, substs)) .map(|v| Variant(v.did)) @@ -1243,7 +1243,7 @@ fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt, PatternKind::Constant { value } => Some(vec![ConstantValue(value)]), PatternKind::Range { lo, hi, end } => Some(vec![ConstantRange(lo, hi, end)]), PatternKind::Array { .. } => match pcx.ty.sty { - ty::TyArray(_, length) => Some(vec![ + ty::Array(_, length) => Some(vec![ Slice(length.unwrap_usize(cx.tcx)) ]), _ => span_bug!(pat.span, "bad ty {:?} for array pattern", pcx.ty) @@ -1267,14 +1267,14 @@ fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt, fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> u64 { debug!("constructor_arity({:#?}, {:?})", ctor, ty); match ty.sty { - ty::TyTuple(ref fs) => fs.len() as u64, - ty::TySlice(..) | ty::TyArray(..) => match *ctor { + ty::Tuple(ref fs) => fs.len() as u64, + ty::Slice(..) | ty::Array(..) => match *ctor { Slice(length) => length, ConstantValue(_) => 0, _ => bug!("bad slice pattern {:?} {:?}", ctor, ty) }, - ty::TyRef(..) => 1, - ty::TyAdt(adt, _) => { + ty::Ref(..) => 1, + ty::Adt(adt, _) => { adt.variants[ctor.variant_index_for_adt(adt)].fields.len() as u64 } _ => 0 @@ -1291,14 +1291,14 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, { debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty); match ty.sty { - ty::TyTuple(ref fs) => fs.into_iter().map(|t| *t).collect(), - ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor { + ty::Tuple(ref fs) => fs.into_iter().map(|t| *t).collect(), + ty::Slice(ty) | ty::Array(ty, _) => match *ctor { Slice(length) => (0..length).map(|_| ty).collect(), ConstantValue(_) => vec![], _ => bug!("bad slice pattern {:?} {:?}", ctor, ty) }, - ty::TyRef(_, rty, _) => vec![rty], - ty::TyAdt(adt, substs) => { + ty::Ref(_, rty, _) => vec![rty], + ty::Adt(adt, substs) => { if adt.is_box() { // Use T as the sub pattern type of Box. vec![substs.type_at(0)] diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 7f6298fd17173..604cc61a17ecb 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -258,8 +258,8 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { fn conservative_is_uninhabited(&self, scrutinee_ty: Ty<'tcx>) -> bool { // "rustc-1.0-style" uncontentious uninhabitableness check match scrutinee_ty.sty { - ty::TyNever => true, - ty::TyAdt(def, _) => def.variants.is_empty(), + ty::Never => true, + ty::Adt(def, _) => def.variants.is_empty(), _ => false } } @@ -315,7 +315,7 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchVisitor, pat: &Pat) { return true; } let pat_ty = cx.tables.pat_ty(p); - if let ty::TyAdt(edef, _) = pat_ty.sty { + if let ty::Adt(edef, _) = pat_ty.sty { if edef.is_enum() && edef.variants.iter().any(|variant| { variant.name == ident.name && variant.ctor_kind == CtorKind::Const }) { diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 16d6a08981abc..ac506989ecfb0 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -148,7 +148,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { PatternKind::Variant { adt_def, variant_index, .. } => { Some(&adt_def.variants[variant_index]) } - _ => if let ty::TyAdt(adt, _) = self.ty.sty { + _ => if let ty::Adt(adt, _) = self.ty.sty { if !adt.is_enum() { Some(&adt.variants[0]) } else { @@ -165,7 +165,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { if let Some(variant) = variant { write!(f, "{}", variant.name)?; - // Only for TyAdt we can have `S {...}`, + // Only for Adt we can have `S {...}`, // which we handle separately here. if variant.ctor_kind == CtorKind::Fictive { write!(f, " {{ ")?; @@ -216,8 +216,8 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { } PatternKind::Deref { ref subpattern } => { match self.ty.sty { - ty::TyAdt(def, _) if def.is_box() => write!(f, "box ")?, - ty::TyRef(_, _, mutbl) => { + ty::Adt(def, _) if def.is_box() => write!(f, "box ")?, + ty::Ref(_, _, mutbl) => { write!(f, "&")?; if mutbl == hir::MutMutable { write!(f, "mut ")?; @@ -413,7 +413,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatKind::Slice(ref prefix, ref slice, ref suffix) => { match ty.sty { - ty::TyRef(_, ty, _) => + ty::Ref(_, ty, _) => PatternKind::Deref { subpattern: Pattern { ty, @@ -422,10 +422,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { pat.span, ty, prefix, slice, suffix)) }, }, - ty::TySlice(..) | - ty::TyArray(..) => + ty::Slice(..) | + ty::Array(..) => self.slice_or_array_pattern(pat.span, ty, prefix, slice, suffix), - ty::TyError => { // Avoid ICE + ty::Error => { // Avoid ICE return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } ref sty => @@ -438,7 +438,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatKind::Tuple(ref subpatterns, ddpos) => { match ty.sty { - ty::TyTuple(ref tys) => { + ty::Tuple(ref tys) => { let subpatterns = subpatterns.iter() .enumerate_and_adjust(tys.len(), ddpos) @@ -450,7 +450,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Leaf { subpatterns: subpatterns } } - ty::TyError => { // Avoid ICE (#50577) + ty::Error => { // Avoid ICE (#50577) return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } ref sty => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", sty), @@ -460,8 +460,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatKind::Binding(_, id, ident, ref sub) => { let var_ty = self.tables.node_id_to_type(pat.hir_id); let region = match var_ty.sty { - ty::TyRef(r, _, _) => Some(r), - ty::TyError => { // Avoid ICE + ty::Ref(r, _, _) => Some(r), + ty::Error => { // Avoid ICE return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } _ => None, @@ -484,7 +484,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { // A ref x pattern is the same node used for x, and as such it has // x's type, which is &T, where we want T (the type being matched). if let ty::BindByReference(_) = bm { - if let ty::TyRef(_, rty, _) = ty.sty { + if let ty::Ref(_, rty, _) = ty.sty { ty = rty; } else { bug!("`ref {}` has wrong type {}", ident, ty); @@ -504,8 +504,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatKind::TupleStruct(ref qpath, ref subpatterns, ddpos) => { let def = self.tables.qpath_def(qpath, pat.hir_id); let adt_def = match ty.sty { - ty::TyAdt(adt_def, _) => adt_def, - ty::TyError => { // Avoid ICE (#50585) + ty::Adt(adt_def, _) => adt_def, + ty::Error => { // Avoid ICE (#50585) return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } _ => span_bug!(pat.span, @@ -608,12 +608,12 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { self.flatten_nested_slice_patterns(prefix, slice, suffix); match ty.sty { - ty::TySlice(..) => { + ty::Slice(..) => { // matching a slice or fixed-length array PatternKind::Slice { prefix: prefix, slice: slice, suffix: suffix } } - ty::TyArray(_, len) => { + ty::Array(_, len) => { // fixed-length array let len = len.unwrap_usize(self.tcx); assert!(len >= prefix.len() as u64 + suffix.len() as u64); @@ -640,9 +640,9 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { let adt_def = self.tcx.adt_def(enum_id); if adt_def.is_enum() { let substs = match ty.sty { - ty::TyAdt(_, substs) | - ty::TyFnDef(_, substs) => substs, - ty::TyError => { // Avoid ICE (#50585) + ty::Adt(_, substs) | + ty::FnDef(_, substs) => substs, + ty::Error => { // Avoid ICE (#50585) return PatternKind::Wild; } _ => bug!("inappropriate type for def: {:?}", ty.sty), @@ -823,12 +823,12 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { value: cv, } }, - ty::TyAdt(adt_def, _) if adt_def.is_union() => { + ty::Adt(adt_def, _) if adt_def.is_union() => { // Matching on union fields is unsafe, we can't hide it in constants self.tcx.sess.span_err(span, "cannot use unions in constant patterns"); PatternKind::Wild } - ty::TyAdt(adt_def, _) if !self.tcx.has_attr(adt_def.did, "structural_match") => { + ty::Adt(adt_def, _) if !self.tcx.has_attr(adt_def.did, "structural_match") => { let msg = format!("to use a constant of type `{}` in a pattern, \ `{}` must be annotated with `#[derive(PartialEq, Eq)]`", self.tcx.item_path_str(adt_def.did), @@ -836,7 +836,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { self.tcx.sess.span_err(span, &msg); PatternKind::Wild }, - ty::TyAdt(adt_def, substs) if adt_def.is_enum() => { + ty::Adt(adt_def, substs) if adt_def.is_enum() => { let variant_index = const_variant_index( self.tcx, self.param_env, instance, cv ).expect("const_variant_index failed"); @@ -851,18 +851,18 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { subpatterns, } }, - ty::TyAdt(adt_def, _) => { + ty::Adt(adt_def, _) => { let struct_var = adt_def.non_enum_variant(); PatternKind::Leaf { subpatterns: adt_subpatterns(struct_var.fields.len(), None), } } - ty::TyTuple(fields) => { + ty::Tuple(fields) => { PatternKind::Leaf { subpatterns: adt_subpatterns(fields.len(), None), } } - ty::TyArray(_, n) => { + ty::Array(_, n) => { PatternKind::Array { prefix: (0..n.unwrap_usize(self.tcx)) .map(|i| adt_subpattern(i as usize, None)) @@ -1094,7 +1094,7 @@ pub fn compare_const_vals<'a, 'tcx>( } } - if let ty::TyRef(_, rty, _) = ty.value.sty { + if let ty::Ref(_, rty, _) = ty.value.sty { if let ty::TyStr = rty.sty { match (a.val, b.val) { ( @@ -1174,7 +1174,7 @@ fn lit_to_const<'a, 'tcx>(lit: &'tcx ast::LitKind, ty::TyInt(other) => Int::Signed(other), ty::TyUint(UintTy::Usize) => Int::Unsigned(tcx.sess.target.usize_ty), ty::TyUint(other) => Int::Unsigned(other), - ty::TyError => { // Avoid ICE (#51963) + ty::Error => { // Avoid ICE (#51963) return Err(LitToConstError::Propagated); } _ => bug!("literal integer type with bad type ({:?})", ty.sty), diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 577d55f05d1f7..1f6a1e76f001d 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -80,7 +80,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { ReifyFnPointer => { // The src operand does not matter, just its type match src_layout.ty.sty { - ty::TyFnDef(def_id, substs) => { + ty::FnDef(def_id, substs) => { if self.tcx.has_attr(def_id, "rustc_args_required_const") { bug!("reifying a fn ptr that requires \ const arguments"); @@ -101,7 +101,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { UnsafeFnPointer => { let src = self.read_value(src)?; match dest.layout.ty.sty { - ty::TyFnPtr(_) => { + ty::FnPtr(_) => { // No change to value self.write_value(*src, dest)?; } @@ -112,7 +112,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { ClosureFnPointer => { // The src operand does not matter, just its type match src_layout.ty.sty { - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let substs = self.tcx.subst_and_normalize_erasing_regions( self.substs(), ty::ParamEnv::reveal_all(), @@ -217,7 +217,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { }, // No alignment check needed for raw pointers. But we have to truncate to target ptr size. - TyRawPtr(_) => { + RawPtr(_) => { Ok(Scalar::Bits { bits: self.memory.truncate_to_ptr(v).0 as u128, size: self.memory.pointer_size().bytes() as u8, @@ -293,7 +293,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { use rustc::ty::TyKind::*; match ty.sty { // Casting to a reference or fn pointer is not permitted by rustc, no need to support it here. - TyRawPtr(_) | + RawPtr(_) | TyInt(IntTy::Isize) | TyUint(UintTy::Usize) => Ok(ptr.into()), TyInt(_) | TyUint(_) => err!(ReadPointerAsBytes), diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 33420b6150bb7..9a6f1199421d6 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -457,7 +457,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M let layout = mplace.layout; assert!(layout.is_unsized()); match layout.ty.sty { - ty::TyAdt(..) | ty::TyTuple(..) => { + ty::Adt(..) | ty::Tuple(..) => { // First get the size of all statically known fields. // Don't use type_of::sizing_type_of because that expects t to be sized, // and it also rounds up to alignment, which we want to avoid, @@ -506,7 +506,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M Ok((size.abi_align(align), align)) } - ty::TyDynamic(..) => { + ty::Dynamic(..) => { let vtable = match mplace.extra { PlaceExtra::Vtable(vtable) => vtable, _ => bug!("Expected vtable"), @@ -515,7 +515,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M self.read_size_and_align_from_vtable(vtable) } - ty::TySlice(_) | ty::TyStr => { + ty::Slice(_) | ty::Str => { let len = match mplace.extra { PlaceExtra::Length(len) => len, _ => bug!("Expected length"), diff --git a/src/librustc_mir/interpret/terminator/drop.rs b/src/librustc_mir/interpret/terminator/drop.rs index e044df2d1c0f9..0bddd7147b998 100644 --- a/src/librustc_mir/interpret/terminator/drop.rs +++ b/src/librustc_mir/interpret/terminator/drop.rs @@ -20,7 +20,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { let place = self.force_allocation(place)?; let (instance, place) = match place.layout.ty.sty { - ty::TyDynamic(..) => { + ty::Dynamic(..) => { // Dropping a trait object. let vtable = match place.extra { PlaceExtra::Vtable(vtable) => vtable, diff --git a/src/librustc_mir/interpret/terminator/mod.rs b/src/librustc_mir/interpret/terminator/mod.rs index 82455cacac2d4..913b88fc8eb48 100644 --- a/src/librustc_mir/interpret/terminator/mod.rs +++ b/src/librustc_mir/interpret/terminator/mod.rs @@ -72,12 +72,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { let func = self.eval_operand(func, None)?; let (fn_def, sig) = match func.layout.ty.sty { - ty::TyFnPtr(sig) => { + ty::FnPtr(sig) => { let fn_ptr = self.read_scalar(func)?.to_ptr()?; let instance = self.memory.get_fn(fn_ptr)?; let instance_ty = instance.ty(*self.tcx); match instance_ty.sty { - ty::TyFnDef(..) => { + ty::FnDef(..) => { let real_sig = instance_ty.fn_sig(*self.tcx); let sig = self.tcx.normalize_erasing_late_bound_regions( ty::ParamEnv::reveal_all(), @@ -95,7 +95,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { } (instance, sig) } - ty::TyFnDef(def_id, substs) => ( + ty::FnDef(def_id, substs) => ( self.resolve(def_id, substs)?, func.layout.ty.fn_sig(*self.tcx), ), @@ -198,8 +198,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { // Permit changing the pointer type of raw pointers and references as well as // mutability of raw pointers. // TODO: Should not be allowed when fat pointers are involved. - (&ty::TyRawPtr(_), &ty::TyRawPtr(_)) => true, - (&ty::TyRef(_, _, _), &ty::TyRef(_, _, _)) => { + (&ty::RawPtr(_), &ty::RawPtr(_)) => true, + (&ty::Ref(_, _, _), &ty::Ref(_, _, _)) => { ty.is_mutable_pointer() == real_ty.is_mutable_pointer() } // rule out everything else @@ -233,7 +233,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { // Second argument must be a tuple matching the argument list of sig let snd_ty = real_sig.inputs_and_output[1]; match snd_ty.sty { - ty::TyTuple(tys) if sig.inputs().len() == tys.len() => + ty::Tuple(tys) if sig.inputs().len() == tys.len() => if sig.inputs().iter().zip(tys).all(|(ty, real_ty)| check_ty_compat(ty, real_ty)) { return Ok(true) }, @@ -339,7 +339,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { // unpack and write all other args let layout = args[1].layout; - if let ty::TyTuple(_) = layout.ty.sty { + if let ty::Tuple(_) = layout.ty.sty { if layout.is_zst() { // Nothing to do, no need to unpack zsts return Ok(()); diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 230d6f0472edd..8cf2868d12a3f 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -571,7 +571,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { &source_ty, ); match source_ty.sty { - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let instance = monomorphize::resolve_closure( self.tcx, def_id, substs, ty::ClosureKind::FnOnce); if should_monomorphize_locally(self.tcx, &instance) { @@ -680,7 +680,7 @@ fn visit_fn_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, is_direct_call: bool, output: &mut Vec>) { - if let ty::TyFnDef(def_id, substs) = ty.sty { + if let ty::FnDef(def_id, substs) = ty.sty { let instance = ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, @@ -839,7 +839,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let tail = tcx.struct_tail(ty); match tail.sty { ty::TyForeign(..) => false, - ty::TyStr | ty::TySlice(..) | ty::TyDynamic(..) => true, + ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true, _ => bug!("unexpected unsized tail: {:?}", tail.sty), } }; @@ -851,20 +851,20 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; match (&source_ty.sty, &target_ty.sty) { - (&ty::TyRef(_, a, _), - &ty::TyRef(_, b, _)) | - (&ty::TyRef(_, a, _), - &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) | - (&ty::TyRawPtr(ty::TypeAndMut { ty: a, .. }), - &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) => { + (&ty::Ref(_, a, _), + &ty::Ref(_, b, _)) | + (&ty::Ref(_, a, _), + &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) | + (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), + &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => { ptr_vtable(a, b) } - (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => { + (&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => { ptr_vtable(source_ty.boxed_ty(), target_ty.boxed_ty()) } - (&ty::TyAdt(source_adt_def, source_substs), - &ty::TyAdt(target_adt_def, target_substs)) => { + (&ty::Adt(source_adt_def, source_substs), + &ty::Adt(target_adt_def, target_substs)) => { assert_eq!(source_adt_def, target_adt_def); let kind = @@ -906,7 +906,7 @@ fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, assert!(!trait_ty.needs_subst() && !trait_ty.has_escaping_regions() && !impl_ty.needs_subst() && !impl_ty.has_escaping_regions()); - if let ty::TyDynamic(ref trait_ty, ..) = trait_ty.sty { + if let ty::Dynamic(ref trait_ty, ..) = trait_ty.sty { if let Some(principal) = trait_ty.principal() { let poly_trait_ref = principal.with_self_ty(tcx, impl_ty); assert!(!poly_trait_ref.has_escaping_regions()); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index f73c9d43699fc..da19f03304bca 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -260,7 +260,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::TyBool => output.push_str("bool"), ty::TyChar => output.push_str("char"), ty::TyStr => output.push_str("str"), - ty::TyNever => output.push_str("!"), + ty::Never => output.push_str("!"), ty::TyInt(ast::IntTy::Isize) => output.push_str("isize"), ty::TyInt(ast::IntTy::I8) => output.push_str("i8"), ty::TyInt(ast::IntTy::I16) => output.push_str("i16"), @@ -275,11 +275,11 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::TyUint(ast::UintTy::U128) => output.push_str("u128"), ty::TyFloat(ast::FloatTy::F32) => output.push_str("f32"), ty::TyFloat(ast::FloatTy::F64) => output.push_str("f64"), - ty::TyAdt(adt_def, substs) => { + ty::Adt(adt_def, substs) => { self.push_def_path(adt_def.did, output); self.push_type_params(substs, iter::empty(), output); }, - ty::TyTuple(component_types) => { + ty::Tuple(component_types) => { output.push('('); for &component_type in component_types { self.push_type_name(component_type, output); @@ -291,7 +291,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } output.push(')'); }, - ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => { + ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => { output.push('*'); match mutbl { hir::MutImmutable => output.push_str("const "), @@ -300,7 +300,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_type_name(inner_type, output); }, - ty::TyRef(_, inner_type, mutbl) => { + ty::Ref(_, inner_type, mutbl) => { output.push('&'); if mutbl == hir::MutMutable { output.push_str("mut "); @@ -308,18 +308,18 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_type_name(inner_type, output); }, - ty::TyArray(inner_type, len) => { + ty::Array(inner_type, len) => { output.push('['); self.push_type_name(inner_type, output); write!(output, "; {}", len.unwrap_usize(self.tcx)).unwrap(); output.push(']'); }, - ty::TySlice(inner_type) => { + ty::Slice(inner_type) => { output.push('['); self.push_type_name(inner_type, output); output.push(']'); }, - ty::TyDynamic(ref trait_data, ..) => { + ty::Dynamic(ref trait_data, ..) => { if let Some(principal) = trait_data.principal() { self.push_def_path(principal.def_id(), output); self.push_type_params(principal.skip_binder().substs, @@ -328,8 +328,8 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } }, ty::TyForeign(did) => self.push_def_path(did, output), - ty::TyFnDef(..) | - ty::TyFnPtr(_) => { + ty::FnDef(..) | + ty::FnPtr(_) => { let sig = t.fn_sig(self.tcx); if sig.unsafety() == hir::Unsafety::Unsafe { output.push_str("unsafe "); @@ -373,19 +373,19 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_type_name(sig.output(), output); } }, - ty::TyGenerator(def_id, GeneratorSubsts { ref substs }, _) | - ty::TyClosure(def_id, ClosureSubsts { ref substs }) => { + ty::Generator(def_id, GeneratorSubsts { ref substs }, _) | + ty::Closure(def_id, ClosureSubsts { ref substs }) => { self.push_def_path(def_id, output); let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id)); let substs = substs.truncate_to(self.tcx, generics); self.push_type_params(substs, iter::empty(), output); } - ty::TyError | - ty::TyInfer(_) | - ty::TyProjection(..) | + ty::Error | + ty::Infer(_) | + ty::Projection(..) | ty::TyParam(_) | - ty::TyGeneratorWitness(_) | - ty::TyAnon(..) => { + ty::GeneratorWitness(_) | + ty::Anon(..) => { bug!("DefPathBasedNames: Trying to create type name for \ unexpected type: {:?}", t); } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 7bfbda8b786e3..765a47e729e68 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -165,7 +165,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("build_drop_shim(def_id={:?}, ty={:?})", def_id, ty); // Check if this is a generator, if so, return the drop glue for it - if let Some(&ty::TyS { sty: ty::TyGenerator(gen_def_id, substs, _), .. }) = ty { + if let Some(&ty::TyS { sty: ty::Generator(gen_def_id, substs, _), .. }) = ty { let mir = &**tcx.optimized_mir(gen_def_id).generator_drop.as_ref().unwrap(); return mir.subst(tcx, substs.substs); } @@ -301,17 +301,17 @@ fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, match self_ty.sty { _ if is_copy => builder.copy_shim(), - ty::TyArray(ty, len) => { + ty::Array(ty, len) => { let len = len.unwrap_usize(tcx); builder.array_shim(dest, src, ty, len) } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { builder.tuple_like_shim( dest, src, substs.upvar_tys(def_id, tcx) ) } - ty::TyTuple(tys) => builder.tuple_like_shim(dest, src, tys.iter().cloned()), + ty::Tuple(tys) => builder.tuple_like_shim(dest, src, tys.iter().cloned()), _ => { bug!("clone shim for `{:?}` which is not `Copy` and is not an aggregate", self_ty) } @@ -821,7 +821,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, let sig = gcx.normalize_erasing_regions(param_env, sig); let (adt_def, substs) = match sig.output().sty { - ty::TyAdt(adt_def, substs) => (adt_def, substs), + ty::Adt(adt_def, substs) => (adt_def, substs), _ => bug!("unexpected type for ADT ctor {:?}", sig.output()) }; diff --git a/src/librustc_mir/transform/add_validation.rs b/src/librustc_mir/transform/add_validation.rs index 4f7f45f173f73..9061b34ae4445 100644 --- a/src/librustc_mir/transform/add_validation.rs +++ b/src/librustc_mir/transform/add_validation.rs @@ -45,7 +45,7 @@ fn place_context<'a, 'tcx, D>( // A Deref projection may restrict the context, this depends on the type // being deref'd. let context = match ty.sty { - ty::TyRef(re, _, mutbl) => { + ty::Ref(re, _, mutbl) => { let re = match re { &RegionKind::ReScope(ce) => Some(ce), &RegionKind::ReErased => @@ -54,12 +54,12 @@ fn place_context<'a, 'tcx, D>( }; (re, mutbl) } - ty::TyRawPtr(_) => + ty::RawPtr(_) => // There is no guarantee behind even a mutable raw pointer, // no write locks are acquired there, so we also don't want to // release any. (None, hir::MutImmutable), - ty::TyAdt(adt, _) if adt.is_box() => (None, hir::MutMutable), + ty::Adt(adt, _) if adt.is_box() => (None, hir::MutMutable), _ => bug!("Deref on a non-pointer type {:?}", ty), }; // "Intersect" this restriction with proj.base. diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 80e484d595714..5d284981c70af 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -179,13 +179,13 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } let base_ty = base.ty(self.mir, self.tcx).to_ty(self.tcx); match base_ty.sty { - ty::TyRawPtr(..) => { + ty::RawPtr(..) => { self.require_unsafe("dereference of raw pointer", "raw pointers may be NULL, dangling or unaligned; they can violate \ aliasing rules and cause data races: all of these are undefined \ behavior") } - ty::TyAdt(adt, _) => { + ty::Adt(adt, _) => { if adt.is_union() { if context == PlaceContext::Store || context == PlaceContext::AsmOutput || diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index a3647edd155d3..4a9b6b7f6e833 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -493,7 +493,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // MIR types let allowed_upvars = tcx.erase_regions(&upvars); let allowed = match interior.sty { - ty::TyGeneratorWitness(s) => tcx.erase_late_bound_regions(&s), + ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(&s), _ => bug!(), }; @@ -863,7 +863,7 @@ impl MirPass for StateTransform { // Get the interior types and substs which typeck computed let (upvars, interior, movable) = match gen_ty.sty { - ty::TyGenerator(_, substs, movability) => { + ty::Generator(_, substs, movability) => { (substs.upvar_tys(def_id, tcx).collect(), substs.witness(def_id, tcx), movability == hir::GeneratorMovability::Movable) diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 5062775fec168..31e437ce2281a 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -95,7 +95,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let terminator = bb_data.terminator(); if let TerminatorKind::Call { func: Operand::Constant(ref f), .. } = terminator.kind { - if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty { + if let ty::FnDef(callee_def_id, substs) = f.ty.sty { if let Some(instance) = Instance::resolve(self.tcx, param_env, callee_def_id, @@ -158,7 +158,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let terminator = bb_data.terminator(); if let TerminatorKind::Call { func: Operand::Constant(ref f), .. } = terminator.kind { - if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty { + if let ty::FnDef(callee_def_id, substs) = f.ty.sty { // Don't inline the same function multiple times. if callsite.callee != callee_def_id { callsites.push_back(CallSite { @@ -314,7 +314,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } TerminatorKind::Call {func: Operand::Constant(ref f), .. } => { - if let ty::TyFnDef(def_id, _) = f.ty.sty { + if let ty::FnDef(def_id, _) = f.ty.sty { // Don't give intrinsics the extra penalty for calls let f = tcx.fn_sig(def_id); if f.abi() == Abi::RustIntrinsic || f.abi() == Abi::PlatformIntrinsic { @@ -538,7 +538,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { assert!(args.next().is_none()); let tuple = Place::Local(tuple); - let tuple_tys = if let ty::TyTuple(s) = tuple.ty(caller_mir, tcx).to_ty(tcx).sty { + let tuple_tys = if let ty::Tuple(s) = tuple.ty(caller_mir, tcx).to_ty(tcx).sty { s } else { bug!("Closure arguments are not passed as a tuple"); diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index eef5246476e36..4cf4a8f23a443 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -100,7 +100,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for OptimizationFinder<'b, 'a, 'tcx> { if let Rvalue::Len(ref place) = *rvalue { let place_ty = place.ty(&self.mir.local_decls, self.tcx).to_ty(self.tcx); - if let TyKind::TyArray(_, len) = place_ty.sty { + if let TyKind::Array(_, len) = place_ty.sty { let span = self.mir.source_info(location).span; let ty = self.tcx.types.usize; let constant = Constant { span, ty, literal: len }; diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index d876ee77e76cf..a56399eecd38e 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -495,7 +495,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { this.add(Qualif::NOT_CONST); } else { let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); - if let ty::TyRawPtr(_) = base_ty.sty { + if let ty::RawPtr(_) = base_ty.sty { if !this.tcx.sess.features_untracked().const_raw_ptr_deref { emit_feature_err( &this.tcx.sess.parse_sess, "const_raw_ptr_deref", @@ -591,7 +591,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { if let Place::Projection(ref proj) = *place { if let ProjectionElem::Deref = proj.elem { let base_ty = proj.base.ty(self.mir, self.tcx).to_ty(self.tcx); - if let ty::TyRef(..) = base_ty.sty { + if let ty::Ref(..) = base_ty.sty { is_reborrow = true; } } @@ -638,10 +638,10 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { if self.mode == Mode::StaticMut { // Inside a `static mut`, &mut [...] is also allowed. match ty.sty { - ty::TyArray(..) | ty::TySlice(_) => forbidden_mut = false, + ty::Array(..) | ty::Slice(_) => forbidden_mut = false, _ => {} } - } else if let ty::TyArray(_, len) = ty.sty { + } else if let ty::Array(_, len) = ty.sty { // FIXME(eddyb) the `self.mode == Mode::Fn` condition // seems unnecessary, given that this is merely a ZST. if len.unwrap_usize(self.tcx) == 0 && self.mode == Mode::Fn { @@ -745,7 +745,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { } Rvalue::BinaryOp(op, ref lhs, _) => { - if let ty::TyRawPtr(_) = lhs.ty(self.mir, self.tcx).sty { + if let ty::RawPtr(_) = lhs.ty(self.mir, self.tcx).sty { assert!(op == BinOp::Eq || op == BinOp::Ne || op == BinOp::Le || op == BinOp::Lt || op == BinOp::Ge || op == BinOp::Gt || @@ -809,7 +809,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { let fn_ty = func.ty(self.mir, self.tcx); let mut callee_def_id = None; let (mut is_shuffle, mut is_const_fn) = (false, None); - if let ty::TyFnDef(def_id, _) = fn_ty.sty { + if let ty::FnDef(def_id, _) = fn_ty.sty { callee_def_id = Some(def_id); match self.tcx.fn_sig(def_id).abi() { Abi::RustIntrinsic | diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 776d7888459f7..2147cc2a41a07 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -229,7 +229,7 @@ fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator { if let mir::TerminatorKind::Call { func: ref oper, ref args, .. } = *kind { if let mir::Operand::Constant(ref func) = *oper { - if let ty::TyFnDef(def_id, _) = func.ty.sty { + if let ty::FnDef(def_id, _) = func.ty.sty { let abi = tcx.fn_sig(def_id).abi(); let name = tcx.item_name(def_id); if abi == Abi::RustIntrinsic && name == "rustc_peek" { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 4e9e085ca08a3..78464b2a104ec 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -80,7 +80,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { // no need to transformation } else { let place_ty = proj.base.ty(self.mir, self.tcx).to_ty(self.tcx); - if let ty::TyArray(item_ty, const_size) = place_ty.sty { + if let ty::Array(item_ty, const_size) = place_ty.sty { if let Some(size) = const_size.assert_usize(self.tcx) { assert!(size <= u32::max_value() as u64, "uniform array move out doesn't supported @@ -202,7 +202,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut { let opt_src_place = items.first().and_then(|x| *x).map(|x| x.2); let opt_size = opt_src_place.and_then(|src_place| { let src_ty = src_place.ty(mir, tcx).to_ty(tcx); - if let ty::TyArray(_, ref size_o) = src_ty.sty { + if let ty::Array(_, ref size_o) = src_ty.sty { size_o.assert_usize(tcx) } else { None diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index d1410210bda96..8717bd08ae4a5 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -59,7 +59,7 @@ fn is_within_packed<'a, 'tcx, L>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ProjectionElem::Field(..) => { let ty = base.ty(local_decls, tcx).to_ty(tcx); match ty.sty { - ty::TyAdt(def, _) if def.repr.packed() => { + ty::Adt(def, _) if def.repr.packed() => { return true } _ => {} diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index 7be6241b3f91e..1c5e1e406911a 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -425,8 +425,8 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { o: Origin, ) -> DiagnosticBuilder<'cx> { let type_name = match (&ty.sty, is_index) { - (&ty::TyArray(_, _), Some(true)) | (&ty::TyArray(_, _), None) => "array", - (&ty::TySlice(_), _) => "slice", + (&ty::Array(_, _), Some(true)) | (&ty::Array(_, _), None) => "array", + (&ty::Slice(_), _) => "slice", _ => span_bug!(move_from_span, "this path should not cause illegal move"), }; let mut err = struct_span_err!( diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index bbffeec631abd..33e0554715f80 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -780,7 +780,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn open_drop<'a>(&mut self) -> BasicBlock { let ty = self.place_ty(self.place); match ty.sty { - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { let tys : Vec<_> = substs.upvar_tys(def_id, self.tcx()).collect(); self.open_drop_for_tuple(&tys) } @@ -790,30 +790,30 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> // This should only happen for the self argument on the resume function. // It effetively only contains upvars until the generator transformation runs. // See librustc_mir/transform/generator.rs for more details. - ty::TyGenerator(def_id, substs, _) => { + ty::Generator(def_id, substs, _) => { let tys : Vec<_> = substs.upvar_tys(def_id, self.tcx()).collect(); self.open_drop_for_tuple(&tys) } - ty::TyTuple(tys) => { + ty::Tuple(tys) => { self.open_drop_for_tuple(tys) } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { if def.is_box() { self.open_drop_for_box(def, substs) } else { self.open_drop_for_adt(def, substs) } } - ty::TyDynamic(..) => { + ty::Dynamic(..) => { let unwind = self.unwind; // FIXME(#43234) let succ = self.succ; self.complete_drop(Some(DropFlagMode::Deep), succ, unwind) } - ty::TyArray(ety, size) => { + ty::Array(ety, size) => { let size = size.assert_usize(self.tcx()); self.open_drop_for_array(ety, size) }, - ty::TySlice(ety) => self.open_drop_for_array(ety, None), + ty::Slice(ety) => self.open_drop_for_array(ety, None), _ => bug!("open drop from non-ADT `{:?}`", ty) } diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 114fd8754a21f..fca1c7f27ab37 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -328,7 +328,7 @@ fn check_expr_kind<'a, 'tcx>( e: &'tcx hir::Expr, node_ty: Ty<'tcx>) -> Promotability { let ty_result = match node_ty.sty { - ty::TyAdt(def, _) if def.has_dtor(v.tcx) => { + ty::Adt(def, _) if def.has_dtor(v.tcx) => { NotPromotable } _ => Promotable @@ -356,7 +356,7 @@ fn check_expr_kind<'a, 'tcx>( return NotPromotable; } match v.tables.node_id_to_type(lhs.hir_id).sty { - ty::TyRawPtr(_) => { + ty::RawPtr(_) => { assert!(op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne || op.node == hir::BinOpKind::Le || op.node == hir::BinOpKind::Lt || op.node == hir::BinOpKind::Ge || op.node == hir::BinOpKind::Gt); @@ -494,7 +494,7 @@ fn check_expr_kind<'a, 'tcx>( Some(ref expr) => { struct_result = struct_result & v.check_expr(&expr); }, None => {}, } - if let ty::TyAdt(adt, ..) = v.tables.expr_ty(e).sty { + if let ty::Adt(adt, ..) = v.tables.expr_ty(e).sty { // unsafe_cell_type doesn't necessarily exist with no_core if Some(adt.did) == v.tcx.lang_items().unsafe_cell_type() { return NotPromotable; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index d9c3fc221dce1..3c2869af54f40 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -89,11 +89,11 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { fn item_ty_level(&self, item_def_id: DefId) -> Option { let ty_def_id = match self.tcx.type_of(item_def_id).sty { - ty::TyAdt(adt, _) => adt.did, + ty::Adt(adt, _) => adt.did, ty::TyForeign(did) => did, - ty::TyDynamic(ref obj, ..) if obj.principal().is_some() => + ty::Dynamic(ref obj, ..) if obj.principal().is_some() => obj.principal().unwrap().def_id(), - ty::TyProjection(ref proj) => proj.trait_ref(self.tcx).def_id, + ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id, _ => return Some(AccessLevel::Public) }; if let Some(node_id) = self.tcx.hir.as_local_node_id(ty_def_id) { @@ -443,7 +443,7 @@ impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { fn ty(&mut self) -> &mut Self { let ty = self.ev.tcx.type_of(self.item_def_id); ty.visit_with(self); - if let ty::TyFnDef(def_id, _) = ty.sty { + if let ty::FnDef(def_id, _) = ty.sty { if def_id == self.item_def_id { self.ev.tcx.fn_sig(def_id).visit_with(self); } @@ -470,14 +470,14 @@ impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let ty_def_id = match ty.sty { - ty::TyAdt(adt, _) => Some(adt.did), + ty::Adt(adt, _) => Some(adt.did), ty::TyForeign(did) => Some(did), - ty::TyDynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), - ty::TyProjection(ref proj) => Some(proj.item_def_id), - ty::TyFnDef(def_id, ..) | - ty::TyClosure(def_id, ..) | - ty::TyGenerator(def_id, ..) | - ty::TyAnon(def_id, _) => Some(def_id), + ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), + ty::Projection(ref proj) => Some(proj.item_def_id), + ty::FnDef(def_id, ..) | + ty::Closure(def_id, ..) | + ty::Generator(def_id, ..) | + ty::Anon(def_id, _) => Some(def_id), _ => None }; @@ -896,15 +896,15 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { match ty.sty { - ty::TyAdt(&ty::AdtDef { did: def_id, .. }, ..) | - ty::TyFnDef(def_id, ..) | + ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | + ty::FnDef(def_id, ..) | ty::TyForeign(def_id) => { if !self.item_is_accessible(def_id) { let msg = format!("type `{}` is private", ty); self.tcx.sess.span_err(self.span, &msg); return true; } - if let ty::TyFnDef(..) = ty.sty { + if let ty::FnDef(..) = ty.sty { if self.tcx.fn_sig(def_id).visit_with(self) { return true; } @@ -919,7 +919,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } } } - ty::TyDynamic(ref predicates, ..) => { + ty::Dynamic(ref predicates, ..) => { let is_private = predicates.skip_binder().iter().any(|predicate| { let def_id = match *predicate { ty::ExistentialPredicate::Trait(trait_ref) => trait_ref.def_id, @@ -935,13 +935,13 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { return true; } } - ty::TyProjection(ref proj) => { + ty::Projection(ref proj) => { let tcx = self.tcx; if self.check_trait_ref(proj.trait_ref(tcx)) { return true; } } - ty::TyAnon(def_id, ..) => { + ty::Anon(def_id, ..) => { for predicate in &self.tcx.predicates_of(def_id).predicates { let trait_ref = match *predicate { ty::Predicate::Trait(ref poly_trait_predicate) => { @@ -964,9 +964,9 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { return true; } for subst in trait_ref.substs.iter() { - // Skip repeated `TyAnon`s to avoid infinite recursion. + // Skip repeated `Anon`s to avoid infinite recursion. if let UnpackedKind::Type(ty) = subst.unpack() { - if let ty::TyAnon(def_id, ..) = ty.sty { + if let ty::Anon(def_id, ..) = ty.sty { if !self.visited_anon_tys.insert(def_id) { continue; } @@ -1388,7 +1388,7 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn ty(&mut self) -> &mut Self { let ty = self.tcx.type_of(self.item_def_id); ty.visit_with(self); - if let ty::TyFnDef(def_id, _) = ty.sty { + if let ty::FnDef(def_id, _) = ty.sty { if def_id == self.item_def_id { self.tcx.fn_sig(def_id).visit_with(self); } @@ -1434,10 +1434,10 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let ty_def_id = match ty.sty { - ty::TyAdt(adt, _) => Some(adt.did), + ty::Adt(adt, _) => Some(adt.did), ty::TyForeign(did) => Some(did), - ty::TyDynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), - ty::TyProjection(ref proj) => { + ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), + ty::Projection(ref proj) => { if self.required_visibility == ty::Visibility::Invisible { // Conservatively approximate the whole type alias as public without // recursing into its components when determining impl publicity. diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index b2d78850cbab9..298f95496666a 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -534,7 +534,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { pub fn get_expr_data(&self, expr: &ast::Expr) -> Option { let hir_node = self.tcx.hir.expect_expr(expr.id); let ty = self.tables.expr_ty_adjusted_opt(&hir_node); - if ty.is_none() || ty.unwrap().sty == ty::TyError { + if ty.is_none() || ty.unwrap().sty == ty::Error { return None; } match expr.node { @@ -551,7 +551,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } }; match self.tables.expr_ty_adjusted(&hir_node).sty { - ty::TyAdt(def, _) if !def.is_enum() => { + ty::Adt(def, _) if !def.is_enum() => { let variant = &def.non_enum_variant(); let index = self.tcx.find_field_index(ident, variant).unwrap(); let sub_span = self.span_utils.span_for_last_ident(expr.span); @@ -563,7 +563,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { ref_id: id_from_def_id(variant.fields[index].did), })); } - ty::TyTuple(..) => None, + ty::Tuple(..) => None, _ => { debug!("Expected struct or union type, found {:?}", ty); None @@ -572,7 +572,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } ast::ExprKind::Struct(ref path, ..) => { match self.tables.expr_ty_adjusted(&hir_node).sty { - ty::TyAdt(def, _) if !def.is_enum() => { + ty::Adt(def, _) if !def.is_enum() => { let sub_span = self.span_utils.span_for_last_ident(path.span); filter!(self.span_utils, sub_span, path.span, None); let span = self.span_from_span(sub_span.unwrap()); @@ -674,7 +674,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { hir::QPath::Resolved(_, ref path) => path.def, hir::QPath::TypeRelative(..) => { let ty = hir_ty_to_ty(self.tcx, ty); - if let ty::TyProjection(proj) = ty.sty { + if let ty::Projection(proj) = ty.sty { return HirDef::AssociatedTy(proj.item_def_id); } HirDef::Err diff --git a/src/librustc_traits/chalk_context.rs b/src/librustc_traits/chalk_context.rs index b0f0b105f3ecb..4227144e204fb 100644 --- a/src/librustc_traits/chalk_context.rs +++ b/src/librustc_traits/chalk_context.rs @@ -237,7 +237,7 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { // _ => false, // }, // Kind::Type(ty) => match ty.sty { -// ty::TyInfer(ty::InferTy::CanonicalTy(cvar1)) => cvar == cvar1, +// ty::Infer(ty::InferTy::CanonicalTy(cvar1)) => cvar == cvar1, // _ => false, // }, // }) diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 973580bcbe904..005d56a150863 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -123,7 +123,7 @@ fn dropck_outlives<'tcx>( // A projection that we couldn't resolve - it // might have a destructor. - ty::TyProjection(..) | ty::TyAnon(..) => { + ty::Projection(..) | ty::Anon(..) => { result.kinds.push(ty.into()); } @@ -179,33 +179,33 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( | ty::TyUint(_) | ty::TyFloat(_) | ty::TyStr - | ty::TyNever + | ty::Never | ty::TyForeign(..) - | ty::TyRawPtr(..) - | ty::TyRef(..) - | ty::TyFnDef(..) - | ty::TyFnPtr(_) - | ty::TyGeneratorWitness(..) => { + | ty::RawPtr(..) + | ty::Ref(..) + | ty::FnDef(..) + | ty::FnPtr(_) + | ty::GeneratorWitness(..) => { // these types never have a destructor Ok(DtorckConstraint::empty()) } - ty::TyArray(ety, _) | ty::TySlice(ety) => { + ty::Array(ety, _) | ty::Slice(ety) => { // single-element containers, behave like their element dtorck_constraint_for_ty(tcx, span, for_ty, depth + 1, ety) } - ty::TyTuple(tys) => tys + ty::Tuple(tys) => tys .iter() .map(|ty| dtorck_constraint_for_ty(tcx, span, for_ty, depth + 1, ty)) .collect(), - ty::TyClosure(def_id, substs) => substs + ty::Closure(def_id, substs) => substs .upvar_tys(def_id, tcx) .map(|ty| dtorck_constraint_for_ty(tcx, span, for_ty, depth + 1, ty)) .collect(), - ty::TyGenerator(def_id, substs, _movability) => { + ty::Generator(def_id, substs, _movability) => { // rust-lang/rust#49918: types can be constructed, stored // in the interior, and sit idle when generator yields // (and is subsequently dropped). @@ -216,7 +216,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( // its interior). // // However, the interior's representation uses things like - // TyGeneratorWitness that explicitly assume they are not + // GeneratorWitness that explicitly assume they are not // traversed in such a manner. So instead, we will // simplify things for now by treating all generators as // if they were like trait objects, where its upvars must @@ -242,7 +242,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( Ok(constraint) } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { let DtorckConstraint { dtorck_types, outlives, @@ -259,20 +259,20 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( // Objects must be alive in order for their destructor // to be called. - ty::TyDynamic(..) => Ok(DtorckConstraint { + ty::Dynamic(..) => Ok(DtorckConstraint { outlives: vec![ty.into()], dtorck_types: vec![], overflows: vec![], }), // Types that can't be resolved. Pass them forward. - ty::TyProjection(..) | ty::TyAnon(..) | ty::TyParam(..) => Ok(DtorckConstraint { + ty::Projection(..) | ty::Anon(..) | ty::TyParam(..) => Ok(DtorckConstraint { outlives: vec![], dtorck_types: vec![ty], overflows: vec![], }), - ty::TyInfer(..) | ty::TyError => { + ty::Infer(..) | ty::Error => { // By the time this code runs, all type variables ought to // be fully resolved. Err(NoSolution) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 6088a80922e57..42218fc515040 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -108,7 +108,7 @@ struct GenericArgMismatchErrorCode { /// Dummy type used for the `Self` of a `TraitRef` created for converting /// a trait object, and which gets removed in `ExistentialTraitRef`. /// This type must not appear anywhere in other converted types. -const TRAIT_OBJECT_DUMMY_SELF: ty::TyKind<'static> = ty::TyInfer(ty::FreshTy(0)); +const TRAIT_OBJECT_DUMMY_SELF: ty::TyKind<'static> = ty::Infer(ty::FreshTy(0)); impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { pub fn ast_region_to_region(&self, @@ -1474,7 +1474,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { } hir::TyKind::Rptr(ref region, ref mt) => { let r = self.ast_region_to_region(region, None); - debug!("TyRef r={:?}", r); + debug!("Ref r={:?}", r); let t = self.ast_ty_to_ty(&mt.ty); tcx.mk_ref(r, ty::TypeAndMut {ty: t, mutbl: mt.mutbl}) } @@ -1513,7 +1513,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let length_def_id = tcx.hir.local_def_id(length.id); let substs = Substs::identity_for_item(tcx, length_def_id); let length = ty::Const::unevaluated(tcx, length_def_id, substs, tcx.types.usize); - let array_ty = tcx.mk_ty(ty::TyArray(self.ast_ty_to_ty(&ty), length)); + let array_ty = tcx.mk_ty(ty::Array(self.ast_ty_to_ty(&ty), length)); self.normalize_ty(ast_ty.span, array_ty) } hir::TyKind::Typeof(ref _e) => { @@ -1525,7 +1525,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { tcx.types.err } hir::TyKind::Infer => { - // TyInfer also appears as the type of arguments or return + // Infer also appears as the type of arguments or return // values in a ExprKind::Closure, or as // the type of local variables. Both of these cases are // handled specially and will not descend into this routine. diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index c961bcd1e5913..eda3e6715e9c2 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { PatKind::Lit(ref lt) => { let ty = self.check_expr(lt); match ty.sty { - ty::TyKind::TyRef(..) => false, + ty::TyKind::Ref(..) => false, _ => true, } } @@ -74,7 +74,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Peel off as many `&` or `&mut` from the discriminant as possible. For example, // for `match &&&mut Some(5)` the loop runs three times, aborting when it reaches - // the `Some(5)` which is not of type TyRef. + // the `Some(5)` which is not of type Ref. // // For each ampersand peeled off, update the binding mode and push the original // type into the adjustments vector. @@ -84,8 +84,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected = loop { debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty); match exp_ty.sty { - ty::TyKind::TyRef(_, inner_ty, inner_mutability) => { - debug!("current discriminant is TyRef, inserting implicit deref"); + ty::TyKind::Ref(_, inner_ty, inner_mutability) => { + debug!("current discriminant is Ref, inserting implicit deref"); // Preserve the reference type. We'll need it later during HAIR lowering. pat_adjustments.push(exp_ty); @@ -150,8 +150,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let hir::ExprKind::Lit(ref lt) = lt.node { if let ast::LitKind::ByteStr(_) = lt.node { let expected_ty = self.structurally_resolved_type(pat.span, expected); - if let ty::TyRef(_, r_ty, _) = expected_ty.sty { - if let ty::TySlice(_) = r_ty.sty { + if let ty::Ref(_, r_ty, _) = expected_ty.sty { + if let ty::Slice(_) = r_ty.sty { pat_ty = tcx.mk_imm_ref(tcx.types.re_static, tcx.mk_slice(tcx.types.u8)) } @@ -285,7 +285,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut expected_len = elements.len(); if ddpos.is_some() { // Require known type only when `..` is present - if let ty::TyTuple(ref tys) = + if let ty::Tuple(ref tys) = self.structurally_resolved_type(pat.span, expected).sty { expected_len = tys.len(); } @@ -297,7 +297,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // from all tuple elements isn't trivial. TypeVariableOrigin::TypeInference(pat.span))); let element_tys = tcx.mk_type_list(element_tys_iter); - let pat_ty = tcx.mk_ty(ty::TyTuple(element_tys)); + let pat_ty = tcx.mk_ty(ty::Tuple(element_tys)); self.demand_eqtype(pat.span, expected, pat_ty); for (i, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) { self.check_pat_walk(elem, &element_tys[i], def_bm, true); @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // hack detailed in (*) below. debug!("check_pat_walk: expected={:?}", expected); let (rptr_ty, inner_ty) = match expected.sty { - ty::TyRef(_, r_ty, r_mutbl) if r_mutbl == mutbl => { + ty::Ref(_, r_ty, r_mutbl) if r_mutbl == mutbl => { (expected, r_ty) } _ => { @@ -375,7 +375,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { PatKind::Slice(ref before, ref slice, ref after) => { let expected_ty = self.structurally_resolved_type(pat.span, expected); let (inner_ty, slice_ty) = match expected_ty.sty { - ty::TyArray(inner_ty, size) => { + ty::Array(inner_ty, size) => { let size = size.unwrap_usize(tcx); let min_len = before.len() as u64 + after.len() as u64; if slice.is_none() { @@ -400,16 +400,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (inner_ty, tcx.types.err) } } - ty::TySlice(inner_ty) => (inner_ty, expected_ty), + ty::Slice(inner_ty) => (inner_ty, expected_ty), _ => { if !expected_ty.references_error() { let mut err = struct_span_err!( tcx.sess, pat.span, E0529, "expected an array or slice, found `{}`", expected_ty); - if let ty::TyRef(_, ty, _) = expected_ty.sty { + if let ty::Ref(_, ty, _) = expected_ty.sty { match ty.sty { - ty::TyArray(..) | ty::TySlice(..) => { + ty::Array(..) | ty::Slice(..) => { err.help("the semantics of slice patterns changed \ recently; see issue #23121"); } @@ -493,7 +493,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &hir::Pat) -> bool { if let PatKind::Binding(..) = inner.node { if let Some(mt) = self.shallow_resolve(expected).builtin_deref(true) { - if let ty::TyDynamic(..) = mt.ty.sty { + if let ty::Dynamic(..) = mt.ty.sty { // This is "x = SomeTrait" being reduced from // "let &x = &SomeTrait" or "let box x = Box", an error. let type_str = self.ty_to_string(expected); @@ -818,7 +818,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); if subpats.len() == variant.fields.len() || subpats.len() < variant.fields.len() && ddpos.is_some() { let substs = match pat_ty.sty { - ty::TyAdt(_, substs) => substs, + ty::Adt(_, substs) => substs, ref ty => bug!("unexpected pattern type {:?}", ty), }; for (i, subpat) in subpats.iter().enumerate_and_adjust(variant.fields.len(), ddpos) { @@ -854,7 +854,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let tcx = self.tcx; let (substs, adt) = match adt_ty.sty { - ty::TyAdt(adt, substs) => (substs, adt), + ty::Adt(adt, substs) => (substs, adt), _ => span_bug!(span, "struct pattern is not an ADT") }; let kind_name = adt.variant_descr(); diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 09562614982b8..743a2390ec43d 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -177,7 +177,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { self.fcx.try_overloaded_deref(self.span, source, needs) .and_then(|InferOk { value: method, obligations: o }| { obligations.extend(o); - if let ty::TyRef(region, _, mutbl) = method.sig.output().sty { + if let ty::Ref(region, _, mutbl) = method.sig.output().sty { Some(OverloadedDeref { region, mutbl, diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index ec127d26ab307..462bde2ab4f13 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -95,13 +95,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If the callee is a bare function or a closure, then we're all set. match adjusted_ty.sty { - ty::TyFnDef(..) | ty::TyFnPtr(_) => { + ty::FnDef(..) | ty::FnPtr(_) => { let adjustments = autoderef.adjust_steps(Needs::None); self.apply_adjustments(callee_expr, adjustments); return Some(CallStep::Builtin(adjusted_ty)); } - ty::TyClosure(def_id, substs) => { + ty::Closure(def_id, substs) => { assert_eq!(def_id.krate, LOCAL_CRATE); // Check whether this is a call to a closure where we @@ -135,7 +135,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // over the top. The simplest fix by far is to just ignore // this case and deref again, so we wind up with // `FnMut::call_mut(&mut *x, ())`. - ty::TyRef(..) if autoderef.step_count() == 0 => { + ty::Ref(..) if autoderef.step_count() == 0 => { return None; } @@ -175,7 +175,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let method = self.register_infer_ok_obligations(ok); let mut autoref = None; if borrow { - if let ty::TyRef(region, _, mutbl) = method.sig.inputs()[0].sty { + if let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].sty { let mutbl = match mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, hir::MutMutable => AutoBorrowMutability::Mutable { @@ -206,13 +206,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected: Expectation<'tcx>) -> Ty<'tcx> { let (fn_sig, def_span) = match callee_ty.sty { - ty::TyFnDef(def_id, _) => { + ty::FnDef(def_id, _) => { (callee_ty.fn_sig(self.tcx), self.tcx.hir.span_if_local(def_id)) } - ty::TyFnPtr(sig) => (sig, None), + ty::FnPtr(sig) => (sig, None), ref t => { let mut unit_variant = None; - if let &ty::TyAdt(adt_def, ..) = t { + if let &ty::Adt(adt_def, ..) = t { if adt_def.is_enum() { if let hir::ExprKind::Call(ref expr, _) = call_expr.node { unit_variant = Some(self.tcx.hir.node_to_pretty_string(expr.id)) diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 3415ad2742a2c..cf0026a7a9c91 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -103,10 +103,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } Ok(match t.sty { - ty::TySlice(_) | ty::TyStr => Some(PointerKind::Length), - ty::TyDynamic(ref tty, ..) => + ty::Slice(_) | ty::TyStr => Some(PointerKind::Length), + ty::Dynamic(ref tty, ..) => Some(PointerKind::Vtable(tty.principal().map(|p| p.def_id()))), - ty::TyAdt(def, substs) if def.is_struct() => { + ty::Adt(def, substs) if def.is_struct() => { match def.non_enum_variant().fields.last() { None => Some(PointerKind::Thin), Some(f) => { @@ -115,7 +115,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } - ty::TyTuple(fields) => match fields.last() { + ty::Tuple(fields) => match fields.last() { None => Some(PointerKind::Thin), Some(f) => self.pointer_kind(f, span)? }, @@ -123,17 +123,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Pointers to foreign types are thin, despite being unsized ty::TyForeign(..) => Some(PointerKind::Thin), // We should really try to normalize here. - ty::TyProjection(ref pi) => Some(PointerKind::OfProjection(pi)), - ty::TyAnon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)), + ty::Projection(ref pi) => Some(PointerKind::OfProjection(pi)), + ty::Anon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)), ty::TyParam(ref p) => Some(PointerKind::OfParam(p)), // Insufficient type information. - ty::TyInfer(_) => None, + ty::Infer(_) => None, ty::TyBool | ty::TyChar | ty::TyInt(..) | ty::TyUint(..) | - ty::TyFloat(_) | ty::TyArray(..) | ty::TyGeneratorWitness(..) | - ty::TyRawPtr(_) | ty::TyRef(..) | ty::TyFnDef(..) | - ty::TyFnPtr(..) | ty::TyClosure(..) | ty::TyGenerator(..) | - ty::TyAdt(..) | ty::TyNever | ty::TyError => { + ty::TyFloat(_) | ty::Array(..) | ty::GeneratorWitness(..) | + ty::RawPtr(_) | ty::Ref(..) | ty::FnDef(..) | + ty::FnPtr(..) | ty::Closure(..) | ty::Generator(..) | + ty::Adt(..) | ty::Never | ty::Error => { self.tcx.sess.delay_span_bug( span, &format!("`{:?}` should be sized but is not?", t)); return Err(ErrorReported); @@ -199,7 +199,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { // cases now. We do a more thorough check at the end, once // inference is more completely known. match cast_ty.sty { - ty::TyDynamic(..) | ty::TySlice(..) => { + ty::Dynamic(..) | ty::Slice(..) => { check.report_cast_to_unsized_type(fcx); Err(ErrorReported) } @@ -319,7 +319,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { fcx.resolve_type_vars_if_possible(&self.expr_ty), tstr); match self.expr_ty.sty { - ty::TyRef(_, _, mt) => { + ty::Ref(_, _, mt) => { let mtstr = match mt { hir::MutMutable => "mut ", hir::MutImmutable => "", @@ -343,7 +343,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { tstr); } } - ty::TyAdt(def, ..) if def.is_box() => { + ty::Adt(def, ..) if def.is_box() => { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { Ok(s) => { err.span_suggestion(self.cast_span, @@ -429,7 +429,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { (Some(t_from), Some(t_cast)) => (t_from, t_cast), // Function item types may need to be reified before casts. (None, Some(t_cast)) => { - if let ty::TyFnDef(..) = self.expr_ty.sty { + if let ty::FnDef(..) = self.expr_ty.sty { // Attempt a coercion to a fn pointer type. let f = self.expr_ty.fn_sig(fcx.tcx); let res = fcx.try_coerce(self.expr, @@ -482,7 +482,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { ty::TyKind::TyFloat(_) => { Err(CastError::NeedDeref) } - ty::TyKind::TyInfer(t) => { + ty::TyKind::Infer(t) => { match t { ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref), @@ -583,7 +583,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { // array-ptr-cast. if m_expr.mutbl == hir::MutImmutable && m_cast.mutbl == hir::MutImmutable { - if let ty::TyArray(ety, _) = m_expr.ty.sty { + if let ty::Array(ety, _) = m_expr.ty.sty { // Due to the limitations of LLVM global constants, // region pointers end up pointing at copies of // vector elements instead of the original values. diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 242b69294a5bc..a283e032e0e02 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -190,7 +190,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); match expected_ty.sty { - ty::TyDynamic(ref object_type, ..) => { + ty::Dynamic(ref object_type, ..) => { let sig = object_type .projection_bounds() .filter_map(|pb| { @@ -203,8 +203,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .and_then(|p| self.tcx.lang_items().fn_trait_kind(p.def_id())); (sig, kind) } - ty::TyInfer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid), - ty::TyFnPtr(sig) => { + ty::Infer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid), + ty::FnPtr(sig) => { let expected_sig = ExpectedSig { cause_span: None, sig: sig.skip_binder().clone(), @@ -269,9 +269,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // NB: This predicate is created by breaking down a // `ClosureType: FnFoo()` predicate, where - // `ClosureType` represents some `TyClosure`. It can't + // `ClosureType` represents some `Closure`. It can't // possibly be referring to the current closure, - // because we haven't produced the `TyClosure` for + // because we haven't produced the `Closure` for // this closure yet; this is exactly why the other // code is looking for a self type of a unresolved // inference variable. @@ -317,7 +317,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); let input_tys = match arg_param_ty.sty { - ty::TyTuple(tys) => tys.into_iter(), + ty::Tuple(tys) => tys.into_iter(), _ => { return None; } @@ -353,7 +353,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { trait_ref, self_ty ); match self_ty.sty { - ty::TyInfer(ty::TyVar(v)) if expected_vid == v => Some(trait_ref), + ty::Infer(ty::TyVar(v)) if expected_vid == v => Some(trait_ref), _ => None, } } diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index e3b0b8cccf31c..763adb007c3a4 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -210,11 +210,11 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // Note: does not attempt to resolve type variables we encounter. // See above for details. match b.sty { - ty::TyRawPtr(mt_b) => { + ty::RawPtr(mt_b) => { return self.coerce_unsafe_ptr(a, b, mt_b.mutbl); } - ty::TyRef(r_b, ty, mutbl) => { + ty::Ref(r_b, ty, mutbl) => { let mt_b = ty::TypeAndMut { ty, mutbl }; return self.coerce_borrowed_pointer(a, b, r_b, mt_b); } @@ -223,7 +223,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { } match a.sty { - ty::TyFnDef(..) => { + ty::FnDef(..) => { // Function items are coercible to any closure // type; function pointers are not (that would // require double indirection). @@ -231,12 +231,12 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // items to drop the unsafe qualifier. self.coerce_from_fn_item(a, b) } - ty::TyFnPtr(a_f) => { + ty::FnPtr(a_f) => { // We permit coercion of fn pointers to drop the // unsafe qualifier. self.coerce_from_fn_pointer(a, a_f, b) } - ty::TyClosure(def_id_a, substs_a) => { + ty::Closure(def_id_a, substs_a) => { // Non-capturing closures are coercible to // function pointers self.coerce_closure_to_fn(a, def_id_a, substs_a, b) @@ -267,7 +267,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // yield. let (r_a, mt_a) = match a.sty { - ty::TyRef(r_a, ty, mutbl) => { + ty::Ref(r_a, ty, mutbl) => { let mt_a = ty::TypeAndMut { ty, mutbl }; coerce_mutbls(mt_a.mutbl, mt_b.mutbl)?; (r_a, mt_a) @@ -429,7 +429,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // Now apply the autoref. We have to extract the region out of // the final ref type we got. let r_borrow = match ty.sty { - ty::TyRef(r_borrow, _, _) => r_borrow, + ty::Ref(r_borrow, _, _) => r_borrow, _ => span_bug!(span, "expected a ref type, got {:?}", ty), }; let mutbl = match mt_b.mutbl { @@ -473,7 +473,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // Handle reborrows before selecting `Source: CoerceUnsized`. let reborrow = match (&source.sty, &target.sty) { - (&ty::TyRef(_, ty_a, mutbl_a), &ty::TyRef(_, _, mutbl_b)) => { + (&ty::Ref(_, ty_a, mutbl_a), &ty::Ref(_, _, mutbl_b)) => { coerce_mutbls(mutbl_a, mutbl_b)?; let coercion = Coercion(self.cause.span); @@ -498,7 +498,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { }) })) } - (&ty::TyRef(_, ty_a, mt_a), &ty::TyRawPtr(ty::TypeAndMut { mutbl: mt_b, .. })) => { + (&ty::Ref(_, ty_a, mt_a), &ty::RawPtr(ty::TypeAndMut { mutbl: mt_b, .. })) => { coerce_mutbls(mt_a, mt_b)?; Some((Adjustment { @@ -562,7 +562,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { 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().sty; - if let ty::TyTuple(..) = sty { + if let ty::Tuple(..) = sty { debug!("coerce_unsized: found unsized tuple coercion"); has_unsized_tuple_coercion = true; } @@ -619,7 +619,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { where F: FnOnce(Ty<'tcx>) -> Vec>, G: FnOnce(Ty<'tcx>) -> Vec> { - if let ty::TyFnPtr(fn_ty_b) = b.sty { + if let ty::FnPtr(fn_ty_b) = b.sty { match (fn_ty_a.unsafety(), fn_ty_b.unsafety()) { (hir::Unsafety::Normal, hir::Unsafety::Unsafe) => { let unsafe_a = self.tcx.safe_to_unsafe_fn_ty(fn_ty_a); @@ -659,7 +659,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { debug!("coerce_from_fn_item(a={:?}, b={:?})", a, b); match b.sty { - ty::TyFnPtr(_) => { + ty::FnPtr(_) => { let a_sig = a.fn_sig(self.tcx); let InferOk { value: a_sig, mut obligations } = self.normalize_associated_types_in_as_infer_ok(self.cause.span, &a_sig); @@ -699,7 +699,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { let node_id_a = self.tcx.hir.as_local_node_id(def_id_a).unwrap(); match b.sty { - ty::TyFnPtr(_) if self.tcx.with_freevars(node_id_a, |v| v.is_empty()) => { + ty::FnPtr(_) if self.tcx.with_freevars(node_id_a, |v| v.is_empty()) => { // We coerce the closure, which has fn type // `extern "rust-call" fn((arg0,arg1,...)) -> _` // to @@ -722,8 +722,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { debug!("coerce_unsafe_ptr(a={:?}, b={:?})", a, b); let (is_ref, mt_a) = match a.sty { - ty::TyRef(_, ty, mutbl) => (true, ty::TypeAndMut { ty, mutbl }), - ty::TyRawPtr(mt) => (false, mt), + ty::Ref(_, ty, mutbl) => (true, ty::TypeAndMut { ty, mutbl }), + ty::RawPtr(mt) => (false, mt), _ => { return self.unify_and(a, b, identity); } @@ -811,7 +811,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Special-case that coercion alone cannot handle: // Two function item types of differing IDs or Substs. - if let (&ty::TyFnDef(..), &ty::TyFnDef(..)) = (&prev_ty.sty, &new_ty.sty) { + if let (&ty::FnDef(..), &ty::FnDef(..)) = (&prev_ty.sty, &new_ty.sty) { // Don't reify if the function types have a LUB, i.e. they // are the same function and their parameters have a LUB. let lub_ty = self.commit_if_ok(|_| { @@ -881,7 +881,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(_, mutbl_adj)), .. } ] => { match self.node_ty(expr.hir_id).sty { - ty::TyRef(_, _, mt_orig) => { + ty::Ref(_, _, mt_orig) => { let mutbl_adj: hir::Mutability = mutbl_adj.into(); // Reborrow that we can safely ignore, because // the next adjustment can only be a Deref diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 00cc36ecd428c..cf558c3acb796 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If the expected type is an enum with any variants whose sole // field is of the found type, suggest such variants. See Issue // #42764. - if let ty::TyAdt(expected_adt, substs) = expected.sty { + if let ty::Adt(expected_adt, substs) = expected.sty { let mut compatible_variants = vec![]; for variant in &expected_adt.variants { if variant.fields.len() == 1 { @@ -259,9 +259,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } match (&expected.sty, &checked_ty.sty) { - (&ty::TyRef(_, exp, _), &ty::TyRef(_, check, _)) => match (&exp.sty, &check.sty) { - (&ty::TyStr, &ty::TyArray(arr, _)) | - (&ty::TyStr, &ty::TySlice(arr)) if arr == self.tcx.types.u8 => { + (&ty::Ref(_, exp, _), &ty::Ref(_, check, _)) => match (&exp.sty, &check.sty) { + (&ty::TyStr, &ty::Array(arr, _)) | + (&ty::TyStr, &ty::Slice(arr)) if arr == self.tcx.types.u8 => { if let hir::ExprKind::Lit(_) = expr.node { if let Ok(src) = cm.span_to_snippet(sp) { if src.starts_with("b\"") { @@ -272,8 +272,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } }, - (&ty::TyArray(arr, _), &ty::TyStr) | - (&ty::TySlice(arr), &ty::TyStr) if arr == self.tcx.types.u8 => { + (&ty::Array(arr, _), &ty::TyStr) | + (&ty::Slice(arr), &ty::TyStr) if arr == self.tcx.types.u8 => { if let hir::ExprKind::Lit(_) = expr.node { if let Ok(src) = cm.span_to_snippet(sp) { if src.starts_with("\"") { @@ -286,7 +286,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } _ => {} }, - (&ty::TyRef(_, _, mutability), _) => { + (&ty::Ref(_, _, mutability), _) => { // Check if it can work when put into a ref. For example: // // ``` @@ -325,7 +325,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } - (_, &ty::TyRef(_, checked, _)) => { + (_, &ty::Ref(_, checked, _)) => { // We have `&T`, check if what was expected was `T`. If so, // we may want to suggest adding a `*`, or removing // a `&`. diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index f9166851f6fcc..9d3cbf910e059 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -45,7 +45,7 @@ pub fn check_drop_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let dtor_self_type = tcx.type_of(drop_impl_did); let dtor_predicates = tcx.predicates_of(drop_impl_did); match dtor_self_type.sty { - ty::TyAdt(adt_def, self_to_impl_substs) => { + ty::Adt(adt_def, self_to_impl_substs) => { ensure_drop_params_and_item_params_correspond(tcx, drop_impl_did, dtor_self_type, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index af4356dc8de78..f410f4b9af3c5 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -463,7 +463,7 @@ fn match_intrinsic_type_to_type<'a, 'tcx>( match *expected { Void => match t.sty { - ty::TyTuple(ref v) if v.is_empty() => {}, + ty::Tuple(ref v) if v.is_empty() => {}, _ => simple_error(&format!("`{}`", t), "()"), }, // (The width we pass to LLVM doesn't concern the type checker.) @@ -491,7 +491,7 @@ fn match_intrinsic_type_to_type<'a, 'tcx>( }, Pointer(ref inner_expected, ref _llvm_type, const_) => { match t.sty { - ty::TyRawPtr(ty::TypeAndMut { ty, mutbl }) => { + ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => { if (mutbl == hir::MutImmutable) != const_ { simple_error(&format!("`{}`", t), if const_ {"const pointer"} else {"mut pointer"}) @@ -537,7 +537,7 @@ fn match_intrinsic_type_to_type<'a, 'tcx>( } Aggregate(_flatten, ref expected_contents) => { match t.sty { - ty::TyTuple(contents) => { + ty::Tuple(contents) => { if contents.len() != expected_contents.len() { simple_error(&format!("tuple with length {}", contents.len()), &format!("tuple with length {}", expected_contents.len())); diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index fbb49c95edf03..6057c18663a6e 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -293,7 +293,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { .include_raw_pointers() .filter_map(|(ty, _)| { match ty.sty { - ty::TyDynamic(ref data, ..) => data.principal().map(|p| closure(self, ty, p)), + ty::Dynamic(ref data, ..) => data.principal().map(|p| closure(self, ty, p)), _ => None, } }) @@ -479,7 +479,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { if let Adjust::Deref(Some(ref mut deref)) = adjustment.kind { if let Some(ok) = self.try_overloaded_deref(expr.span, source, needs) { let method = self.register_infer_ok_obligations(ok); - if let ty::TyRef(region, _, mutbl) = method.sig.output().sty { + if let ty::Ref(region, _, mutbl) = method.sig.output().sty { *deref = OverloadedDeref { region, mutbl, @@ -538,7 +538,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { debug!("convert_place_op_to_mutable: method={:?}", method); self.write_method_call(expr.hir_id, method); - let (region, mutbl) = if let ty::TyRef(r, _, mutbl) = method.sig.inputs()[0].sty { + let (region, mutbl) = if let ty::Ref(r, _, mutbl) = method.sig.inputs()[0].sty { (r, mutbl) } else { span_bug!(expr.span, "input to place op is not a ref?"); @@ -605,7 +605,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { }) .any(|trait_pred| { match trait_pred.skip_binder().self_ty().sty { - ty::TyDynamic(..) => true, + ty::Dynamic(..) => true, _ => false, } }) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 68e851446dc96..46ccbb01c3882 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -314,7 +314,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { from_unsafe_deref: reached_raw_pointer, unsize: false, }; - if let ty::TyRawPtr(_) = ty.sty { + if let ty::RawPtr(_) = ty.sty { // all the subsequent steps will be from_unsafe_deref reached_raw_pointer = true; } @@ -324,7 +324,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let final_ty = autoderef.maybe_ambiguous_final_ty(); match final_ty.sty { - ty::TyInfer(ty::TyVar(_)) => { + ty::Infer(ty::TyVar(_)) => { // Ended in an inference variable. If we are doing // a real method lookup, this is a hard error because it's // possible that there will be multiple applicable methods. @@ -356,7 +356,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // just ignore it. } } - ty::TyArray(elem_ty, _) => { + ty::Array(elem_ty, _) => { let dereferences = steps.len() - 1; steps.push(CandidateStep { @@ -368,7 +368,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { unsize: true, }); } - ty::TyError => return None, + ty::Error => return None, _ => (), } @@ -450,13 +450,13 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let lang_items = self.tcx.lang_items(); match self_ty.sty { - ty::TyDynamic(ref data, ..) => { + ty::Dynamic(ref data, ..) => { if let Some(p) = data.principal() { self.assemble_inherent_candidates_from_object(self_ty, p); self.assemble_inherent_impl_candidates_for_type(p.def_id()); } } - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { self.assemble_inherent_impl_candidates_for_type(def.did); } ty::TyForeign(did) => { @@ -476,7 +476,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let lang_def_id = lang_items.str_alloc_impl(); self.assemble_inherent_impl_for_primitive(lang_def_id); } - ty::TySlice(_) => { + ty::Slice(_) => { let lang_def_id = lang_items.slice_impl(); self.assemble_inherent_impl_for_primitive(lang_def_id); @@ -489,11 +489,11 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let lang_def_id = lang_items.slice_u8_alloc_impl(); self.assemble_inherent_impl_for_primitive(lang_def_id); } - ty::TyRawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutImmutable }) => { + ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutImmutable }) => { let lang_def_id = lang_items.const_ptr_impl(); self.assemble_inherent_impl_for_primitive(lang_def_id); } - ty::TyRawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutMutable }) => { + ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutMutable }) => { let lang_def_id = lang_items.mut_ptr_impl(); self.assemble_inherent_impl_for_primitive(lang_def_id); } @@ -919,7 +919,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { pick.autoderefs = step.autoderefs; // Insert a `&*` or `&mut *` if this is a reference type: - if let ty::TyRef(_, _, mutbl) = step.self_ty.sty { + if let ty::Ref(_, _, mutbl) = step.self_ty.sty { pick.autoderefs += 1; pick.autoref = Some(mutbl); } diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 31ec62ba70a95..15aae83c5b90b 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -32,7 +32,7 @@ use rustc::hir::def_id::LOCAL_CRATE; use rustc::hir; use rustc::hir::print; use rustc::infer::type_variable::TypeVariableOrigin; -use rustc::ty::TyAdt; +use rustc::ty::Adt; use std::cmp::Ordering; @@ -45,9 +45,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match ty.sty { // Not all of these (e.g. unsafe fns) implement FnOnce // so we look for these beforehand - ty::TyClosure(..) | - ty::TyFnDef(..) | - ty::TyFnPtr(_) => true, + ty::Closure(..) | + ty::FnDef(..) | + ty::FnPtr(_) => true, // If it's not a simple function, look for things which implement FnOnce _ => { let fn_once = match tcx.lang_items().require(FnOnceTraitLangItem) { @@ -199,7 +199,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let item_kind = if is_method { "method" } else if actual.is_enum() { - if let TyAdt(ref adt_def, _) = actual.sty { + if let Adt(ref adt_def, _) = actual.sty { let names = adt_def.variants.iter().map(|s| &s.name); suggestion = find_best_match_for_name(names, &item_name.as_str(), @@ -338,7 +338,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(expr) = rcvr_expr { for (ty, _) in self.autoderef(span, rcvr_ty) { match ty.sty { - ty::TyAdt(def, substs) if !def.is_enum() => { + ty::Adt(def, substs) if !def.is_enum() => { let variant = &def.non_enum_variant(); if let Some(index) = self.tcx.find_field_index(item_name, variant) { let field = &variant.fields[index]; @@ -638,10 +638,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { -> bool { fn is_local(ty: Ty) -> bool { match ty.sty { - ty::TyAdt(def, _) => def.did.is_local(), + ty::Adt(def, _) => def.did.is_local(), ty::TyForeign(did) => did.is_local(), - ty::TyDynamic(ref tr, ..) => tr.principal() + ty::Dynamic(ref tr, ..) => tr.principal() .map_or(false, |p| p.def_id().is_local()), ty::TyParam(_) => true, diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 010ca1f7ab475..1230ccf440067 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -214,7 +214,7 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { // Anonymized types found in explicit return types and their // associated fresh inference variable. Writeback resolves these // variables to get the concrete type, which can be used to - // deanonymize TyAnon, after typeck is done with all functions. + // deanonymize Anon, after typeck is done with all functions. anon_types: RefCell>>, /// Each type parameter has an implicit region bound that @@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> Expectation<'tcx> { /// for examples of where this comes up,. fn rvalue_hint(fcx: &FnCtxt<'a, 'gcx, 'tcx>, ty: Ty<'tcx>) -> Expectation<'tcx> { match fcx.tcx.struct_tail(ty).sty { - ty::TySlice(_) | ty::TyStr | ty::TyDynamic(..) => { + ty::Slice(_) | ty::TyStr | ty::Dynamic(..) => { ExpectRvalueLikeUnsized(ty) } _ => ExpectHasType(ty) @@ -1137,7 +1137,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() { if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) { if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() { - if declared_ret_ty.sty != ty::TyNever { + if declared_ret_ty.sty != ty::Never { fcx.tcx.sess.span_err( decl.output.span(), "return type should be `!`", @@ -1148,8 +1148,8 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, let span = fcx.tcx.hir.span(fn_id); if inputs.len() == 1 { let arg_is_panic_info = match inputs[0].sty { - ty::TyRef(region, ty, mutbl) => match ty.sty { - ty::TyAdt(ref adt, _) => { + ty::Ref(region, ty, mutbl) => match ty.sty { + ty::Adt(ref adt, _) => { adt.did == panic_info_did && mutbl == hir::Mutability::MutImmutable && *region != RegionKind::ReStatic @@ -1190,7 +1190,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() { if alloc_error_handler_did == fcx.tcx.hir.local_def_id(fn_id) { if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() { - if declared_ret_ty.sty != ty::TyNever { + if declared_ret_ty.sty != ty::Never { fcx.tcx.sess.span_err( decl.output.span(), "return type should be `!`", @@ -1201,7 +1201,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, let span = fcx.tcx.hir.span(fn_id); if inputs.len() == 1 { let arg_is_alloc_layout = match inputs[0].sty { - ty::TyAdt(ref adt, _) => { + ty::Adt(ref adt, _) => { adt.did == alloc_layout_did }, _ => false, @@ -1633,7 +1633,7 @@ fn check_representable<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId) { let t = tcx.type_of(def_id); match t.sty { - ty::TyAdt(def, substs) if def.is_struct() => { + ty::Adt(def, substs) if def.is_struct() => { let fields = &def.non_enum_variant().fields; if fields.is_empty() { span_err!(tcx.sess, sp, E0075, "SIMD vector cannot be empty"); @@ -1693,7 +1693,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return false; } match t.sty { - ty::TyAdt(def, substs) if def.is_struct() || def.is_union() => { + ty::Adt(def, substs) if def.is_struct() || def.is_union() => { if tcx.adt_def(def.did).repr.align > 0 { return true; } @@ -1702,7 +1702,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for field in &def.non_enum_variant().fields { let f = field.ty(tcx, substs); match f.sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { if check_packed_inner(tcx, def.did, stack) { return true; } @@ -1982,7 +1982,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn resolve_type_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> { debug!("resolve_type_vars_with_obligations(ty={:?})", ty); - // No TyInfer()? Nothing needs doing. + // No Infer()? Nothing needs doing. if !ty.has_infer_types() { debug!("resolve_type_vars_with_obligations: ty={:?}", ty); return ty; @@ -2331,7 +2331,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // feature(never_type) is enabled, unconstrained ints with i32, // unconstrained floats with f64. // Fallback becomes very dubious if we have encountered type-checking errors. - // In that case, fallback to TyError. + // In that case, fallback to Error. // The return value indicates whether fallback has occurred. fn fallback_if_possible(&self, ty: Ty<'tcx>) -> bool { use rustc::ty::error::UnconstrainedNumeric::Neither; @@ -2481,7 +2481,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut self_ty = adjusted_ty; if unsize { // We only unsize arrays here. - if let ty::TyArray(element_ty, _) = adjusted_ty.sty { + if let ty::Array(element_ty, _) = adjusted_ty.sty { self_ty = self.tcx.mk_slice(element_ty); } else { continue; @@ -2500,7 +2500,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let method = self.register_infer_ok_obligations(ok); let mut adjustments = autoderef.adjust_steps(needs); - if let ty::TyRef(region, _, r_mutbl) = method.sig.inputs()[0].sty { + if let ty::Ref(region, _, r_mutbl) = method.sig.inputs()[0].sty { let mutbl = match r_mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, hir::MutMutable => AutoBorrowMutability::Mutable { @@ -2694,15 +2694,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let formal_tys = if tuple_arguments == TupleArguments { let tuple_type = self.structurally_resolved_type(sp, fn_inputs[0]); match tuple_type.sty { - ty::TyTuple(arg_types) if arg_types.len() != args.len() => { + ty::Tuple(arg_types) if arg_types.len() != args.len() => { param_count_error(arg_types.len(), args.len(), "E0057", false, false); expected_arg_tys = &[]; self.err_args(args.len()) } - ty::TyTuple(arg_types) => { + ty::Tuple(arg_types) => { expected_arg_tys = match expected_arg_tys.get(0) { Some(&ty) => match ty.sty { - ty::TyTuple(ref tys) => &tys, + ty::Tuple(ref tys) => &tys, _ => &[] }, None => &[] @@ -2840,7 +2840,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::TyUint(ast::UintTy::U8) | ty::TyUint(ast::UintTy::U16) => { variadic_error(tcx.sess, arg.span, arg_ty, "c_uint"); } - ty::TyFnDef(..) => { + ty::FnDef(..) => { let ptr_ty = self.tcx.mk_fn_ptr(arg_ty.fn_sig(self.tcx)); let ptr_ty = self.resolve_type_vars_if_possible(&ptr_ty); variadic_error(tcx.sess, arg.span, arg_ty, &ptr_ty.to_string()); @@ -2878,8 +2878,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match ty.sty { ty::TyInt(_) | ty::TyUint(_) => Some(ty), ty::TyChar => Some(tcx.types.u8), - ty::TyRawPtr(..) => Some(tcx.types.usize), - ty::TyFnDef(..) | ty::TyFnPtr(_) => Some(tcx.types.usize), + ty::RawPtr(..) => Some(tcx.types.usize), + ty::FnDef(..) | ty::FnPtr(_) => Some(tcx.types.usize), _ => None } }); @@ -3179,7 +3179,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut autoderef = self.autoderef(expr.span, expr_t); while let Some((base_t, _)) = autoderef.next() { match base_t.sty { - ty::TyAdt(base_def, substs) if !base_def.is_enum() => { + ty::Adt(base_def, substs) if !base_def.is_enum() => { debug!("struct named {:?}", base_t); let (ident, def_scope) = self.tcx.adjust_ident(field, base_def.did, self.body_id); @@ -3201,7 +3201,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { private_candidate = Some((base_def.did, field_ty)); } } - ty::TyTuple(ref tys) => { + ty::Tuple(ref tys) => { let fstr = field.as_str(); if let Ok(index) = fstr.parse::() { if fstr == index.to_string() { @@ -3246,7 +3246,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut err = self.no_such_field_err(field.span, field, expr_t); match expr_t.sty { - ty::TyAdt(def, _) if !def.is_enum() => { + ty::Adt(def, _) if !def.is_enum() => { if let Some(suggested_field_name) = Self::suggest_field_name(def.non_enum_variant(), &field.as_str(), vec![]) { @@ -3262,7 +3262,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }; } - ty::TyRawPtr(..) => { + ty::RawPtr(..) => { let base = self.tcx.hir.node_to_pretty_string(base.id); let msg = format!("`{}` is a native pointer; try dereferencing it", base); let suggestion = format!("(*{}).{}", base, field); @@ -3336,7 +3336,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut err = self.type_error_struct_with_diag( field.ident.span, |actual| match ty.sty { - ty::TyAdt(adt, ..) if adt.is_enum() => { + ty::Adt(adt, ..) if adt.is_enum() => { struct_span_err!(self.tcx.sess, field.ident.span, E0559, "{} `{}::{}` has no field named `{}`", kind_name, actual, variant.name, field.ident) @@ -3357,7 +3357,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { format!("field does not exist - did you mean `{}`?", field_name)); } else { match ty.sty { - ty::TyAdt(adt, ..) => { + ty::Adt(adt, ..) => { if adt.is_enum() { err.span_label(field.ident.span, format!("`{}::{}` does not have this field", @@ -3395,7 +3395,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.demand_eqtype(span, adt_ty_hint, adt_ty); let (substs, adt_kind, kind_name) = match &adt_ty.sty{ - &ty::TyAdt(adt, substs) => { + &ty::Adt(adt, substs) => { (substs, adt.adt_kind(), adt.variant_descr()) } _ => span_bug!(span, "non-ADT passed to check_expr_struct_fields") @@ -3520,7 +3520,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } Def::Variant(..) => { match ty.sty { - ty::TyAdt(adt, substs) => { + ty::Adt(adt, substs) => { Some((adt.variant_of_def(def), adt.did, substs)) } _ => bug!("unexpected type: {:?}", ty.sty) @@ -3529,7 +3529,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Def::Struct(..) | Def::Union(..) | Def::TyAlias(..) | Def::AssociatedTy(..) | Def::SelfTy(..) => { match ty.sty { - ty::TyAdt(adt, substs) if !adt.is_enum() => { + ty::Adt(adt, substs) if !adt.is_enum() => { Some((adt.non_enum_variant(), adt.did, substs)) } _ => None, @@ -3578,7 +3578,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; // Prohibit struct expressions when non exhaustive flag is set. - if let ty::TyAdt(adt, _) = struct_ty.sty { + if let ty::Adt(adt, _) = struct_ty.sty { if !adt.did.is_local() && adt.is_non_exhaustive() { span_err!(self.tcx.sess, expr.span, E0639, "cannot create non-exhaustive {} using struct expression", @@ -3595,7 +3595,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !error_happened { self.check_expr_has_type_or_error(base_expr, struct_ty); match struct_ty.sty { - ty::TyAdt(adt, substs) if adt.is_struct() => { + ty::Adt(adt, substs) if adt.is_struct() => { let fru_field_types = adt.non_enum_variant().fields.iter().map(|f| { self.normalize_associated_types_in(expr.span, &f.ty(self.tcx, substs)) }).collect(); @@ -3625,7 +3625,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// strict, _|_ can appear in the type of an expression that does not, /// itself, diverge: for example, fn() -> _|_.) /// Note that inspecting a type's structure *directly* may expose the fact - /// that there are actually multiple representations for `TyError`, so avoid + /// that there are actually multiple representations for `Error`, so avoid /// that when err needs to be handled differently. fn check_expr_with_expectation_and_needs(&self, expr: &'gcx hir::Expr, @@ -3684,7 +3684,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::Box(ref subexpr) => { let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| { match ty.sty { - ty::TyAdt(def, _) if def.is_box() + ty::Adt(def, _) if def.is_box() => Expectation::rvalue_hint(self, ty.boxed_ty()), _ => NoExpectation } @@ -3728,7 +3728,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else if let Some(ok) = self.try_overloaded_deref( expr.span, oprnd_t, needs) { let method = self.register_infer_ok_obligations(ok); - if let ty::TyRef(region, _, mutbl) = method.sig.inputs()[0].sty { + if let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].sty { let mutbl = match mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, hir::MutMutable => AutoBorrowMutability::Mutable { @@ -3773,7 +3773,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::AddrOf(mutbl, ref oprnd) => { let hint = expected.only_has_type(self).map_or(NoExpectation, |ty| { match ty.sty { - ty::TyRef(_, ty, _) | ty::TyRawPtr(ty::TypeAndMut { ty, .. }) => { + ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => { if self.is_place_expr(&oprnd) { // Places may legitimately have unsized types. // For example, dereferences of a fat pointer and @@ -4086,7 +4086,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::Array(ref args) => { let uty = expected.to_option(self).and_then(|uty| { match uty.sty { - ty::TyArray(ty, _) | ty::TySlice(ty) => Some(ty), + ty::Array(ty, _) | ty::Slice(ty) => Some(ty), _ => None } }); @@ -4133,7 +4133,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let uty = match expected { ExpectHasType(uty) => { match uty.sty { - ty::TyArray(ty, _) | ty::TySlice(ty) => Some(ty), + ty::Array(ty, _) | ty::Slice(ty) => Some(ty), _ => None } } @@ -4165,7 +4165,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if element_ty.references_error() { tcx.types.err } else if let Ok(count) = count { - tcx.mk_ty(ty::TyArray(t, count)) + tcx.mk_ty(ty::Array(t, count)) } else { tcx.types.err } @@ -4174,7 +4174,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let flds = expected.only_has_type(self).and_then(|ty| { let ty = self.resolve_type_vars_with_obligations(ty); match ty.sty { - ty::TyTuple(ref flds) => Some(&flds[..]), + ty::Tuple(ref flds) => Some(&flds[..]), _ => None } }); @@ -4228,7 +4228,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "cannot index into a value of type `{}`", base_t); // Try to give some advice about indexing tuples. - if let ty::TyTuple(..) = base_t.sty { + if let ty::Tuple(..) = base_t.sty { let mut needs_note = true; // If the index is an integer, we can show the actual // fixed expression: @@ -5020,7 +5020,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If no type arguments were provided, we have to infer them. // This case also occurs as a result of some malformed input, e.g. // a lifetime argument being given instead of a type paramter. - // Using inference instead of `TyError` gives better error messages. + // Using inference instead of `Error` gives better error messages. self.var_for_def(span, param) } } @@ -5158,7 +5158,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let ty::TyParam(ty::ParamTy { idx, .. }) = leaf_ty.sty { debug!("Found use of ty param num {}", idx); types_used[idx as usize - own_counts.lifetimes] = true; - } else if let ty::TyError = leaf_ty.sty { + } else if let ty::Error = leaf_ty.sty { // If there is already another error, do not emit // an error for not using a type Parameter. assert!(tcx.sess.err_count() > 0); diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index b5e8fe2cd0b50..dd8c8a8102a88 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -13,7 +13,7 @@ use super::{FnCtxt, Needs}; use super::method::MethodCallee; use rustc::ty::{self, Ty, TypeFoldable}; -use rustc::ty::TyKind::{TyRef, TyAdt, TyStr, TyUint, TyNever, TyTuple, TyChar, TyArray}; +use rustc::ty::TyKind::{Ref, Adt, TyStr, TyUint, Never, Tuple, TyChar, Array}; use rustc::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::infer::type_variable::TypeVariableOrigin; use errors; @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Ok(method) => { let by_ref_binop = !op.node.is_by_value(); if is_assign == IsAssign::Yes || by_ref_binop { - if let ty::TyRef(region, _, mutbl) = method.sig.inputs()[0].sty { + if let ty::Ref(region, _, mutbl) = method.sig.inputs()[0].sty { let mutbl = match mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, hir::MutMutable => AutoBorrowMutability::Mutable { @@ -221,7 +221,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } if by_ref_binop { - if let ty::TyRef(region, _, mutbl) = method.sig.inputs()[1].sty { + if let ty::Ref(region, _, mutbl) = method.sig.inputs()[1].sty { let mutbl = match mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, hir::MutMutable => AutoBorrowMutability::Mutable { @@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { format!("cannot use `{}=` on type `{}`", op.node.as_str(), lhs_ty)); let mut suggested_deref = false; - if let TyRef(_, mut rty, _) = lhs_ty.sty { + if let Ref(_, mut rty, _) = lhs_ty.sty { if { !self.infcx.type_moves_by_default(self.param_env, rty, @@ -276,7 +276,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .is_ok() } { if let Ok(lstring) = source_map.span_to_snippet(lhs_expr.span) { - while let TyRef(_, rty_inner, _) = rty.sty { + while let Ref(_, rty_inner, _) = rty.sty { rty = rty_inner; } let msg = &format!( @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { op.node.as_str(), lhs_ty); let mut suggested_deref = false; - if let TyRef(_, mut rty, _) = lhs_ty.sty { + if let Ref(_, mut rty, _) = lhs_ty.sty { if { !self.infcx.type_moves_by_default(self.param_env, rty, @@ -344,7 +344,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .is_ok() } { if let Ok(lstring) = source_map.span_to_snippet(lhs_expr.span) { - while let TyRef(_, rty_inner, _) = rty.sty { + while let Ref(_, rty_inner, _) = rty.sty { rty = rty_inner; } let msg = &format!( @@ -429,7 +429,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If this function returns true it means a note was printed, so we don't need // to print the normal "implementation of `std::ops::Add` might be missing" note match (&lhs_ty.sty, &rhs_ty.sty) { - (&TyRef(_, l_ty, _), &TyRef(_, r_ty, _)) + (&Ref(_, l_ty, _), &Ref(_, r_ty, _)) if l_ty.sty == TyStr && r_ty.sty == TyStr => { if !is_assign { err.span_label(expr.span, @@ -443,7 +443,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } true } - (&TyRef(_, l_ty, _), &TyAdt(..)) + (&Ref(_, l_ty, _), &Adt(..)) if l_ty.sty == TyStr && &format!("{:?}", rhs_ty) == "std::string::String" => { err.span_label(expr.span, "`+` can't be used to concatenate a `&str` with a `String`"); @@ -492,8 +492,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { TyUint(_) if op == hir::UnNeg => { err.note("unsigned values cannot be negated"); }, - TyStr | TyNever | TyChar | TyTuple(_) | TyArray(_,_) => {}, - TyRef(_, ref lty, _) if lty.sty == TyStr => {}, + TyStr | Never | TyChar | Tuple(_) | Array(_,_) => {}, + Ref(_, ref lty, _) if lty.sty == TyStr => {}, _ => { let missing_trait = match op { hir::UnNeg => "std::ops::Neg", diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 6af939fcf99b7..7401609998d15 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -589,7 +589,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { // For overloaded derefs, base_ty is the input to `Deref::deref`, // but it's a reference type uing the same region as the output. let base_ty = self.resolve_expr_type_adjusted(base); - if let ty::TyRef(r_ptr, _, _) = base_ty.sty { + if let ty::Ref(r_ptr, _, _) = base_ty.sty { self.mk_subregion_due_to_dereference(expr.span, expr_region, r_ptr); } @@ -702,22 +702,22 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { from_ty, to_ty); match (&from_ty.sty, &to_ty.sty) { - /*From:*/ (&ty::TyRef(from_r, from_ty, _), - /*To: */ &ty::TyRef(to_r, to_ty, _)) => { + /*From:*/ (&ty::Ref(from_r, from_ty, _), + /*To: */ &ty::Ref(to_r, to_ty, _)) => { // Target cannot outlive source, naturally. self.sub_regions(infer::Reborrow(cast_expr.span), to_r, from_r); self.walk_cast(cast_expr, from_ty, to_ty); } /*From:*/ (_, - /*To: */ &ty::TyDynamic(.., r)) => { + /*To: */ &ty::Dynamic(.., r)) => { // When T is existentially quantified as a trait // `Foo+'to`, it must outlive the region bound `'to`. self.type_must_outlive(infer::RelateObjectBound(cast_expr.span), from_ty, r); } - /*From:*/ (&ty::TyAdt(from_def, _), - /*To: */ &ty::TyAdt(to_def, _)) if from_def.is_box() && to_def.is_box() => { + /*From:*/ (&ty::Adt(from_def, _), + /*To: */ &ty::Adt(to_def, _)) if from_def.is_box() && to_def.is_box() => { self.walk_cast(cast_expr, from_ty.boxed_ty(), to_ty.boxed_ty()); } @@ -736,7 +736,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { fn constrain_callee(&mut self, callee_expr: &hir::Expr) { let callee_ty = self.resolve_node_type(callee_expr.hir_id); match callee_ty.sty { - ty::TyFnDef(..) | ty::TyFnPtr(_) => { } + ty::FnDef(..) | ty::FnPtr(_) => { } _ => { // this should not happen, but it does if the program is // erroneous @@ -914,9 +914,9 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { self.ty_to_string(indexed_ty)); let r_index_expr = ty::ReScope(region::Scope::Node(index_expr.hir_id.local_id)); - if let ty::TyRef(r_ptr, r_ty, _) = indexed_ty.sty { + if let ty::Ref(r_ptr, r_ty, _) = indexed_ty.sty { match r_ty.sty { - ty::TySlice(_) | ty::TyStr => { + ty::Slice(_) | ty::TyStr => { self.sub_regions(infer::IndexSlice(index_expr.span), self.tcx.mk_region(r_index_expr), r_ptr); } @@ -1089,7 +1089,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { id, mutbl, cmt_borrowed); let rptr_ty = self.resolve_node_type(id); - if let ty::TyRef(r, _, _) = rptr_ty.sty { + if let ty::Ref(r, _, _) = rptr_ty.sty { debug!("rptr_ty={}", rptr_ty); self.link_region(span, r, ty::BorrowKind::from_mutbl(mutbl), cmt_borrowed); } diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 61fe90be21774..41df937980ff3 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -109,9 +109,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Extract the type of the closure. let (closure_def_id, substs) = match self.node_ty(closure_hir_id).sty { - ty::TyClosure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)), - ty::TyGenerator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)), - ty::TyError => { + ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)), + ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)), + ty::Error => { // #51714: skip analysis when we have already encountered type errors return; } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 4b609779540f0..54b295601ea5e 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -576,7 +576,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( ty.fold_with(&mut ty::fold::BottomUpFolder { tcx: fcx.tcx, fldop: |ty| { - if let ty::TyAnon(def_id, substs) = ty.sty { + if let ty::Anon(def_id, substs) = ty.sty { trace!("check_existential_types: anon_ty, {:?}, {:?}", def_id, substs); let generics = tcx.generics_of(def_id); // only check named existential types @@ -674,7 +674,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( } } } // if is_named_existential_type - } // if let TyAnon + } // if let Anon ty }, reg_op: |reg| reg, diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index e87183f847321..2550d414bc096 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -174,7 +174,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { match tables.expr_ty_adjusted(&base).sty { // All valid indexing looks like this - ty::TyRef(_, base_ty, _) => { + ty::Ref(_, base_ty, _) => { let index_ty = tables.expr_ty_adjusted(&index); let index_ty = self.fcx.resolve_type_vars_if_possible(&index_ty); diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index ba65d0606b372..d01e7dbdfefe5 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -55,7 +55,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { match tcx.type_of(impl_did).sty { - ty::TyAdt(..) => {} + ty::Adt(..) => {} _ => { // Destructors only work on nominal types. if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_did) { @@ -217,23 +217,23 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, (mt_a.ty, mt_b.ty, unsize_trait, None) }; let (source, target, trait_def_id, kind) = match (&source.sty, &target.sty) { - (&ty::TyRef(r_a, ty_a, mutbl_a), &ty::TyRef(r_b, ty_b, mutbl_b)) => { + (&ty::Ref(r_a, ty_a, mutbl_a), &ty::Ref(r_b, ty_b, mutbl_b)) => { infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a); let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a }; let mt_b = ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b }; check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ref(r_b, ty)) } - (&ty::TyRef(_, ty_a, mutbl_a), &ty::TyRawPtr(mt_b)) => { + (&ty::Ref(_, ty_a, mutbl_a), &ty::RawPtr(mt_b)) => { let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a }; check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ptr(ty)) } - (&ty::TyRawPtr(mt_a), &ty::TyRawPtr(mt_b)) => { + (&ty::RawPtr(mt_a), &ty::RawPtr(mt_b)) => { check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ptr(ty)) } - (&ty::TyAdt(def_a, substs_a), &ty::TyAdt(def_b, substs_b)) if def_a.is_struct() && + (&ty::Adt(def_a, substs_a), &ty::Adt(def_b, substs_b)) if def_a.is_struct() && def_b.is_struct() => { if def_a != def_b { let source_path = gcx.item_path_str(def_a.did); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index f37167d1f6688..f3433b7c9db32 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -102,13 +102,13 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { let self_ty = self.tcx.type_of(def_id); let lang_items = self.tcx.lang_items(); match self_ty.sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { self.check_def_id(item, def.did); } ty::TyForeign(did) => { self.check_def_id(item, did); } - ty::TyDynamic(ref data, ..) if data.principal().is_some() => { + ty::Dynamic(ref data, ..) if data.principal().is_some() => { self.check_def_id(item, data.principal().unwrap().def_id()); } ty::TyChar => { @@ -127,7 +127,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { "str", item.span); } - ty::TySlice(slice_item) if slice_item == self.tcx.types.u8 => { + ty::Slice(slice_item) if slice_item == self.tcx.types.u8 => { self.check_primitive_impl(def_id, lang_items.slice_u8_impl(), lang_items.slice_u8_alloc_impl(), @@ -135,7 +135,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { "[u8]", item.span); } - ty::TySlice(_) => { + ty::Slice(_) => { self.check_primitive_impl(def_id, lang_items.slice_impl(), lang_items.slice_alloc_impl(), @@ -143,7 +143,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { "[T]", item.span); } - ty::TyRawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutImmutable }) => { + ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutImmutable }) => { self.check_primitive_impl(def_id, lang_items.const_ptr_impl(), None, @@ -151,7 +151,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { "*const T", item.span); } - ty::TyRawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutMutable }) => { + ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutMutable }) => { self.check_primitive_impl(def_id, lang_items.mut_ptr_impl(), None, @@ -271,7 +271,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { "f64", item.span); } - ty::TyError => { + ty::Error => { return; } _ => { diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 1b04c5da59b28..168cf47fb5266 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -157,7 +157,7 @@ fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeI tcx.specialization_graph_of(trait_def_id); // check for overlap with the automatic `impl Trait for Trait` - if let ty::TyDynamic(ref data, ..) = trait_ref.self_ty().sty { + if let ty::Dynamic(ref data, ..) = trait_ref.self_ty().sty { // This is something like impl Trait1 for Trait2. Illegal // if Trait1 is a supertrait of Trait2 or Trait2 is not object safe. diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 4a3747017dfc1..1dad6b722dc31 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -114,7 +114,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { !trait_def_id.is_local() { let self_ty = trait_ref.self_ty(); let opt_self_def_id = match self_ty.sty { - ty::TyAdt(self_def, _) => Some(self_def.did), + ty::Adt(self_def, _) => Some(self_def.did), ty::TyForeign(did) => Some(did), _ => None, }; diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 5f55b9b06ef1b..20bbc475e7dc9 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -62,7 +62,7 @@ struct ParameterCollector { impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { fn visit_ty(&mut self, t: Ty<'tcx>) -> bool { match t.sty { - ty::TyProjection(..) | ty::TyAnon(..) if !self.include_nonconstraining => { + ty::Projection(..) | ty::Anon(..) if !self.include_nonconstraining => { // projections are not injective return false; } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 62f93ea20e48c..eddbac3f5417b 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -185,7 +185,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let main_def_id = tcx.hir.local_def_id(main_id); let main_t = tcx.type_of(main_def_id); match main_t.sty { - ty::TyFnDef(..) => { + ty::FnDef(..) => { match tcx.hir.find(main_id) { Some(hir_map::NodeItem(it)) => { match it.node { @@ -257,7 +257,7 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let start_def_id = tcx.hir.local_def_id(start_id); let start_t = tcx.type_of(start_def_id); match start_t.sty { - ty::TyFnDef(..) => { + ty::FnDef(..) => { match tcx.hir.find(start_id) { Some(hir_map::NodeItem(it)) => { match it.node { diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index e378f1a2dce36..ec36fa0fbc145 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -85,7 +85,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { // Calculating the predicate requirements necessary // for item_did. // - // For field of type &'a T (reference) or TyAdt + // For field of type &'a T (reference) or Adt // (struct/enum/union) there will be outlive // requirements for adt_def. let field_ty = self.tcx.type_of(field_def.did); @@ -138,16 +138,16 @@ fn insert_required_predicates_to_be_wf<'tcx>( // a predicate requirement of T: 'a (T outlives 'a). // // We also want to calculate potential predicates for the T - ty::TyRef(region, rty, _) => { - debug!("TyRef"); + ty::Ref(region, rty, _) => { + debug!("Ref"); insert_outlives_predicate(tcx, rty.into(), region, required_predicates); } - // For each TyAdt (struct/enum/union) type `Foo<'a, T>`, we + // For each Adt (struct/enum/union) type `Foo<'a, T>`, we // can load the current set of inferred and explicit // predicates from `global_inferred_outlives` and filter the // ones that are TypeOutlives. - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { // First check the inferred predicates // // Example 1: @@ -166,7 +166,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( // round we will get `U: 'b`. We then apply the substitution // `['b => 'a, U => T]` and thus get the requirement that `T: // 'a` holds for `Foo`. - debug!("TyAdt"); + debug!("Adt"); if let Some(unsubstituted_predicates) = global_inferred_outlives.get(&def.did) { for unsubstituted_predicate in unsubstituted_predicates { // `unsubstituted_predicate` is `U: 'b` in the @@ -195,7 +195,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( ); } - ty::TyDynamic(obj, ..) => { + ty::Dynamic(obj, ..) => { // This corresponds to `dyn Trait<..>`. In this case, we should // use the explicit predicates as well. @@ -204,7 +204,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( // `dyn Trait` at this stage. Therefore when checking explicit // predicates in `check_explicit_predicates` we need to ignore // checking the explicit_map for Self type. - debug!("TyDynamic"); + debug!("Dynamic"); debug!("field_ty = {}", &field_ty); debug!("ty in field = {}", &ty); if let Some(ex_trait_ref) = obj.principal() { @@ -219,10 +219,10 @@ fn insert_required_predicates_to_be_wf<'tcx>( } } - ty::TyProjection(obj) => { + ty::Projection(obj) => { // This corresponds to `>::Bar`. In this case, we should use the // explicit predicates as well. - debug!("TyProjection"); + debug!("Projection"); check_explicit_predicates( tcx, &tcx.associated_item(obj.item_def_id).container.id(), diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 9fecf5e73e761..83f94e2de08fd 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -152,7 +152,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { let inferred_start = self.terms_cx.inferred_starts[&id]; let current_item = &CurrentItem { inferred_start }; match tcx.type_of(def_id).sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { // Not entirely obvious: constraints on structs/enums do not // affect the variance of their type parameters. See discussion // in comment at top of module. @@ -166,7 +166,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { } } - ty::TyFnDef(..) => { + ty::FnDef(..) => { self.add_constraints_from_sig(current_item, tcx.fn_sig(def_id), self.covariant); @@ -262,51 +262,51 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { match ty.sty { ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | - ty::TyStr | ty::TyNever | ty::TyForeign(..) => { + ty::TyStr | ty::Never | ty::TyForeign(..) => { // leaf type -- noop } - ty::TyFnDef(..) | - ty::TyGenerator(..) | - ty::TyClosure(..) => { + ty::FnDef(..) | + ty::Generator(..) | + ty::Closure(..) => { bug!("Unexpected closure type in variance computation"); } - ty::TyRef(region, ty, mutbl) => { + ty::Ref(region, ty, mutbl) => { let contra = self.contravariant(variance); self.add_constraints_from_region(current, region, contra); self.add_constraints_from_mt(current, &ty::TypeAndMut { ty, mutbl }, variance); } - ty::TyArray(typ, _) | - ty::TySlice(typ) => { + ty::Array(typ, _) | + ty::Slice(typ) => { self.add_constraints_from_ty(current, typ, variance); } - ty::TyRawPtr(ref mt) => { + ty::RawPtr(ref mt) => { self.add_constraints_from_mt(current, mt, variance); } - ty::TyTuple(subtys) => { + ty::Tuple(subtys) => { for &subty in subtys { self.add_constraints_from_ty(current, subty, variance); } } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { self.add_constraints_from_substs(current, def.did, substs, variance); } - ty::TyProjection(ref data) => { + ty::Projection(ref data) => { let tcx = self.tcx(); self.add_constraints_from_trait_ref(current, data.trait_ref(tcx), variance); } - ty::TyAnon(_, substs) => { + ty::Anon(_, substs) => { self.add_constraints_from_invariant_substs(current, substs, variance); } - ty::TyDynamic(ref data, r) => { + ty::Dynamic(ref data, r) => { // The type `Foo` is contravariant w/r/t `'a`: let contra = self.contravariant(variance); self.add_constraints_from_region(current, r, contra); @@ -327,17 +327,17 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraint(current, data.idx, variance); } - ty::TyFnPtr(sig) => { + ty::FnPtr(sig) => { self.add_constraints_from_sig(current, sig, variance); } - ty::TyError => { + ty::Error => { // we encounter this when walking the trait references for object - // types, where we use TyError as the Self type + // types, where we use Error as the Self type } - ty::TyGeneratorWitness(..) | - ty::TyInfer(..) => { + ty::GeneratorWitness(..) | + ty::Infer(..) => { bug!("unexpected type encountered in \ variance inference: {}", ty); diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index 340a7b1d08ede..7116a42cead83 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -101,7 +101,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> { debug!("id={} variances={:?}", id, variances); // Functions can have unused type parameters: make those invariant. - if let ty::TyFnDef(..) = tcx.type_of(def_id).sty { + if let ty::FnDef(..) = tcx.type_of(def_id).sty { for variance in &mut variances { if *variance == ty::Bivariant { *variance = ty::Invariant; diff --git a/src/librustdoc/clean/def_ctor.rs b/src/librustdoc/clean/def_ctor.rs index 4db211b7f1e70..57ddc09f32d94 100644 --- a/src/librustdoc/clean/def_ctor.rs +++ b/src/librustdoc/clean/def_ctor.rs @@ -20,7 +20,7 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec { let ty = cx.tcx.type_of(def_id); match ty.sty { - ty::TyAdt(adt, _) => callback(&match adt.adt_kind() { + ty::Adt(adt, _) => callback(&match adt.adt_kind() { AdtKind::Struct => Def::Struct, AdtKind::Enum => Def::Enum, AdtKind::Union => Def::Union, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 6cb37c0e6de14..25b83e08011f4 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1077,7 +1077,7 @@ fn external_generic_args(cx: &DocContext, trait_did: Option, has_self: bo Some(did) if cx.tcx.lang_items().fn_trait_kind(did).is_some() => { assert_eq!(types.len(), 1); let inputs = match types[0].sty { - ty::TyTuple(ref tys) => tys.iter().map(|t| t.clean(cx)).collect(), + ty::Tuple(ref tys) => tys.iter().map(|t| t.clean(cx)).collect(), _ => { return GenericArgs::AngleBracketed { lifetimes, @@ -1089,7 +1089,7 @@ fn external_generic_args(cx: &DocContext, trait_did: Option, has_self: bo let output = None; // FIXME(#20299) return type comes from a projection now // match types[1].sty { - // ty::TyTuple(ref v) if v.is_empty() => None, // -> () + // ty::Tuple(ref v) if v.is_empty() => None, // -> () // _ => Some(types[1].clean(cx)) // }; GenericArgs::Parenthesized { @@ -1133,9 +1133,9 @@ impl<'a, 'tcx> Clean for (&'a ty::TraitRef<'tcx>, Vec // collect any late bound regions let mut late_bounds = vec![]; for ty_s in trait_ref.input_types().skip(1) { - if let ty::TyTuple(ts) = ty_s.sty { + if let ty::Tuple(ts) = ty_s.sty { for &ty_s in ts { - if let ty::TyRef(ref reg, _, _) = ty_s.sty { + if let ty::Ref(ref reg, _, _) = ty_s.sty { if let &ty::RegionKind::ReLateBound(..) = *reg { debug!(" hit an ReLateBound {:?}", reg); if let Some(Lifetime(name)) = reg.clean(cx) { @@ -1979,7 +1979,7 @@ impl<'tcx> Clean for ty::AssociatedItem { let self_arg_ty = *sig.input(0).skip_binder(); if self_arg_ty == self_ty { decl.inputs.values[0].type_ = Generic(String::from("Self")); - } else if let ty::TyRef(_, ty, _) = self_arg_ty.sty { + } else if let ty::Ref(_, ty, _) = self_arg_ty.sty { if ty == self_ty { match decl.inputs.values[0].type_ { BorrowedRef{ref mut type_, ..} => { @@ -2506,7 +2506,7 @@ impl Clean for hir::Ty { TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => { let mut def = Def::Err; let ty = hir_ty_to_ty(cx.tcx, self); - if let ty::TyProjection(proj) = ty.sty { + if let ty::Projection(proj) = ty.sty { def = Def::Trait(proj.trait_ref(cx.tcx).def_id); } let trait_path = hir::Path { @@ -2545,15 +2545,15 @@ impl Clean for hir::Ty { impl<'tcx> Clean for Ty<'tcx> { fn clean(&self, cx: &DocContext) -> Type { match self.sty { - ty::TyNever => Never, + ty::Never => Never, ty::TyBool => Primitive(PrimitiveType::Bool), ty::TyChar => Primitive(PrimitiveType::Char), ty::TyInt(int_ty) => Primitive(int_ty.into()), ty::TyUint(uint_ty) => Primitive(uint_ty.into()), ty::TyFloat(float_ty) => Primitive(float_ty.into()), ty::TyStr => Primitive(PrimitiveType::Str), - ty::TySlice(ty) => Slice(box ty.clean(cx)), - ty::TyArray(ty, n) => { + ty::Slice(ty) => Slice(box ty.clean(cx)), + ty::Array(ty, n) => { let mut n = cx.tcx.lift(&n).expect("array lift failed"); if let ConstValue::Unevaluated(def_id, substs) = n.val { let param_env = cx.tcx.param_env(def_id); @@ -2568,15 +2568,15 @@ impl<'tcx> Clean for Ty<'tcx> { let n = print_const(cx, n); Array(box ty.clean(cx), n) } - ty::TyRawPtr(mt) => RawPointer(mt.mutbl.clean(cx), box mt.ty.clean(cx)), - ty::TyRef(r, ty, mutbl) => BorrowedRef { + ty::RawPtr(mt) => RawPointer(mt.mutbl.clean(cx), box mt.ty.clean(cx)), + ty::Ref(r, ty, mutbl) => BorrowedRef { lifetime: r.clean(cx), mutability: mutbl.clean(cx), type_: box ty.clean(cx), }, - ty::TyFnDef(..) | - ty::TyFnPtr(_) => { - let ty = cx.tcx.lift(self).expect("TyFnPtr lift failed"); + ty::FnDef(..) | + ty::FnPtr(_) => { + let ty = cx.tcx.lift(self).expect("FnPtr lift failed"); let sig = ty.fn_sig(cx.tcx); BareFunction(box BareFunctionDecl { unsafety: sig.unsafety(), @@ -2585,7 +2585,7 @@ impl<'tcx> Clean for Ty<'tcx> { abi: sig.abi(), }) } - ty::TyAdt(def, substs) => { + ty::Adt(def, substs) => { let did = def.did; let kind = match def.adt_kind() { AdtKind::Struct => TypeKind::Struct, @@ -2613,7 +2613,7 @@ impl<'tcx> Clean for Ty<'tcx> { is_generic: false, } } - ty::TyDynamic(ref obj, ref reg) => { + ty::Dynamic(ref obj, ref reg) => { if let Some(principal) = obj.principal() { let did = principal.def_id(); inline::record_extern_fqn(cx, did, TypeKind::Trait); @@ -2657,17 +2657,17 @@ impl<'tcx> Clean for Ty<'tcx> { Never } } - ty::TyTuple(ref t) => Tuple(t.clean(cx)), + ty::Tuple(ref t) => Tuple(t.clean(cx)), - ty::TyProjection(ref data) => data.clean(cx), + ty::Projection(ref data) => data.clean(cx), ty::TyParam(ref p) => Generic(p.name.to_string()), - ty::TyAnon(def_id, substs) => { + ty::Anon(def_id, substs) => { // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`, // by looking up the projections associated with the def_id. let predicates_of = cx.tcx.predicates_of(def_id); - let substs = cx.tcx.lift(&substs).expect("TyAnon lift failed"); + let substs = cx.tcx.lift(&substs).expect("Anon lift failed"); let bounds = predicates_of.instantiate(cx.tcx, substs); let mut regions = vec![]; let mut has_sized = false; @@ -2717,11 +2717,11 @@ impl<'tcx> Clean for Ty<'tcx> { ImplTrait(bounds) } - ty::TyClosure(..) | ty::TyGenerator(..) => Tuple(vec![]), // FIXME(pcwalton) + ty::Closure(..) | ty::Generator(..) => Tuple(vec![]), // FIXME(pcwalton) - ty::TyGeneratorWitness(..) => panic!("TyGeneratorWitness"), - ty::TyInfer(..) => panic!("TyInfer"), - ty::TyError => panic!("TyError"), + ty::GeneratorWitness(..) => panic!("GeneratorWitness"), + ty::Infer(..) => panic!("Infer"), + ty::Error => panic!("Error"), } } } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index c00d67aaab6b4..64efea4f42f85 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -149,7 +149,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> LinkCollector<'a, 'tcx, 'rcx, 'cstore> { Ok((ty.def, Some(format!("{}.{}", out, item_name)))) } else { match cx.tcx.type_of(did).sty { - ty::TyAdt(def, _) => { + ty::Adt(def, _) => { if let Some(item) = if def.is_enum() { def.all_fields().find(|item| item.ident.name == item_name) } else { diff --git a/src/test/run-pass/auxiliary/issue13507.rs b/src/test/run-pass/auxiliary/issue13507.rs index dee40b2fc5735..e8f1a0826d61f 100644 --- a/src/test/run-pass/auxiliary/issue13507.rs +++ b/src/test/run-pass/auxiliary/issue13507.rs @@ -50,25 +50,25 @@ pub mod testtypes { // Tests TyStr pub type FooStr = str; - // Tests TyArray + // Tests Array pub type FooArray = [u8; 1]; - // Tests TySlice + // Tests Slice pub type FooSlice = [u8]; // Tests Box (of u8) pub type FooBox = Box; - // Tests TyRawPtr + // Tests RawPtr pub type FooPtr = *const u8; - // Tests TyRef + // Tests Ref pub type FooRef = &'static u8; - // Tests TyFnPtr + // Tests FnPtr pub type FooFnPtr = fn(u8) -> bool; - // Tests TyDynamic + // Tests Dynamic pub trait FooTrait { fn foo_method(&self) -> usize; } @@ -85,13 +85,13 @@ pub mod testtypes { VarB(usize, usize) } - // Tests TyTuple + // Tests Tuple pub type FooNil = (); pub type FooTuple = (u8, i8, bool); // Skipping TyParam - // Skipping TyInfer + // Skipping Infer - // Skipping TyError + // Skipping Error } diff --git a/src/test/run-pass/unboxed-closures-unique-type-id.rs b/src/test/run-pass/unboxed-closures-unique-type-id.rs index 40071ec9754e2..c95885518ea2f 100644 --- a/src/test/run-pass/unboxed-closures-unique-type-id.rs +++ b/src/test/run-pass/unboxed-closures-unique-type-id.rs @@ -12,7 +12,7 @@ // // error: internal compiler error: get_unique_type_id_of_type() - // unexpected type: closure, -// TyClosure(syntax::ast::DefId{krate: 0, node: 66}, +// Closure(syntax::ast::DefId{krate: 0, node: 66}, // ReScope(63)) // // This is a regression test for issue #17021.