Skip to content

Commit 05cfb3f

Browse files
committed
Rename Def::{Param, Foreign} to Def::{TyParam, TyForeign}
1 parent 08f3685 commit 05cfb3f

File tree

17 files changed

+38
-38
lines changed

17 files changed

+38
-38
lines changed

src/librustc/hir/def.rs

Lines changed: 6 additions & 6 deletions
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-
Foreign(DefId),
56+
TyForeign(DefId),
5757
TraitAlias(DefId),
5858
AssociatedTy(DefId),
5959
/// `existential type Foo: Bar;`
6060
AssociatedExistential(DefId),
6161
PrimTy(hir::PrimTy),
62-
Param(DefId),
62+
TyParam(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::Param(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
272+
Def::AssociatedTy(id) | Def::TyParam(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::Foreign(id) => {
275+
Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(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::Foreign(..) => "foreign type",
314+
Def::TyForeign(..) => "foreign type",
315315
Def::Method(..) => "method",
316316
Def::Const(..) => "constant",
317317
Def::AssociatedConst(..) => "associated constant",
318-
Def::Param(..) => "type parameter",
318+
Def::TyParam(..) => "type parameter",
319319
Def::PrimTy(..) => "builtin type",
320320
Def::Local(..) => "local variable",
321321
Def::Upvar(..) => "closure capture",

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ impl<'a> LoweringContext<'a> {
12131213
None,
12141214
P(hir::Path {
12151215
span,
1216-
def: Def::Param(DefId::local(def_index)),
1216+
def: Def::TyParam(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::Param(def_id)) = self.resolver
2355+
if let Some(Def::TyParam(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

Lines changed: 2 additions & 2 deletions
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::Foreign(def_id)),
456+
ForeignItemKind::Type => Some(Def::TyForeign(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::Param(self.local_def_id(param.id)),
502+
GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)),
503503
})
504504
}
505505
}

src/librustc/ich/impls_hir.rs

Lines changed: 2 additions & 2 deletions
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-
Param(def_id),
1013+
TyParam(def_id),
10141014
SelfTy(trait_def_id, impl_def_id),
1015-
Foreign(def_id),
1015+
TyForeign(def_id),
10161016
Fn(def_id),
10171017
Const(def_id),
10181018
Static(def_id, is_mutbl),

src/librustc/middle/resolve_lifetime.rs

Lines changed: 1 addition & 1 deletion
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::Param(param_def_id) {
1329+
if def == Def::TyParam(param_def_id) {
13301330
add_bounds(&mut set, &data.bounds);
13311331
}
13321332
}

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ impl TypeAliasBounds {
15101510
match ty.node {
15111511
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
15121512
match path.def {
1513-
Def::Param(_) => true,
1513+
Def::TyParam(_) => true,
15141514
_ => false
15151515
}
15161516
}

src/librustc_metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<'tcx> EntryKind<'tcx> {
429429
EntryKind::Trait(_) => Def::Trait(did),
430430
EntryKind::Enum(..) => Def::Enum(did),
431431
EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
432-
EntryKind::ForeignType => Def::Foreign(did),
432+
EntryKind::ForeignType => Def::TyForeign(did),
433433

434434
EntryKind::ForeignMod |
435435
EntryKind::GlobalAsm |

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
656656
(Def::Static(self.definitions.local_def_id(item.id), m), ValueNS)
657657
}
658658
ForeignItemKind::Ty => {
659-
(Def::Foreign(self.definitions.local_def_id(item.id)), TypeNS)
659+
(Def::TyForeign(self.definitions.local_def_id(item.id)), TypeNS)
660660
}
661661
ForeignItemKind::Macro(_) => unreachable!(),
662662
};
@@ -692,7 +692,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
692692
span);
693693
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
694694
}
695-
Def::Variant(..) | Def::TyAlias(..) | Def::Foreign(..) => {
695+
Def::Variant(..) | Def::TyAlias(..) | Def::TyForeign(..) => {
696696
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
697697
}
698698
Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => {

src/librustc_resolve/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
204204
"`Self` type implicitly declared here, on the `impl`");
205205
}
206206
},
207-
Def::Param(typaram_defid) => {
207+
Def::TyParam(typaram_defid) => {
208208
if let Some(typaram_span) = resolver.definitions.opt_span(typaram_defid) {
209209
err.span_label(typaram_span, "type variable from outer function");
210210
}
211211
},
212212
_ => {
213213
bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \
214-
Def::Param")
214+
Def::TyParam")
215215
}
216216
}
217217

@@ -537,9 +537,9 @@ impl<'a> PathSource<'a> {
537537
PathSource::Type => match def {
538538
Def::Struct(..) | Def::Union(..) | Def::Enum(..) |
539539
Def::Trait(..) | Def::TyAlias(..) | Def::AssociatedTy(..) |
540-
Def::PrimTy(..) | Def::Param(..) | Def::SelfTy(..) |
540+
Def::PrimTy(..) | Def::TyParam(..) | Def::SelfTy(..) |
541541
Def::Existential(..) |
542-
Def::Foreign(..) => true,
542+
Def::TyForeign(..) => true,
543543
_ => false,
544544
},
545545
PathSource::Trait(AliasPossibility::No) => match def {
@@ -2359,7 +2359,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
23592359
seen_bindings.entry(ident).or_insert(param.ident.span);
23602360

23612361
// Plain insert (no renaming).
2362-
let def = Def::Param(self.definitions.local_def_id(param.id));
2362+
let def = Def::TyParam(self.definitions.local_def_id(param.id));
23632363
function_type_rib.bindings.insert(ident, def);
23642364
self.record_def(param.id, PathResolution::new(def));
23652365
}
@@ -3765,7 +3765,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
37653765
}
37663766
}
37673767
}
3768-
Def::Param(..) | Def::SelfTy(..) => {
3768+
Def::TyParam(..) | Def::SelfTy(..) => {
37693769
for rib in ribs {
37703770
match rib.kind {
37713771
NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) |

src/librustc_save_analysis/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,13 +747,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
747747
HirDef::Union(def_id) |
748748
HirDef::Enum(def_id) |
749749
HirDef::TyAlias(def_id) |
750-
HirDef::Foreign(def_id) |
750+
HirDef::TyForeign(def_id) |
751751
HirDef::TraitAlias(def_id) |
752752
HirDef::AssociatedExistential(def_id) |
753753
HirDef::AssociatedTy(def_id) |
754754
HirDef::Trait(def_id) |
755755
HirDef::Existential(def_id) |
756-
HirDef::Param(def_id) => {
756+
HirDef::TyParam(def_id) => {
757757
let span = self.span_from_span(sub_span);
758758
Some(Ref {
759759
kind: RefKind::Type,

0 commit comments

Comments
 (0)