1
Fork 0

Remove Ty prefix from Ty{Foreign|Param}

This commit is contained in:
varkor 2018-08-22 01:35:29 +01:00
parent 6f637da50c
commit 04fa5d3adb
68 changed files with 160 additions and 160 deletions

View file

@ -53,13 +53,13 @@ pub enum Def {
Existential(DefId), Existential(DefId),
/// `type Foo = Bar;` /// `type Foo = Bar;`
TyAlias(DefId), TyAlias(DefId),
TyForeign(DefId), Foreign(DefId),
TraitAlias(DefId), TraitAlias(DefId),
AssociatedTy(DefId), AssociatedTy(DefId),
/// `existential type Foo: Bar;` /// `existential type Foo: Bar;`
AssociatedExistential(DefId), AssociatedExistential(DefId),
PrimTy(hir::PrimTy), PrimTy(hir::PrimTy),
TyParam(DefId), Param(DefId),
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */), SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]` ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]`
@ -269,10 +269,10 @@ impl Def {
Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) | Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) |
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) | Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) |
Def::TyAlias(id) | Def::TraitAlias(id) | Def::TyAlias(id) | Def::TraitAlias(id) |
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) | Def::AssociatedTy(id) | Def::Param(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) | Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
Def::AssociatedConst(id) | Def::Macro(id, ..) | Def::AssociatedConst(id) | Def::Macro(id, ..) |
Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => { Def::Existential(id) | Def::AssociatedExistential(id) | Def::Foreign(id) => {
id id
} }
@ -311,11 +311,11 @@ impl Def {
Def::StructCtor(.., CtorKind::Fictive) => bug!("impossible struct constructor"), Def::StructCtor(.., CtorKind::Fictive) => bug!("impossible struct constructor"),
Def::Union(..) => "union", Def::Union(..) => "union",
Def::Trait(..) => "trait", Def::Trait(..) => "trait",
Def::TyForeign(..) => "foreign type", Def::Foreign(..) => "foreign type",
Def::Method(..) => "method", Def::Method(..) => "method",
Def::Const(..) => "constant", Def::Const(..) => "constant",
Def::AssociatedConst(..) => "associated constant", Def::AssociatedConst(..) => "associated constant",
Def::TyParam(..) => "type parameter", Def::Param(..) => "type parameter",
Def::PrimTy(..) => "builtin type", Def::PrimTy(..) => "builtin type",
Def::Local(..) => "local variable", Def::Local(..) => "local variable",
Def::Upvar(..) => "closure capture", Def::Upvar(..) => "closure capture",

View file

@ -1183,7 +1183,7 @@ impl<'a> LoweringContext<'a> {
} }
ImplTraitContext::Universal(in_band_ty_params) => { ImplTraitContext::Universal(in_band_ty_params) => {
self.lower_node_id(def_node_id); self.lower_node_id(def_node_id);
// Add a definition for the in-band TyParam // Add a definition for the in-band Param
let def_index = self let def_index = self
.resolver .resolver
.definitions() .definitions()
@ -1213,7 +1213,7 @@ impl<'a> LoweringContext<'a> {
None, None,
P(hir::Path { P(hir::Path {
span, span,
def: Def::TyParam(DefId::local(def_index)), def: Def::Param(DefId::local(def_index)),
segments: hir_vec![hir::PathSegment::from_ident(ident)], segments: hir_vec![hir::PathSegment::from_ident(ident)],
}), }),
)) ))
@ -2352,7 +2352,7 @@ impl<'a> LoweringContext<'a> {
if path.segments.len() == 1 if path.segments.len() == 1
&& bound_pred.bound_generic_params.is_empty() => && bound_pred.bound_generic_params.is_empty() =>
{ {
if let Some(Def::TyParam(def_id)) = self.resolver if let Some(Def::Param(def_id)) = self.resolver
.get_resolution(bound_pred.bounded_ty.id) .get_resolution(bound_pred.bounded_ty.id)
.map(|d| d.base_def()) .map(|d| d.base_def())
{ {

View file

@ -453,7 +453,7 @@ impl<'hir> Map<'hir> {
match item.node { match item.node {
ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)), ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)),
ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)), ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)),
ForeignItemKind::Type => Some(Def::TyForeign(def_id)), ForeignItemKind::Type => Some(Def::Foreign(def_id)),
} }
} }
NodeTraitItem(item) => { NodeTraitItem(item) => {
@ -499,7 +499,7 @@ impl<'hir> Map<'hir> {
NodeGenericParam(param) => { NodeGenericParam(param) => {
Some(match param.kind { Some(match param.kind {
GenericParamKind::Lifetime { .. } => Def::Local(param.id), GenericParamKind::Lifetime { .. } => Def::Local(param.id),
GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)), GenericParamKind::Type { .. } => Def::Param(self.local_def_id(param.id)),
}) })
} }
} }

View file

