Skip to content

Commit 04fa5d3

Browse files
committed
Remove Ty prefix from Ty{Foreign|Param}
1 parent 6f637da commit 04fa5d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+160
-160
lines changed

src/librustc/hir/def.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ pub enum Def {
5353
Existential(DefId),
5454
/// `type Foo = Bar;`
5555
TyAlias(DefId),
56-
TyForeign(DefId),
56+
Foreign(DefId),
5757
TraitAlias(DefId),
5858
AssociatedTy(DefId),
5959
/// `existential type Foo: Bar;`
6060
AssociatedExistential(DefId),
6161
PrimTy(hir::PrimTy),
62-
TyParam(DefId),
62+
Param(DefId),
6363
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
6464
ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]`
6565

@@ -269,10 +269,10 @@ impl Def {
269269
Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) |
270270
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) |
271271
Def::TyAlias(id) | Def::TraitAlias(id) |
272-
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
272+
Def::AssociatedTy(id) | Def::Param(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
273273
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
274274
Def::AssociatedConst(id) | Def::Macro(id, ..) |
275-
Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => {
275+
Def::Existential(id) | Def::AssociatedExistential(id) | Def::Foreign(id) => {
276276
id
277277
}
278278

@@ -311,11 +311,11 @@ impl Def {
311311
Def::StructCtor(.., CtorKind::Fictive) => bug!("impossible struct constructor"),
312312
Def::Union(..) => "union",
313313
Def::Trait(..) => "trait",
314-
Def::TyForeign(..) => "foreign type",
314+
Def::Foreign(..) => "foreign type",
315315
Def::Method(..) => "method",
316316
Def::Const(..) => "constant",
317317
Def::AssociatedConst(..) => "associated constant",
318-
Def::TyParam(..) => "type parameter",
318+
Def::Param(..) => "type parameter",
319319
Def::PrimTy(..) => "builtin type",
320320
Def::Local(..) => "local variable",
321321
Def::Upvar(..) => "closure capture",

src/librustc/hir/lowering.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ impl<'a> LoweringContext<'a> {
11831183
}
11841184
ImplTraitContext::Universal(in_band_ty_params) => {
11851185
self.lower_node_id(def_node_id);
1186-
// Add a definition for the in-band TyParam
1186+
// Add a definition for the in-band Param
11871187
let def_index = self
11881188
.resolver
11891189
.definitions()
@@ -1213,7 +1213,7 @@ impl<'a> LoweringContext<'a> {
12131213
None,
12141214
P(hir::Path {
12151215
span,
1216-
def: Def::TyParam(DefId::local(def_index)),
1216+
def: Def::Param(DefId::local(def_index)),
12171217
segments: hir_vec![hir::PathSegment::from_ident(ident)],
12181218
}),
12191219
))
@@ -2352,7 +2352,7 @@ impl<'a> LoweringContext<'a> {
23522352
if path.segments.len() == 1
23532353
&& bound_pred.bound_generic_params.is_empty() =>
23542354
{
2355-
if let Some(Def::TyParam(def_id)) = self.resolver
2355+
if let Some(Def::Param(def_id)) = self.resolver
23562356
.get_resolution(bound_pred.bounded_ty.id)
23572357
.map(|d| d.base_def())
23582358
{

src/librustc/hir/map/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'hir> Map<'hir> {
453453
match item.node {
454454
ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)),
455455
ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)),
456-
ForeignItemKind::Type => Some(Def::TyForeign(def_id)),
456+
ForeignItemKind::Type => Some(Def::Foreign(def_id)),
457457
}
458458
}
459459
NodeTraitItem(item) => {
@@ -499,7 +499,7 @@ impl<'hir> Map<'hir> {
499499
NodeGenericParam(param) => {
500500
Some(match param.kind {
501501
GenericParamKind::Lifetime { .. } => Def::Local(param.id),
502-
GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)),
502+
GenericParamKind::Type { .. } => Def::Param(self.local_def_id(param.id)),
503503
})
504504
}
505505
}

src/librustc/ich/impls_hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1010,9 +1010,9 @@ impl_stable_hash_for!(enum hir::def::Def {
10101010
AssociatedTy(def_id),
10111011
AssociatedExistential(def_id),
10121012
PrimTy(prim_ty),
1013-
TyParam(def_id),
1013+
Param(def_id),
10141014
SelfTy(trait_def_id, impl_def_id),
1015-
TyForeign(def_id),
1015+
Foreign(def_id),
10161016
Fn(def_id),
10171017
Const(def_id),
10181018
Static(def_id, is_mutbl),

src/librustc/ich/impls_ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -874,10 +874,10 @@ for ty::TyKind<'gcx>
874874
def_id.hash_stable(hcx, hasher);
875875
substs.hash_stable(hcx, hasher);
876876
}
877-
TyParam(param_ty) => {
877+
Param(param_ty) => {
878878
param_ty.hash_stable(hcx, hasher);
879879
}
880-
TyForeign(def_id) => {
880+
Foreign(def_id) => {
881881
def_id.hash_stable(hcx, hasher);
882882
}
883883
Infer(infer_ty) => {

src/librustc/infer/canonical/canonicalizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
283283
| ty::Never
284284
| ty::Tuple(..)
285285
| ty::Projection(..)
286-
| ty::TyForeign(..)
287-
| ty::TyParam(..)
286+
| ty::Foreign(..)
287+
| ty::Param(..)
288288
| ty::Anon(..) => {
289289
if t.flags.intersects(self.needs_canonical_flags) {
290290
t.super_fold_with(self)

src/librustc/infer/error_reporting/mod.rs

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

src/librustc/infer/freshen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
193193
ty::Never |
194194
ty::Tuple(..) |
195195
ty::Projection(..) |
196-
ty::TyForeign(..) |
197-
ty::TyParam(..) |
196+
ty::Foreign(..) |
197+
ty::Param(..) |
198198
ty::Closure(..) |
199199
ty::GeneratorWitness(..) |
200200
ty::Anon(..) => {

src/librustc/infer/outlives/obligations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ where
450450

451451
fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
452452
match ty.sty {
453-
ty::TyParam(p) => self.param_bound(p),
453+
ty::Param(p) => self.param_bound(p),
454454
ty::Projection(data) => {
455455
let declared_bounds = self.projection_declared_bounds(data);
456456
self.projection_bound(declared_bounds, data)

src/librustc/middle/resolve_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ fn object_lifetime_defaults_for_item(
13261326
_ => continue,
13271327
};
13281328

1329-
if def == Def::TyParam(param_def_id) {
1329+
if def == Def::Param(param_def_id) {
13301330
add_bounds(&mut set, &data.bounds);
13311331
}
13321332
}

src/librustc/traits/auto_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
606606
}
607607

608608
return match substs.type_at(0).sty {
609-
ty::TyParam(_) => true,
609+
ty::Param(_) => true,
610610
ty::Projection(p) => self.is_of_param(p.substs),
611611
_ => false,
612612
};

src/librustc/traits/coherence.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate)
407407

408408
fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool {
409409
match ty.sty {
410-
ty::Projection(..) | ty::TyParam(..) => true,
410+
ty::Projection(..) | ty::Param(..) => true,
411411
_ => false,
412412
}
413413
}
@@ -455,7 +455,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
455455
ty::Ref(..) |
456456
ty::Never |
457457
ty::Tuple(..) |
458-
ty::TyParam(..) |
458+
ty::Param(..) |
459459
ty::Projection(..) => {
460460
false
461461
}
@@ -468,7 +468,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
468468
},
469469

470470
ty::Adt(def, _) => def_id_is_local(def.did, in_crate),
471-
ty::TyForeign(did) => def_id_is_local(did, in_crate),
471+
ty::Foreign(did) => def_id_is_local(did, in_crate),
472472

473473
ty::Dynamic(ref tt, ..) => {
474474
tt.principal().map_or(false, |p| {

src/librustc/traits/error_reporting.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
256256
ty::Closure(..) => Some(9),
257257
ty::Tuple(..) => Some(10),
258258
ty::Projection(..) => Some(11),
259-
ty::TyParam(..) => Some(12),
259+
ty::Param(..) => Some(12),
260260
ty::Anon(..) => Some(13),
261261
ty::Never => Some(14),
262262
ty::Adt(adt, ..) => match adt.adt_kind() {
@@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
265265
AdtKind::Enum => Some(17),
266266
},
267267
ty::Generator(..) => Some(18),
268-
ty::TyForeign(..) => Some(19),
268+
ty::Foreign(..) => Some(19),
269269
ty::GeneratorWitness(..) => Some(20),
270270
ty::Infer(..) | ty::Error => None
271271
}
@@ -785,7 +785,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
785785

786786
let found_did = match found_trait_ty.sty {
787787
ty::Closure(did, _) |
788-
ty::TyForeign(did) |
788+
ty::Foreign(did) |
789789
ty::FnDef(did, _) => Some(did),
790790
ty::Adt(def, _) => Some(def.did),
791791
_ => None,
@@ -1348,7 +1348,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
13481348
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx }
13491349

13501350
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
1351-
if let ty::TyParam(ty::ParamTy {name, ..}) = ty.sty {
1351+
if let ty::Param(ty::ParamTy {name, ..}) = ty.sty {
13521352
let infcx = self.infcx;
13531353
self.var_map.entry(ty).or_insert_with(||
13541354
infcx.next_ty_var(

src/librustc/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
371371
let mut error = false;
372372
ty.maybe_walk(|ty| {
373373
match ty.sty {
374-
ty::TyParam(ref param_ty) => {
374+
ty::Param(ref param_ty) => {
375375
if param_ty.is_self() {
376376
error = true;
377377
}

src/librustc/traits/query/dropck_outlives.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
228228
| ty::RawPtr(_)
229229
| ty::Ref(..)
230230
| ty::TyStr
231-
| ty::TyForeign(..)
231+
| ty::Foreign(..)
232232
| ty::Error => true,
233233

234234
// [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>) ->
257257
// The following *might* require a destructor: it would deeper inspection to tell.
258258
ty::Dynamic(..)
259259
| ty::Projection(..)
260-
| ty::TyParam(_)
260+
| ty::Param(_)
261261
| ty::Anon(..)
262262
| ty::Infer(_)
263263
| ty::Generator(..) => false,

src/librustc/traits/select.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1810,13 +1810,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
18101810
// say nothing; a candidate may be added by
18111811
// `assemble_candidates_from_object_ty`.
18121812
}
1813-
ty::TyForeign(..) => {
1813+
ty::Foreign(..) => {
18141814
// Since the contents of foreign types is unknown,
18151815
// we don't add any `..` impl. Default traits could
18161816
// still be provided by a manual implementation for
18171817
// this trait and type.
18181818
}
1819-
ty::TyParam(..) |
1819+
ty::Param(..) |
18201820
ty::Projection(..) => {
18211821
// In these cases, we don't know what the actual
18221822
// type is. Therefore, we cannot break it down
@@ -2189,7 +2189,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21892189
Where(ty::Binder::dummy(Vec::new()))
21902190
}
21912191

2192-
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => None,
2192+
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
21932193

21942194
ty::Tuple(tys) => {
21952195
Where(ty::Binder::bind(tys.last().into_iter().cloned().collect()))
@@ -2203,7 +2203,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22032203
))
22042204
}
22052205

2206-
ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => None,
2206+
ty::Projection(_) | ty::Param(_) | ty::Anon(..) => None,
22072207
ty::Infer(ty::TyVar(_)) => Ambiguous,
22082208

22092209
ty::Infer(ty::CanonicalTy(_)) |
@@ -2239,7 +2239,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22392239
}
22402240

22412241
ty::Dynamic(..) | ty::TyStr | ty::Slice(..) |
2242-
ty::Generator(..) | ty::GeneratorWitness(..) | ty::TyForeign(..) |
2242+
ty::Generator(..) | ty::GeneratorWitness(..) | ty::Foreign(..) |
22432243
ty::Ref(_, _, hir::MutMutable) => {
22442244
None
22452245
}
@@ -2265,7 +2265,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22652265
}
22662266
}
22672267

2268-
ty::Adt(..) | ty::Projection(..) | ty::TyParam(..) | ty::Anon(..) => {
2268+
ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Anon(..) => {
22692269
// Fallback to whatever user-defined impls exist in this case.
22702270
None
22712271
}
@@ -2316,8 +2316,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23162316
}
23172317

23182318
ty::Dynamic(..) |
2319-
ty::TyParam(..) |
2320-
ty::TyForeign(..) |
2319+
ty::Param(..) |
2320+
ty::Foreign(..) |
23212321
ty::Projection(..) |
23222322
ty::Infer(ty::CanonicalTy(_)) |
23232323
ty::Infer(ty::TyVar(_)) |
@@ -3072,7 +3072,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
30723072
let mut ty_params = BitArray::new(substs_a.types().count());
30733073
let mut found = false;
30743074
for ty in field.walk() {
3075-
if let ty::TyParam(p) = ty.sty {
3075+
if let ty::Param(p) = ty.sty {
30763076
ty_params.insert(p.idx as usize);
30773077
found = true;
30783078
}

src/librustc/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
9090
.unwrap()
9191
.subst(infcx.tcx, &source_substs);
9292

93-
// translate the Self and TyParam parts of the substitution, since those
93+
// translate the Self and Param parts of the substitution, since those
9494
// vary across impls
9595
let target_substs = match target_node {
9696
specialization_graph::Node::Impl(target_impl) => {

src/librustc/ty/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
20782078
self,
20792079
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
20802080
Generator, GeneratorWitness, Dynamic, Closure, Tuple,
2081-
TyParam, Infer, Projection, Anon, TyForeign);
2081+
Param, Infer, Projection, Anon, Foreign);
20822082

20832083
println!("Substs interner: #{}", self.interners.substs.borrow().len());
20842084
println!("Region interner: #{}", self.interners.region.borrow().len());
@@ -2387,7 +2387,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23872387
}
23882388

23892389
pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> {
2390-
self.mk_ty(TyForeign(def_id))
2390+
self.mk_ty(Foreign(def_id))
23912391
}
23922392

23932393
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
@@ -2532,7 +2532,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25322532
pub fn mk_ty_param(self,
25332533
index: u32,
25342534
name: InternedString) -> Ty<'tcx> {
2535-
self.mk_ty(TyParam(ParamTy { idx: index, name: name }))
2535+
self.mk_ty(Param(ParamTy { idx: index, name: name }))
25362536
}
25372537

25382538
pub fn mk_self_type(self) -> Ty<'tcx> {

src/librustc/ty/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
180180
ty::Tuple(ref tys) if tys.is_empty() => self.to_string(),
181181

182182
ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)),
183-
ty::TyForeign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)),
183+
ty::Foreign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)),
184184
ty::Array(_, n) => {
185185
match n.assert_usize(tcx) {
186186
Some(n) => format!("array of {} elements", n),
@@ -222,7 +222,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
222222
ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(),
223223
ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(),
224224
ty::Projection(_) => "associated type".to_string(),
225-
ty::TyParam(ref p) => {
225+
ty::Param(ref p) => {
226226
if p.is_self() {
227227
"Self".to_string()
228228
} else {

0 commit comments

Comments
 (0)