@ -1010,9 +1010,9 @@ impl_stable_hash_for!(enum hir::def::Def {
AssociatedTy(def_id), AssociatedTy(def_id),
AssociatedExistential(def_id), AssociatedExistential(def_id),
PrimTy(prim_ty), PrimTy(prim_ty),
TyParam(def_id), Param(def_id),
SelfTy(trait_def_id, impl_def_id), SelfTy(trait_def_id, impl_def_id),
TyForeign(def_id), Foreign(def_id),
Fn(def_id), Fn(def_id),
Const(def_id), Const(def_id),
Static(def_id, is_mutbl), Static(def_id, is_mutbl),

View file

@ -874,10 +874,10 @@ for ty::TyKind<'gcx>
def_id.hash_stable(hcx, hasher); def_id.hash_stable(hcx, hasher);
substs.hash_stable(hcx, hasher); substs.hash_stable(hcx, hasher);
} }
TyParam(param_ty) => { Param(param_ty) => {
param_ty.hash_stable(hcx, hasher); param_ty.hash_stable(hcx, hasher);
} }
TyForeign(def_id) => { Foreign(def_id) => {
def_id.hash_stable(hcx, hasher); def_id.hash_stable(hcx, hasher);
} }
Infer(infer_ty) => { Infer(infer_ty) => {

View file

@ -283,8 +283,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
| ty::Never | ty::Never
| ty::Tuple(..) | ty::Tuple(..)
| ty::Projection(..) | ty::Projection(..)
| ty::TyForeign(..) | ty::Foreign(..)
| ty::TyParam(..) | ty::Param(..)
| ty::Anon(..) => { | ty::Anon(..) => {
if t.flags.intersects(self.needs_canonical_flags) { if t.flags.intersects(self.needs_canonical_flags) {
t.super_fold_with(self) t.super_fold_with(self)

View file

@ -1123,7 +1123,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let type_param = generics.type_param(param, self.tcx); let type_param = generics.type_param(param, self.tcx);
let hir = &self.tcx.hir; let hir = &self.tcx.hir;
hir.as_local_node_id(type_param.def_id).map(|id| { hir.as_local_node_id(type_param.def_id).map(|id| {
// Get the `hir::TyParam` to verify whether it already has any bounds. // Get the `hir::Param` to verify whether it already has any bounds.
// We do this to avoid suggesting code that ends up as `T: 'a'b`, // We do this to avoid suggesting code that ends up as `T: 'a'b`,
// instead we suggest `T: 'a + 'b` in that case. // instead we suggest `T: 'a + 'b` in that case.
let mut has_bounds = false; let mut has_bounds = false;

View file

@ -193,8 +193,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
ty::Never | ty::Never |
ty::Tuple(..) | ty::Tuple(..) |
ty::Projection(..) | ty::Projection(..) |
ty::TyForeign(..) | ty::Foreign(..) |
ty::TyParam(..) | ty::Param(..) |
ty::Closure(..) | ty::Closure(..) |
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) |
ty::Anon(..) => { ty::Anon(..) => {

View file

@ -450,7 +450,7 @@ where
fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> { fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
match ty.sty { match ty.sty {
ty::TyParam(p) => self.param_bound(p), ty::Param(p) => self.param_bound(p),
ty::Projection(data) => { ty::Projection(data) => {
let declared_bounds = self.projection_declared_bounds(data); let declared_bounds = self.projection_declared_bounds(data);
self.projection_bound(declared_bounds, data) self.projection_bound(declared_bounds, data)

View file

@ -1326,7 +1326,7 @@ fn object_lifetime_defaults_for_item(
_ => continue, _ => continue,
}; };
if def == Def::TyParam(param_def_id) { if def == Def::Param(param_def_id) {
add_bounds(&mut set, &data.bounds); add_bounds(&mut set, &data.bounds);
} }
} }

View file

@ -606,7 +606,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
} }
return match substs.type_at(0).sty { return match substs.type_at(0).sty {
ty::TyParam(_) => true, ty::Param(_) => true,
ty::Projection(p) => self.is_of_param(p.substs), ty::Projection(p) => self.is_of_param(p.substs),
_ => false, _ => false,
}; };

View file

@ -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 { fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool {
match ty.sty { match ty.sty {
ty::Projection(..) | ty::TyParam(..) => true, ty::Projection(..) | ty::Param(..) => true,
_ => false, _ => false,
} }
} }
@ -455,7 +455,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
ty::Ref(..) | ty::Ref(..) |
ty::Never | ty::Never |
ty::Tuple(..) | ty::Tuple(..) |
ty::TyParam(..) | ty::Param(..) |
ty::Projection(..) => { ty::Projection(..) => {
false false
} }
@ -468,7 +468,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
}, },
ty::Adt(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::Foreign(did) => def_id_is_local(did, in_crate),
ty::Dynamic(ref tt, ..) => { ty::Dynamic(ref tt, ..) => {
tt.principal().map_or(false, |p| { tt.principal().map_or(false, |p| {

View file

@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
ty::Closure(..) => Some(9), ty::Closure(..) => Some(9),
ty::Tuple(..) => Some(10), ty::Tuple(..) => Some(10),
ty::Projection(..) => Some(11), ty::Projection(..) => Some(11),
ty::TyParam(..) => Some(12), ty::Param(..) => Some(12),
ty::Anon(..) => Some(13), ty::Anon(..) => Some(13),
ty::Never => Some(14), ty::Never => Some(14),
ty::Adt(adt, ..) => match adt.adt_kind() { ty::Adt(adt, ..) => match adt.adt_kind() {
@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
AdtKind::Enum => Some(17), AdtKind::Enum => Some(17),
}, },
ty::Generator(..) => Some(18), ty::Generator(..) => Some(18),
ty::TyForeign(..) => Some(19), ty::Foreign(..) => Some(19),
ty::GeneratorWitness(..) => Some(20), ty::GeneratorWitness(..) => Some(20),
ty::Infer(..) | ty::Error => None ty::Infer(..) | ty::Error => None
} }
@ -785,7 +785,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let found_did = match found_trait_ty.sty { let found_did = match found_trait_ty.sty {
ty::Closure(did, _) | ty::Closure(did, _) |
ty::TyForeign(did) | ty::Foreign(did) |
ty::FnDef(did, _) => Some(did), ty::FnDef(did, _) => Some(did),
ty::Adt(def, _) => Some(def.did), ty::Adt(def, _) => Some(def.did),
_ => None, _ => None,
@ -1348,7 +1348,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx } fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx }
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
if let ty::TyParam(ty::ParamTy {name, ..}) = ty.sty { if let ty::Param(ty::ParamTy {name, ..}) = ty.sty {
let infcx = self.infcx; let infcx = self.infcx;
self.var_map.entry(ty).or_insert_with(|| self.var_map.entry(ty).or_insert_with(||
infcx.next_ty_var( infcx.next_ty_var(

View file

@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let mut error = false; let mut error = false;
ty.maybe_walk(|ty| { ty.maybe_walk(|ty| {
match ty.sty { match ty.sty {
ty::TyParam(ref param_ty) => { ty::Param(ref param_ty) => {
if param_ty.is_self() { if param_ty.is_self() {
error = true; error = true;
} }

View file

@ -228,7 +228,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
| ty::RawPtr(_) | ty::RawPtr(_)
| ty::Ref(..) | ty::Ref(..)
| ty::TyStr | ty::TyStr
| ty::TyForeign(..) | ty::Foreign(..)
| ty::Error => true, | ty::Error => true,
// [T; N] and [T] have same properties as T. // [T; N] and [T] have same properties as T.
@ -257,7 +257,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
// The following *might* require a destructor: it would deeper inspection to tell. // The following *might* require a destructor: it would deeper inspection to tell.
ty::Dynamic(..) ty::Dynamic(..)
| ty::Projection(..) | ty::Projection(..)
| ty::TyParam(_) | ty::Param(_)
| ty::Anon(..) | ty::Anon(..)
| ty::Infer(_) | ty::Infer(_)
| ty::Generator(..) => false, | ty::Generator(..) => false,

View file

@ -1810,13 +1810,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// say nothing; a candidate may be added by // say nothing; a candidate may be added by
// `assemble_candidates_from_object_ty`. // `assemble_candidates_from_object_ty`.
} }
ty::TyForeign(..) => { ty::Foreign(..) => {
// Since the contents of foreign types is unknown, // Since the contents of foreign types is unknown,
// we don't add any `..` impl. Default traits could // we don't add any `..` impl. Default traits could
// still be provided by a manual implementation for // still be provided by a manual implementation for
// this trait and type. // this trait and type.
} }
ty::TyParam(..) | ty::Param(..) |
ty::Projection(..) => { ty::Projection(..) => {
// In these cases, we don't know what the actual // In these cases, we don't know what the actual
// type is. Therefore, we cannot break it down // type is. Therefore, we cannot break it down
@ -2189,7 +2189,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
Where(ty::Binder::dummy(Vec::new())) Where(ty::Binder::dummy(Vec::new()))
} }
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => None, ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
ty::Tuple(tys) => { ty::Tuple(tys) => {
Where(ty::Binder::bind(tys.last().into_iter().cloned().collect())) Where(ty::Binder::bind(tys.last().into_iter().cloned().collect()))
@ -2203,7 +2203,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
)) ))
} }
ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => None, ty::Projection(_) | ty::Param(_) | ty::Anon(..) => None,
ty::Infer(ty::TyVar(_)) => Ambiguous, ty::Infer(ty::TyVar(_)) => Ambiguous,
ty::Infer(ty::CanonicalTy(_)) | ty::Infer(ty::CanonicalTy(_)) |
@ -2239,7 +2239,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
} }
ty::Dynamic(..) | ty::TyStr | ty::Slice(..) | ty::Dynamic(..) | ty::TyStr | ty::Slice(..) |
ty::Generator(..) | ty::GeneratorWitness(..) | ty::TyForeign(..) | ty::Generator(..) | ty::GeneratorWitness(..) | ty::Foreign(..) |
ty::Ref(_, _, hir::MutMutable) => { ty::Ref(_, _, hir::MutMutable) => {
None None
} }
@ -2265,7 +2265,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
} }
} }
ty::Adt(..) | ty::Projection(..) | ty::TyParam(..) | ty::Anon(..) => { ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Anon(..) => {
// Fallback to whatever user-defined impls exist in this case. // Fallback to whatever user-defined impls exist in this case.
None None
} }
@ -2316,8 +2316,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
} }
ty::Dynamic(..) | ty::Dynamic(..) |
ty::TyParam(..) | ty::Param(..) |
ty::TyForeign(..) | ty::Foreign(..) |
ty::Projection(..) | ty::Projection(..) |
ty::Infer(ty::CanonicalTy(_)) | ty::Infer(ty::CanonicalTy(_)) |
ty::Infer(ty::TyVar(_)) | ty::Infer(ty::TyVar(_)) |
@ -3072,7 +3072,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
let mut ty_params = BitArray::new(substs_a.types().count()); let mut ty_params = BitArray::new(substs_a.types().count());
let mut found = false; let mut found = false;
for ty in field.walk() { for ty in field.walk() {
if let ty::TyParam(p) = ty.sty { if let ty::Param(p) = ty.sty {
ty_params.insert(p.idx as usize); ty_params.insert(p.idx as usize);
found = true; found = true;
} }

View file

@ -90,7 +90,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
.unwrap() .unwrap()
.subst(infcx.tcx, &source_substs); .subst(infcx.tcx, &source_substs);
// translate the Self and TyParam parts of the substitution, since those // translate the Self and Param parts of the substitution, since those
// vary across impls // vary across impls
let target_substs = match target_node { let target_substs = match target_node {
specialization_graph::Node::Impl(target_impl) => { specialization_graph::Node::Impl(target_impl) => {

View file

@ -2078,7 +2078,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
self, self,
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
Generator, GeneratorWitness, Dynamic, Closure, Tuple, Generator, GeneratorWitness, Dynamic, Closure, Tuple,
TyParam, Infer, Projection, Anon, TyForeign); Param, Infer, Projection, Anon, Foreign);
println!("Substs interner: #{}", self.interners.substs.borrow().len()); println!("Substs interner: #{}", self.interners.substs.borrow().len());
println!("Region interner: #{}", self.interners.region.borrow().len()); println!("Region interner: #{}", self.interners.region.borrow().len());
@ -2387,7 +2387,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
} }
pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> { pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> {
self.mk_ty(TyForeign(def_id)) self.mk_ty(Foreign(def_id))
} }
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> { pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
@ -2532,7 +2532,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn mk_ty_param(self, pub fn mk_ty_param(self,
index: u32, index: u32,
name: InternedString) -> Ty<'tcx> { name: InternedString) -> Ty<'tcx> {
self.mk_ty(TyParam(ParamTy { idx: index, name: name })) self.mk_ty(Param(ParamTy { idx: index, name: name }))
} }
pub fn mk_self_type(self) -> Ty<'tcx> { pub fn mk_self_type(self) -> Ty<'tcx> {

View file

@ -180,7 +180,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
ty::Tuple(ref tys) if tys.is_empty() => self.to_string(), ty::Tuple(ref tys) if tys.is_empty() => self.to_string(),
ty::Adt(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::Foreign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)),
ty::Array(_, n) => { ty::Array(_, n) => {
match n.assert_usize(tcx) { match n.assert_usize(tcx) {
Some(n) => format!("array of {} elements", n), Some(n) => format!("array of {} elements", n),
@ -222,7 +222,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(), ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(),
ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(), ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(),
ty::Projection(_) => "associated type".to_string(), ty::Projection(_) => "associated type".to_string(),
ty::TyParam(ref p) => { ty::Param(ref p) => {
if p.is_self() { if p.is_self() {
"Self".to_string() "Self".to_string()
} else { } else {

View file

@ -103,7 +103,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
ty::FnPtr(ref f) => { ty::FnPtr(ref f) => {
Some(FunctionSimplifiedType(f.skip_binder().inputs().len())) Some(FunctionSimplifiedType(f.skip_binder().inputs().len()))
} }
ty::Projection(_) | ty::TyParam(_) => { ty::Projection(_) | ty::Param(_) => {
if can_simplify_params { if can_simplify_params {
// In normalized types, projections don't unify with // In normalized types, projections don't unify with
// anything. when lazy normalization happens, this // anything. when lazy normalization happens, this
@ -118,7 +118,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
ty::Anon(def_id, _) => { ty::Anon(def_id, _) => {
Some(AnonSimplifiedType(def_id)) Some(AnonSimplifiedType(def_id))
} }
ty::TyForeign(def_id) => { ty::Foreign(def_id) => {
Some(ForeignSimplifiedType(def_id)) Some(ForeignSimplifiedType(def_id))
} }
ty::Infer(_) | ty::Error => None, ty::Infer(_) | ty::Error => None,

View file

@ -76,7 +76,7 @@ impl FlagComputation {
&ty::TyUint(_) | &ty::TyUint(_) |
&ty::Never | &ty::Never |
&ty::TyStr | &ty::TyStr |
&ty::TyForeign(..) => { &ty::Foreign(..) => {
} }
// You might think that we could just return Error for // You might think that we could just return Error for
@ -90,7 +90,7 @@ impl FlagComputation {
self.add_flags(TypeFlags::HAS_TY_ERR) self.add_flags(TypeFlags::HAS_TY_ERR)
} }
&ty::TyParam(ref p) => { &ty::Param(ref p) => {
self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES); self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES);
if p.is_self() { if p.is_self() {
self.add_flags(TypeFlags::HAS_SELF); self.add_flags(TypeFlags::HAS_SELF);

View file

@ -307,7 +307,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
} }
} }
ty::TyForeign(did) => self.push_item_path(buffer, did), ty::Foreign(did) => self.push_item_path(buffer, did),
ty::TyBool | ty::TyBool |
ty::TyChar | ty::TyChar |
@ -375,7 +375,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
ty::FnDef(def_id, _) | ty::FnDef(def_id, _) |
ty::Closure(def_id, _) | ty::Closure(def_id, _) |
ty::Generator(def_id, _, _) | ty::Generator(def_id, _, _) |
ty::TyForeign(def_id) => Some(def_id), ty::Foreign(def_id) => Some(def_id),
ty::TyBool | ty::TyBool |
ty::TyChar | ty::TyChar |
@ -384,7 +384,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
ty::TyStr | ty::TyStr |
ty::FnPtr(_) | ty::FnPtr(_) |
ty::Projection(_) | ty::Projection(_) |
ty::TyParam(_) | ty::Param(_) |
ty::Anon(..) | ty::Anon(..) |
ty::Infer(_) | ty::Infer(_) |
ty::Error | ty::Error |

View file

@ -521,7 +521,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
let unsized_part = tcx.struct_tail(pointee); let unsized_part = tcx.struct_tail(pointee);
let metadata = match unsized_part.sty { let metadata = match unsized_part.sty {
ty::TyForeign(..) => { ty::Foreign(..) => {
return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr))); return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr)));
} }
ty::Slice(_) | ty::TyStr => { ty::Slice(_) | ty::TyStr => {
@ -594,7 +594,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
ty::FnDef(..) => { ty::FnDef(..) => {
univariant(&[], &ReprOptions::default(), StructKind::AlwaysSized)? univariant(&[], &ReprOptions::default(), StructKind::AlwaysSized)?
} }
ty::Dynamic(..) | ty::TyForeign(..) => { ty::Dynamic(..) | ty::Foreign(..) => {
let mut unit = univariant_uninterned(&[], &ReprOptions::default(), let mut unit = univariant_uninterned(&[], &ReprOptions::default(),
StructKind::AlwaysSized)?; StructKind::AlwaysSized)?;
match unit.abi { match unit.abi {
@ -1113,7 +1113,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
ty::GeneratorWitness(..) | ty::Infer(_) => { ty::GeneratorWitness(..) | ty::Infer(_) => {
bug!("LayoutDetails::compute: unexpected type `{}`", ty) bug!("LayoutDetails::compute: unexpected type `{}`", ty)
} }
ty::TyParam(_) | ty::Error => { ty::Param(_) | ty::Error => {
return Err(LayoutError::Unknown(ty)); return Err(LayoutError::Unknown(ty));
} }
}) })
@ -1299,7 +1299,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
let non_zero = !ty.is_unsafe_ptr(); let non_zero = !ty.is_unsafe_ptr();
let tail = tcx.struct_tail(pointee); let tail = tcx.struct_tail(pointee);
match tail.sty { match tail.sty {
ty::TyParam(_) | ty::Projection(_) => { ty::Param(_) | ty::Projection(_) => {
debug_assert!(tail.has_param_types() || tail.has_self_ty()); debug_assert!(tail.has_param_types() || tail.has_self_ty());
Ok(SizeSkeleton::Pointer { Ok(SizeSkeleton::Pointer {
non_zero, non_zero,
@ -1591,7 +1591,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
ty::Never | ty::Never |
ty::FnDef(..) | ty::FnDef(..) |
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) |
ty::TyForeign(..) | ty::Foreign(..) |
ty::Dynamic(..) => { ty::Dynamic(..) => {
bug!("TyLayout::field_type({:?}): not applicable", this) bug!("TyLayout::field_type({:?}): not applicable", this)
} }
@ -1686,7 +1686,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
} }
} }
ty::Projection(_) | ty::Anon(..) | ty::TyParam(_) | ty::Projection(_) | ty::Anon(..) | ty::Param(_) |
ty::Infer(_) | ty::Error => { ty::Infer(_) | ty::Error => {
bug!("TyLayout::field_type: unexpected type `{}`", this.ty) bug!("TyLayout::field_type: unexpected type `{}`", this.ty)
} }

View file

@ -2239,7 +2239,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
TyStr | TyStr |
Dynamic(..) | Dynamic(..) |
Slice(_) | Slice(_) |
TyForeign(..) | Foreign(..) |
Error | Error |
GeneratorWitness(..) => { GeneratorWitness(..) => {
// these are never sized - return the target type // these are never sized - return the target type
@ -2270,7 +2270,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
vec![ty] vec![ty]
} }
TyParam(..) => { Param(..) => {
// perf hack: if there is a `T: Sized` bound, then // perf hack: if there is a `T: Sized` bound, then
// we know that `T` is Sized and do not need to check // we know that `T` is Sized and do not need to check
// it on the impl. // it on the impl.

View file

@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
// OutlivesTypeParameterEnv -- the actual checking that `X:'a` // OutlivesTypeParameterEnv -- the actual checking that `X:'a`
// is implied by the environment is done in regionck. // is implied by the environment is done in regionck.
ty::TyParam(p) => { ty::Param(p) => {
out.push(Component::Param(p)); out.push(Component::Param(p));
} }
@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
ty::Never | // ... ty::Never | // ...
ty::Adt(..) | // OutlivesNominalType ty::Adt(..) | // OutlivesNominalType
ty::Anon(..) | // OutlivesNominalType (ish) ty::Anon(..) | // OutlivesNominalType (ish)
ty::TyForeign(..) | // OutlivesNominalType ty::Foreign(..) | // OutlivesNominalType
ty::TyStr | // OutlivesScalar (ish) ty::TyStr | // OutlivesScalar (ish)
ty::Array(..) | // ... ty::Array(..) | // ...
ty::Slice(..) | // ... ty::Slice(..) | // ...

View file

@ -387,7 +387,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
Ok(a) Ok(a)
} }
(&ty::TyParam(ref a_p), &ty::TyParam(ref b_p)) (&ty::Param(ref a_p), &ty::Param(ref b_p))
if a_p.idx == b_p.idx => if a_p.idx == b_p.idx =>
{ {
Ok(a) Ok(a)
@ -400,7 +400,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
Ok(tcx.mk_adt(a_def, substs)) Ok(tcx.mk_adt(a_def, substs))
} }
(&ty::TyForeign(a_id), &ty::TyForeign(b_id)) (&ty::Foreign(a_id), &ty::Foreign(b_id))
if a_id == b_id => if a_id == b_id =>
{ {
Ok(tcx.mk_foreign(a_id)) Ok(tcx.mk_foreign(a_id))

View file

@ -862,7 +862,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)), ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)),
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) |
ty::TyParam(..) | ty::Never | ty::TyForeign(..) => return self ty::Param(..) | ty::Never | ty::Foreign(..) => return self
}; };
if self.sty == sty { if self.sty == sty {
@ -897,7 +897,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
ty::Anon(_, ref substs) => substs.visit_with(visitor), ty::Anon(_, ref substs) => substs.visit_with(visitor),
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) | ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) |
ty::TyParam(..) | ty::Never | ty::TyForeign(..) => false, ty::Param(..) | ty::Never | ty::Foreign(..) => false,
} }
} }

View file

@ -101,13 +101,13 @@ pub enum TyKind<'tcx> {
/// Structures, enumerations and unions. /// Structures, enumerations and unions.
/// ///
/// Substs here, possibly against intuition, *may* contain `TyParam`s. /// Substs here, possibly against intuition, *may* contain `Param`s.
/// That is, even after substitution it is possible that there are type /// That is, even after substitution it is possible that there are type
/// variables. This happens when the `Adt` corresponds to an ADT /// variables. This happens when the `Adt` corresponds to an ADT
/// definition and not a concrete use of it. /// definition and not a concrete use of it.
Adt(&'tcx AdtDef, &'tcx Substs<'tcx>), Adt(&'tcx AdtDef, &'tcx Substs<'tcx>),
TyForeign(DefId), Foreign(DefId),
/// The pointee of a string slice. Written as `str`. /// The pointee of a string slice. Written as `str`.
TyStr, TyStr,
@ -166,7 +166,7 @@ pub enum TyKind<'tcx> {
Anon(DefId, &'tcx Substs<'tcx>), Anon(DefId, &'tcx Substs<'tcx>),
/// A type parameter; for example, `T` in `fn f<T>(x: T) {} /// A type parameter; for example, `T` in `fn f<T>(x: T) {}
TyParam(ParamTy), Param(ParamTy),
/// A type variable used during type-checking. /// A type variable used during type-checking.
Infer(InferTy), Infer(InferTy),
@ -1058,7 +1058,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
/// the likes of `liberate_late_bound_regions`. The distinction exists /// the likes of `liberate_late_bound_regions`. The distinction exists
/// because higher-ranked lifetimes aren't supported in all places. See [1][2]. /// because higher-ranked lifetimes aren't supported in all places. See [1][2].
/// ///
/// Unlike TyParam-s, bound regions are not supposed to exist "in the wild" /// Unlike Param-s, bound regions are not supposed to exist "in the wild"
/// outside their binder, e.g. in types passed to type inference, and /// outside their binder, e.g. in types passed to type inference, and
/// should first be substituted (by skolemized regions, free regions, /// should first be substituted (by skolemized regions, free regions,
/// or region variables). /// or region variables).
@ -1514,14 +1514,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_param(&self, index: u32) -> bool { pub fn is_param(&self, index: u32) -> bool {
match self.sty { match self.sty {
ty::TyParam(ref data) => data.idx == index, ty::Param(ref data) => data.idx == index,
_ => false, _ => false,
} }
} }
pub fn is_self(&self) -> bool { pub fn is_self(&self) -> bool {
match self.sty { match self.sty {
TyParam(ref p) => p.is_self(), Param(ref p) => p.is_self(),
_ => false, _ => false,
} }
} }
@ -1714,7 +1714,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn has_concrete_skeleton(&self) -> bool { pub fn has_concrete_skeleton(&self) -> bool {
match self.sty { match self.sty {
TyParam(_) | Infer(_) | Error => false, Param(_) | Infer(_) | Error => false,
_ => true, _ => true,
} }
} }
@ -1815,8 +1815,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
RawPtr(_) | RawPtr(_) |
Never | Never |
Tuple(..) | Tuple(..) |
TyForeign(..) | Foreign(..) |
TyParam(_) | Param(_) |
Infer(_) | Infer(_) |
Error => { Error => {
vec![] vec![]
@ -1867,7 +1867,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
ty::Never | ty::Error => ty::Never | ty::Error =>
true, true,
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) =>
false, false,
ty::Tuple(tys) => ty::Tuple(tys) =>
@ -1876,7 +1876,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
ty::Adt(def, _substs) => ty::Adt(def, _substs) =>
def.sized_constraint(tcx).is_empty(), def.sized_constraint(tcx).is_empty(),
ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => false, ty::Projection(_) | ty::Param(_) | ty::Anon(..) => false,
ty::Infer(ty::TyVar(_)) => false, ty::Infer(ty::TyVar(_)) => false,

View file

@ -449,7 +449,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
self.ty_stack_depth += 1; self.ty_stack_depth += 1;
let t1 = match t.sty { let t1 = match t.sty {
ty::TyParam(p) => { ty::Param(p) => {
self.ty_for_param(p, t) self.ty_for_param(p, t)
} }
_ => { _ => {

View file

@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
!impl_generics.region_param(ebr, self).pure_wrt_drop !impl_generics.region_param(ebr, self).pure_wrt_drop
} }
UnpackedKind::Type(&ty::TyS { UnpackedKind::Type(&ty::TyS {
sty: ty::TyKind::TyParam(ref pt), .. sty: ty::TyKind::Param(ref pt), ..
}) => { }) => {
!impl_generics.type_param(pt, self).pure_wrt_drop !impl_generics.type_param(pt, self).pure_wrt_drop
} }
@ -930,7 +930,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
ty::RawPtr(_) | ty::Ref(..) | ty::TyStr => false, ty::RawPtr(_) | ty::Ref(..) | ty::TyStr => false,
// Foreign types can never have destructors // Foreign types can never have destructors
ty::TyForeign(..) => false, ty::Foreign(..) => false,
// `ManuallyDrop` doesn't have a destructor regardless of field types. // `ManuallyDrop` doesn't have a destructor regardless of field types.
ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false,
@ -955,7 +955,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Can refer to a type which may drop. // Can refer to a type which may drop.
// FIXME(eddyb) check this against a ParamEnv. // FIXME(eddyb) check this against a ParamEnv.
ty::Dynamic(..) | ty::Projection(..) | ty::TyParam(_) | ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) |
ty::Anon(..) | ty::Infer(_) | ty::Error => true, ty::Anon(..) | ty::Infer(_) | ty::Error => true,
// Structural recursion. // Structural recursion.

View file

@ -82,8 +82,8 @@ pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> AccIntoIter<TypeWalkerArray<'tcx>> {
fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
match parent_ty.sty { match parent_ty.sty {
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
ty::TyStr | ty::Infer(_) | ty::TyParam(_) | ty::Never | ty::Error | ty::TyStr | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error |
ty::TyForeign(..) => { ty::Foreign(..) => {
} }
ty::Array(ty, len) => { ty::Array(ty, len) => {
push_const(stack, len); push_const(stack, len);

View file

@ -257,8 +257,8 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
ty::TyStr | ty::TyStr |
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) |
ty::Never | ty::Never |
ty::TyParam(_) | ty::Param(_) |
ty::TyForeign(..) => { ty::Foreign(..) => {
// WfScalar, WfParameter, etc // WfScalar, WfParameter, etc
} }

View file

@ -16,8 +16,8 @@ use ty::subst::{self, Subst};
use ty::{BrAnon, BrEnv, BrFresh, BrNamed}; use ty::{BrAnon, BrEnv, BrFresh, BrNamed};
use ty::{TyBool, TyChar, Adt}; use ty::{TyBool, TyChar, Adt};
use ty::{Error, TyStr, Array, Slice, TyFloat, FnDef, FnPtr}; use ty::{Error, TyStr, Array, Slice, TyFloat, FnDef, FnPtr};
use ty::{TyParam, RawPtr, Ref, Never, Tuple}; use ty::{Param, RawPtr, Ref, Never, Tuple};
use ty::{Closure, Generator, GeneratorWitness, TyForeign, Projection, Anon}; use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Anon};
use ty::{Dynamic, TyInt, TyUint, Infer}; use ty::{Dynamic, TyInt, TyUint, Infer};
use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind};
use util::nodemap::FxHashSet; use util::nodemap::FxHashSet;
@ -1086,7 +1086,7 @@ define_print! {
} }
Infer(infer_ty) => write!(f, "{}", infer_ty), Infer(infer_ty) => write!(f, "{}", infer_ty),
Error => write!(f, "[type error]"), Error => write!(f, "[type error]"),
TyParam(ref param_ty) => write!(f, "{}", param_ty), Param(ref param_ty) => write!(f, "{}", param_ty),
Adt(def, substs) => cx.parameterized(f, substs, def.did, &[]), Adt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
Dynamic(data, r) => { Dynamic(data, r) => {
let r = r.print_to_string(cx); let r = r.print_to_string(cx);
@ -1101,7 +1101,7 @@ define_print! {
Ok(()) Ok(())
} }
} }
TyForeign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]), Foreign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]),
Projection(ref data) => data.print(f, cx), Projection(ref data) => data.print(f, cx),
Anon(def_id, substs) => { Anon(def_id, substs) => {
if cx.is_verbose { if cx.is_verbose {

View file

@ -434,7 +434,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
let tail = self.tcx.struct_tail(ty); let tail = self.tcx.struct_tail(ty);
match tail.sty { match tail.sty {
ty::TyForeign(..) => false, ty::Foreign(..) => false,
ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true, ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
_ => bug!("unexpected unsized tail: {:?}", tail.sty), _ => bug!("unexpected unsized tail: {:?}", tail.sty),
} }

View file

@ -585,7 +585,7 @@ pub fn type_metadata(
trait_pointer_metadata(cx, t, None, unique_type_id), trait_pointer_metadata(cx, t, None, unique_type_id),
false) false)
} }
ty::TyForeign(..) => { ty::Foreign(..) => {
MetadataCreationResult::new( MetadataCreationResult::new(
foreign_type_metadata(cx, t, unique_type_id), foreign_type_metadata(cx, t, unique_type_id),
false) false)

View file

@ -48,7 +48,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
ty::TyInt(int_ty) => output.push_str(int_ty.ty_to_string()), 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::TyUint(uint_ty) => output.push_str(uint_ty.ty_to_string()),
ty::TyFloat(float_ty) => output.push_str(float_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::Foreign(def_id) => push_item_name(cx, def_id, qualified, output),
ty::Adt(def, substs) => { ty::Adt(def, substs) => {
push_item_name(cx, def.did, qualified, output); push_item_name(cx, def.did, qualified, output);
push_type_params(cx, substs, output); push_type_params(cx, substs, output);
@ -176,7 +176,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
ty::Projection(..) | ty::Projection(..) |
ty::Anon(..) | ty::Anon(..) |
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) |
ty::TyParam(_) => { ty::Param(_) => {
bug!("debuginfo: Trying to create type name for \ bug!("debuginfo: Trying to create type name for \
unexpected type: {:?}", t); unexpected type: {:?}", t);
} }

View file

@ -211,7 +211,7 @@ impl PlaceRef<'ll, 'tcx> {
return simple(); return simple();
} }
_ if !field.is_unsized() => return simple(), _ if !field.is_unsized() => return simple(),
ty::Slice(..) | ty::TyStr | ty::TyForeign(..) => return simple(), ty::Slice(..) | ty::TyStr | ty::Foreign(..) => return simple(),
ty::Adt(def, _) => { ty::Adt(def, _) => {
if def.repr.packed() { if def.repr.packed() {
// FIXME(eddyb) generalize the adjustment when we // FIXME(eddyb) generalize the adjustment when we

View file

@ -62,7 +62,7 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
// FIXME(eddyb) producing readable type names for trait objects can result // FIXME(eddyb) producing readable type names for trait objects can result
// in problematically distinct types due to HRTB and subtyping (see #47638). // in problematically distinct types due to HRTB and subtyping (see #47638).
// ty::Dynamic(..) | // ty::Dynamic(..) |
ty::TyForeign(..) | ty::Foreign(..) |
ty::TyStr => { ty::TyStr => {
let mut name = String::with_capacity(32); let mut name = String::with_capacity(32);
let printer = DefPathBasedNames::new(cx.tcx, true, true); let printer = DefPathBasedNames::new(cx.tcx, true, true);

View file

@ -1510,7 +1510,7 @@ impl TypeAliasBounds {
match ty.node { match ty.node {
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => { hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
match path.def { match path.def {
Def::TyParam(_) => true, Def::Param(_) => true,
_ => false _ => false
} }
} }

View file

@ -712,9 +712,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
FfiSafe FfiSafe
} }
ty::TyForeign(..) => FfiSafe, ty::Foreign(..) => FfiSafe,
ty::TyParam(..) | ty::Param(..) |
ty::Infer(..) | ty::Infer(..) |
ty::Error | ty::Error |
ty::Closure(..) | ty::Closure(..) |

View file

@ -429,7 +429,7 @@ impl<'tcx> EntryKind<'tcx> {
EntryKind::Trait(_) => Def::Trait(did), EntryKind::Trait(_) => Def::Trait(did),
EntryKind::Enum(..) => Def::Enum(did), EntryKind::Enum(..) => Def::Enum(did),
EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang), EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
EntryKind::ForeignType => Def::TyForeign(did), EntryKind::ForeignType => Def::Foreign(did),
EntryKind::ForeignMod | EntryKind::ForeignMod |
EntryKind::GlobalAsm | EntryKind::GlobalAsm |

View file

@ -838,7 +838,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
} }
let tail = tcx.struct_tail(ty); let tail = tcx.struct_tail(ty);
match tail.sty { match tail.sty {
ty::TyForeign(..) => false, ty::Foreign(..) => false,
ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true, ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
_ => bug!("unexpected unsized tail: {:?}", tail.sty), _ => bug!("unexpected unsized tail: {:?}", tail.sty),
} }

View file

@ -327,7 +327,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
output); output);
} }
}, },
ty::TyForeign(did) => self.push_def_path(did, output), ty::Foreign(did) => self.push_def_path(did, output),
ty::FnDef(..) | ty::FnDef(..) |
ty::FnPtr(_) => { ty::FnPtr(_) => {
let sig = t.fn_sig(self.tcx); let sig = t.fn_sig(self.tcx);
@ -383,7 +383,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
ty::Error | ty::Error |
ty::Infer(_) | ty::Infer(_) |
ty::Projection(..) | ty::Projection(..) |
ty::TyParam(_) | ty::Param(_) |
ty::GeneratorWitness(_) | ty::GeneratorWitness(_) |
ty::Anon(..) => { ty::Anon(..) => {
bug!("DefPathBasedNames: Trying to create type name for \ bug!("DefPathBasedNames: Trying to create type name for \

View file

@ -90,7 +90,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> { fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> {
let ty_def_id = match self.tcx.type_of(item_def_id).sty { let ty_def_id = match self.tcx.type_of(item_def_id).sty {
ty::Adt(adt, _) => adt.did, ty::Adt(adt, _) => adt.did,
ty::TyForeign(did) => did, ty::Foreign(did) => did,
ty::Dynamic(ref obj, ..) if obj.principal().is_some() => ty::Dynamic(ref obj, ..) if obj.principal().is_some() =>
obj.principal().unwrap().def_id(), obj.principal().unwrap().def_id(),
ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id, ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id,
@ -471,7 +471,7 @@ impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
let ty_def_id = match ty.sty { let ty_def_id = match ty.sty {
ty::Adt(adt, _) => Some(adt.did), ty::Adt(adt, _) => Some(adt.did),
ty::TyForeign(did) => Some(did), ty::Foreign(did) => Some(did),
ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
ty::Projection(ref proj) => Some(proj.item_def_id), ty::Projection(ref proj) => Some(proj.item_def_id),
ty::FnDef(def_id, ..) | ty::FnDef(def_id, ..) |
@ -898,7 +898,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
match ty.sty { match ty.sty {
ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) |
ty::FnDef(def_id, ..) | ty::FnDef(def_id, ..) |
ty::TyForeign(def_id) => { ty::Foreign(def_id) => {
if !self.item_is_accessible(def_id) { if !self.item_is_accessible(def_id) {
let msg = format!("type `{}` is private", ty); let msg = format!("type `{}` is private", ty);
self.tcx.sess.span_err(self.span, &msg); self.tcx.sess.span_err(self.span, &msg);
@ -1435,7 +1435,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
let ty_def_id = match ty.sty { let ty_def_id = match ty.sty {
ty::Adt(adt, _) => Some(adt.did), ty::Adt(adt, _) => Some(adt.did),
ty::TyForeign(did) => Some(did), ty::Foreign(did) => Some(did),
ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()), ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
ty::Projection(ref proj) => { ty::Projection(ref proj) => {
if self.required_visibility == ty::Visibility::Invisible { if self.required_visibility == ty::Visibility::Invisible {

View file

@ -656,7 +656,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
(Def::Static(self.definitions.local_def_id(item.id), m), ValueNS) (Def::Static(self.definitions.local_def_id(item.id), m), ValueNS)
} }
ForeignItemKind::Ty => { ForeignItemKind::Ty => {
(Def::TyForeign(self.definitions.local_def_id(item.id)), TypeNS) (Def::Foreign(self.definitions.local_def_id(item.id)), TypeNS)
} }
ForeignItemKind::Macro(_) => unreachable!(), ForeignItemKind::Macro(_) => unreachable!(),
}; };
@ -692,7 +692,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
span); span);
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion)); self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
} }
Def::Variant(..) | Def::TyAlias(..) | Def::TyForeign(..) => { Def::Variant(..) | Def::TyAlias(..) | Def::Foreign(..) => {
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion)); self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
} }
Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => { Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => {

View file

@ -204,14 +204,14 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
"`Self` type implicitly declared here, on the `impl`"); "`Self` type implicitly declared here, on the `impl`");
} }
}, },
Def::TyParam(typaram_defid) => { Def::Param(typaram_defid) => {
if let Some(typaram_span) = resolver.definitions.opt_span(typaram_defid) { if let Some(typaram_span) = resolver.definitions.opt_span(typaram_defid) {
err.span_label(typaram_span, "type variable from outer function"); err.span_label(typaram_span, "type variable from outer function");
} }
}, },
_ => { _ => {
bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \ bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \
Def::TyParam") Def::Param")
} }
} }
@ -537,9 +537,9 @@ impl<'a> PathSource<'a> {
PathSource::Type => match def { PathSource::Type => match def {
Def::Struct(..) | Def::Union(..) | Def::Enum(..) | Def::Struct(..) | Def::Union(..) | Def::Enum(..) |
Def::Trait(..) | Def::TyAlias(..) | Def::AssociatedTy(..) | Def::Trait(..) | Def::TyAlias(..) | Def::AssociatedTy(..) |
Def::PrimTy(..) | Def::TyParam(..) | Def::SelfTy(..) | Def::PrimTy(..) | Def::Param(..) | Def::SelfTy(..) |
Def::Existential(..) | Def::Existential(..) |
Def::TyForeign(..) => true, Def::Foreign(..) => true,
_ => false, _ => false,
}, },
PathSource::Trait(AliasPossibility::No) => match def { PathSource::Trait(AliasPossibility::No) => match def {
@ -2359,7 +2359,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
seen_bindings.entry(ident).or_insert(param.ident.span); seen_bindings.entry(ident).or_insert(param.ident.span);
// Plain insert (no renaming). // Plain insert (no renaming).
let def = Def::TyParam(self.definitions.local_def_id(param.id)); let def = Def::Param(self.definitions.local_def_id(param.id));
function_type_rib.bindings.insert(ident, def); function_type_rib.bindings.insert(ident, def);
self.record_def(param.id, PathResolution::new(def)); self.record_def(param.id, PathResolution::new(def));
} }
@ -3765,7 +3765,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
} }
} }
} }
Def::TyParam(..) | Def::SelfTy(..) => { Def::Param(..) | Def::SelfTy(..) => {
for rib in ribs { for rib in ribs {
match rib.kind { match rib.kind {
NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) | NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) |

View file

@ -747,13 +747,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
HirDef::Union(def_id) | HirDef::Union(def_id) |
HirDef::Enum(def_id) | HirDef::Enum(def_id) |
HirDef::TyAlias(def_id) | HirDef::TyAlias(def_id) |
HirDef::TyForeign(def_id) | HirDef::Foreign(def_id) |
HirDef::TraitAlias(def_id) | HirDef::TraitAlias(def_id) |
HirDef::AssociatedExistential(def_id) | HirDef::AssociatedExistential(def_id) |
HirDef::AssociatedTy(def_id) | HirDef::AssociatedTy(def_id) |
HirDef::Trait(def_id) | HirDef::Trait(def_id) |
HirDef::Existential(def_id) | HirDef::Existential(def_id) |
HirDef::TyParam(def_id) => { HirDef::Param(def_id) => {
let span = self.span_from_span(sub_span); let span = self.span_from_span(sub_span);
Some(Ref { Some(Ref {
kind: RefKind::Type, kind: RefKind::Type,

View file

@ -119,7 +119,7 @@ fn dropck_outlives<'tcx>(
match ty.sty { match ty.sty {
// All parameters live for the duration of the // All parameters live for the duration of the
// function. // function.
ty::TyParam(..) => {} ty::Param(..) => {}
// A projection that we couldn't resolve - it // A projection that we couldn't resolve - it
// might have a destructor. // might have a destructor.
@ -180,7 +180,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
| ty::TyFloat(_) | ty::TyFloat(_)
| ty::TyStr | ty::TyStr
| ty::Never | ty::Never
| ty::TyForeign(..) | ty::Foreign(..)
| ty::RawPtr(..) | ty::RawPtr(..)
| ty::Ref(..) | ty::Ref(..)
| ty::FnDef(..) | ty::FnDef(..)
@ -266,7 +266,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
}), }),
// Types that can't be resolved. Pass them forward. // Types that can't be resolved. Pass them forward.
ty::Projection(..) | ty::Anon(..) | ty::TyParam(..) => Ok(DtorckConstraint { ty::Projection(..) | ty::Anon(..) | ty::Param(..) => Ok(DtorckConstraint {
outlives: vec![], outlives: vec![],
dtorck_types: vec![ty], dtorck_types: vec![ty],
overflows: vec![], overflows: vec![],

View file

@ -1239,8 +1239,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
Err(ErrorReported) => return (tcx.types.err, Def::Err), Err(ErrorReported) => return (tcx.types.err, Def::Err),
} }
} }
(&ty::TyParam(_), Def::SelfTy(Some(param_did), None)) | (&ty::Param(_), Def::SelfTy(Some(param_did), None)) |
(&ty::TyParam(_), Def::TyParam(param_did)) => { (&ty::Param(_), Def::Param(param_did)) => {
match self.find_bound_for_assoc_item(param_did, assoc_name, span) { match self.find_bound_for_assoc_item(param_did, assoc_name, span) {
Ok(bound) => bound, Ok(bound) => bound,
Err(ErrorReported) => return (tcx.types.err, Def::Err), Err(ErrorReported) => return (tcx.types.err, Def::Err),
@ -1387,7 +1387,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
) )
} }
Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) | Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) |
Def::Union(did) | Def::TyForeign(did) => { Def::Union(did) | Def::Foreign(did) => {
assert_eq!(opt_self_ty, None); assert_eq!(opt_self_ty, None);
self.prohibit_generics(path.segments.split_last().unwrap().1); self.prohibit_generics(path.segments.split_last().unwrap().1);
self.ast_path_to_ty(span, did, path.segments.last().unwrap()) self.ast_path_to_ty(span, did, path.segments.last().unwrap())
@ -1401,7 +1401,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
tcx.parent_def_id(did).unwrap(), tcx.parent_def_id(did).unwrap(),
path.segments.last().unwrap()) path.segments.last().unwrap())
} }
Def::TyParam(did) => { Def::Param(did) => {
assert_eq!(opt_self_ty, None); assert_eq!(opt_self_ty, None);
self.prohibit_generics(&path.segments); self.prohibit_generics(&path.segments);

View file

@ -121,11 +121,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}, },
// Pointers to foreign types are thin, despite being unsized // Pointers to foreign types are thin, despite being unsized
ty::TyForeign(..) => Some(PointerKind::Thin), ty::Foreign(..) => Some(PointerKind::Thin),
// We should really try to normalize here. // We should really try to normalize here.
ty::Projection(ref pi) => Some(PointerKind::OfProjection(pi)), ty::Projection(ref pi) => Some(PointerKind::OfProjection(pi)),
ty::Anon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)), ty::Anon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)),
ty::TyParam(ref p) => Some(PointerKind::OfParam(p)), ty::Param(ref p) => Some(PointerKind::OfParam(p)),
// Insufficient type information. // Insufficient type information.
ty::Infer(_) => None, ty::Infer(_) => None,

View file

@ -830,7 +830,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
hir::intravisit::walk_ty(self, ty); hir::intravisit::walk_ty(self, ty);
match ty.node { match ty.node {
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => { hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
if let hir::def::Def::TyParam(def_id) = path.def { if let hir::def::Def::Param(def_id) = path.def {
if def_id == self.1 { if def_id == self.1 {
self.0 = Some(ty.span); self.0 = Some(ty.span);
} }

View file

@ -459,10 +459,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
ty::Adt(def, _) => { ty::Adt(def, _) => {
self.assemble_inherent_impl_candidates_for_type(def.did); self.assemble_inherent_impl_candidates_for_type(def.did);
} }
ty::TyForeign(did) => { ty::Foreign(did) => {
self.assemble_inherent_impl_candidates_for_type(did); self.assemble_inherent_impl_candidates_for_type(did);
} }
ty::TyParam(p) => { ty::Param(p) => {
self.assemble_inherent_candidates_from_param(self_ty, p); self.assemble_inherent_candidates_from_param(self_ty, p);
} }
ty::TyChar => { ty::TyChar => {
@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
match *predicate { match *predicate {
ty::Predicate::Trait(ref trait_predicate) => { ty::Predicate::Trait(ref trait_predicate) => {
match trait_predicate.skip_binder().trait_ref.self_ty().sty { match trait_predicate.skip_binder().trait_ref.self_ty().sty {
ty::TyParam(ref p) if *p == param_ty => { ty::Param(ref p) if *p == param_ty => {
Some(trait_predicate.to_poly_trait_ref()) Some(trait_predicate.to_poly_trait_ref())
} }
_ => None, _ => None,

View file

@ -639,12 +639,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
fn is_local(ty: Ty) -> bool { fn is_local(ty: Ty) -> bool {
match ty.sty { match ty.sty {
ty::Adt(def, _) => def.did.is_local(), ty::Adt(def, _) => def.did.is_local(),
ty::TyForeign(did) => did.is_local(), ty::Foreign(did) => did.is_local(),
ty::Dynamic(ref tr, ..) => tr.principal() ty::Dynamic(ref tr, ..) => tr.principal()
.map_or(false, |p| p.def_id().is_local()), .map_or(false, |p| p.def_id().is_local()),
ty::TyParam(_) => true, ty::Param(_) => true,
// everything else (primitive types etc.) is effectively // everything else (primitive types etc.) is effectively
// non-local (there are "edge" cases, e.g. (LocalType,), but // non-local (there are "edge" cases, e.g. (LocalType,), but

View file

@ -1647,7 +1647,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId
return; return;
} }
match e.sty { match e.sty {
ty::TyParam(_) => { /* struct<T>(T, T, T, T) is ok */ } ty::Param(_) => { /* struct<T>(T, T, T, T) is ok */ }
_ if e.is_machine() => { /* struct(u8, u8, u8, u8) is ok */ } _ if e.is_machine() => { /* struct(u8, u8, u8, u8) is ok */ }
_ => { _ => {
span_err!(tcx.sess, sp, E0077, span_err!(tcx.sess, sp, E0077,
@ -5155,7 +5155,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let mut types_used = vec![false; own_counts.types]; let mut types_used = vec![false; own_counts.types];
for leaf_ty in ty.walk() { for leaf_ty in ty.walk() {
if let ty::TyParam(ty::ParamTy { idx, .. }) = leaf_ty.sty { if let ty::Param(ty::ParamTy { idx, .. }) = leaf_ty.sty {
debug!("Found use of ty param num {}", idx); debug!("Found use of ty param num {}", idx);
types_used[idx as usize - own_counts.lifetimes] = true; types_used[idx as usize - own_counts.lifetimes] = true;
} else if let ty::Error = leaf_ty.sty { } else if let ty::Error = leaf_ty.sty {

View file

@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// This has nothing here because it means we did string // This has nothing here because it means we did string
// concatenation (e.g. "Hello " += "World!"). This means // concatenation (e.g. "Hello " += "World!"). This means
// we don't want the note in the else clause to be emitted // we don't want the note in the else clause to be emitted
} else if let ty::TyParam(_) = lhs_ty.sty { } else if let ty::Param(_) = lhs_ty.sty {
// FIXME: point to span of param // FIXME: point to span of param
err.note(&format!( err.note(&format!(
"`{}` might need a bound for `{}`", "`{}` might need a bound for `{}`",
@ -385,7 +385,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// This has nothing here because it means we did string // This has nothing here because it means we did string
// concatenation (e.g. "Hello " + "World!"). This means // concatenation (e.g. "Hello " + "World!"). This means
// we don't want the note in the else clause to be emitted // we don't want the note in the else clause to be emitted
} else if let ty::TyParam(_) = lhs_ty.sty { } else if let ty::Param(_) = lhs_ty.sty {
// FIXME: point to span of param // FIXME: point to span of param
err.note(&format!( err.note(&format!(
"`{}` might need a bound for `{}`", "`{}` might need a bound for `{}`",

View file

@ -454,7 +454,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams { impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool { fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
match t.sty { match t.sty {
ty::TyParam(p) => { ty::Param(p) => {
self.params.insert(p.idx); self.params.insert(p.idx);
t.super_visit_with(self) t.super_visit_with(self)
} }
@ -588,7 +588,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
for (subst, param) in substs.iter().zip(&generics.params) { for (subst, param) in substs.iter().zip(&generics.params) {
match subst.unpack() { match subst.unpack() {
ty::subst::UnpackedKind::Type(ty) => match ty.sty { ty::subst::UnpackedKind::Type(ty) => match ty.sty {
ty::TyParam(..) => {}, ty::Param(..) => {},
// prevent `fn foo() -> Foo<u32>` from being defining // prevent `fn foo() -> Foo<u32>` from being defining
_ => { _ => {
tcx tcx

View file

@ -417,7 +417,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
fldop: |ty| { fldop: |ty| {
trace!("checking type {:?}: {:#?}", ty, ty.sty); trace!("checking type {:?}: {:#?}", ty, ty.sty);
// find a type parameter // find a type parameter
if let ty::TyParam(..) = ty.sty { if let ty::Param(..) = ty.sty {
// look it up in the substitution list // look it up in the substitution list
assert_eq!(anon_defn.substs.len(), generics.params.len()); assert_eq!(anon_defn.substs.len(), generics.params.len());
for (subst, param) in anon_defn.substs.iter().zip(&generics.params) { for (subst, param) in anon_defn.substs.iter().zip(&generics.params) {

View file

@ -105,7 +105,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
ty::Adt(def, _) => { ty::Adt(def, _) => {
self.check_def_id(item, def.did); self.check_def_id(item, def.did);
} }
ty::TyForeign(did) => { ty::Foreign(did) => {
self.check_def_id(item, did); self.check_def_id(item, did);
} }
ty::Dynamic(ref data, ..) if data.principal().is_some() => { ty::Dynamic(ref data, ..) if data.principal().is_some() => {

View file

@ -115,7 +115,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
let self_ty = trait_ref.self_ty(); let self_ty = trait_ref.self_ty();
let opt_self_def_id = match self_ty.sty { let opt_self_def_id = match self_ty.sty {
ty::Adt(self_def, _) => Some(self_def.did), ty::Adt(self_def, _) => Some(self_def.did),
ty::TyForeign(did) => Some(did), ty::Foreign(did) => Some(did),
_ => None, _ => None,
}; };

View file

@ -350,7 +350,7 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
match path.def { match path.def {
Def::SelfTy(Some(def_id), None) | Def::SelfTy(Some(def_id), None) |
Def::TyParam(def_id) => { Def::Param(def_id) => {
def_id == tcx.hir.local_def_id(param_id) def_id == tcx.hir.local_def_id(param_id)
} }
_ => false _ => false

View file

@ -66,7 +66,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
// projections are not injective // projections are not injective
return false; return false;
} }
ty::TyParam(data) => { ty::Param(data) => {
self.parameters.push(Parameter::from(data)); self.parameters.push(Parameter::from(data));
} }
_ => {} _ => {}

View file

@ -262,7 +262,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
match ty.sty { match ty.sty {
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) | ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
ty::TyStr | ty::Never | ty::TyForeign(..) => { ty::TyStr | ty::Never | ty::Foreign(..) => {
// leaf type -- noop // leaf type -- noop
} }
@ -323,7 +323,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
} }
} }
ty::TyParam(ref data) => { ty::Param(ref data) => {
self.add_constraint(current, data.idx, variance); self.add_constraint(current, data.idx, variance);
} }

View file

@ -83,7 +83,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
ret.extend(build_impls(cx, did, true)); ret.extend(build_impls(cx, did, true));
clean::EnumItem(build_enum(cx, did)) clean::EnumItem(build_enum(cx, did))
} }
Def::TyForeign(did) => { Def::Foreign(did) => {
record_extern_fqn(cx, did, clean::TypeKind::Foreign); record_extern_fqn(cx, did, clean::TypeKind::Foreign);
ret.extend(build_impls(cx, did, false)); ret.extend(build_impls(cx, did, false));
clean::ForeignTypeItem clean::ForeignTypeItem

View file

@ -2411,7 +2411,7 @@ impl Clean<Type> for hir::Ty {
return new_ty; return new_ty;
} }
if let Def::TyParam(did) = path.def { if let Def::Param(did) = path.def {
if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) { if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
return ImplTrait(bounds); return ImplTrait(bounds);
} }
@ -2460,7 +2460,7 @@ impl Clean<Type> for hir::Ty {
} }
hir::GenericParamKind::Type { ref default, .. } => { hir::GenericParamKind::Type { ref default, .. } => {
let ty_param_def = let ty_param_def =
Def::TyParam(cx.tcx.hir.local_def_id(param.id)); Def::Param(cx.tcx.hir.local_def_id(param.id));
let mut j = 0; let mut j = 0;
let type_ = generic_args.args.iter().find_map(|arg| { let type_ = generic_args.args.iter().find_map(|arg| {
match arg { match arg {
@ -2602,7 +2602,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
is_generic: false, is_generic: false,
} }
} }
ty::TyForeign(did) => { ty::Foreign(did) => {
inline::record_extern_fqn(cx, did, TypeKind::Foreign); inline::record_extern_fqn(cx, did, TypeKind::Foreign);
let path = external_path(cx, &cx.tcx.item_name(did).as_str(), let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
None, false, vec![], Substs::empty()); None, false, vec![], Substs::empty());
@ -2661,7 +2661,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
ty::Projection(ref data) => data.clean(cx), ty::Projection(ref data) => data.clean(cx),
ty::TyParam(ref p) => Generic(p.name.to_string()), ty::Param(ref p) => Generic(p.name.to_string()),
ty::Anon(def_id, substs) => { ty::Anon(def_id, substs) => {
// Grab the "TraitA + TraitB" from `impl TraitA + TraitB`, // Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
@ -3710,10 +3710,10 @@ fn resolve_type(cx: &DocContext,
Def::SelfTy(..) if path.segments.len() == 1 => { Def::SelfTy(..) if path.segments.len() == 1 => {
return Generic(keywords::SelfType.name().to_string()); return Generic(keywords::SelfType.name().to_string());
} }
Def::TyParam(..) if path.segments.len() == 1 => { Def::Param(..) if path.segments.len() == 1 => {
return Generic(format!("{:#}", path)); return Generic(format!("{:#}", path));
} }
Def::SelfTy(..) | Def::TyParam(..) | Def::AssociatedTy(..) => true, Def::SelfTy(..) | Def::Param(..) | Def::AssociatedTy(..) => true,
_ => false, _ => false,
}; };
let did = register_def(&*cx, path.def); let did = register_def(&*cx, path.def);
@ -3731,7 +3731,7 @@ pub fn register_def(cx: &DocContext, def: Def) -> DefId {
Def::Struct(i) => (i, TypeKind::Struct), Def::Struct(i) => (i, TypeKind::Struct),
Def::Union(i) => (i, TypeKind::Union), Def::Union(i) => (i, TypeKind::Union),
Def::Mod(i) => (i, TypeKind::Module), Def::Mod(i) => (i, TypeKind::Module),
Def::TyForeign(i) => (i, TypeKind::Foreign), Def::Foreign(i) => (i, TypeKind::Foreign),
Def::Const(i) => (i, TypeKind::Const), Def::Const(i) => (i, TypeKind::Const),
Def::Static(i, _) => (i, TypeKind::Static), Def::Static(i, _) => (i, TypeKind::Static),
Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"), Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"),

View file

@ -234,7 +234,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
None, None,
P(hir::Path { P(hir::Path {
span: DUMMY_SP, span: DUMMY_SP,
def: Def::TyParam(param.def_id), def: Def::Param(param.def_id),
segments: HirVec::from_vec(vec![ segments: HirVec::from_vec(vec![
hir::PathSegment::from_ident(Ident::from_interned_str(param.name)) hir::PathSegment::from_ident(Ident::from_interned_str(param.name))
]), ]),

View file

@ -267,7 +267,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
Def::Struct(did) | Def::Struct(did) |
Def::Union(did) | Def::Union(did) |
Def::Enum(did) | Def::Enum(did) |
Def::TyForeign(did) | Def::Foreign(did) |
Def::TyAlias(did) if !self_is_hidden => { Def::TyAlias(did) if !self_is_hidden => {
self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public); self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
}, },

View file

@ -89,7 +89,7 @@ pub mod testtypes {
pub type FooNil = (); pub type FooNil = ();
pub type FooTuple = (u8, i8, bool); pub type FooTuple = (u8, i8, bool);
// Skipping TyParam // Skipping Param
// Skipping Infer // Skipping Infer

View file

@ -11,7 +11,7 @@
trait Arr0 { trait Arr0 {
fn arr0_secret(&self); fn arr0_secret(&self);
} }
trait TyParam { trait Param {
fn ty_param_secret(&self); fn ty_param_secret(&self);
} }
@ -19,7 +19,7 @@ mod m {
struct Priv; struct Priv;
impl ::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} } impl ::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} }
impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} } impl ::Param for Option<Priv> { fn ty_param_secret(&self) {} }
} }
fn main() { fn main() {