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

+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-
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

+2-2
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

+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::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

+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-
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

+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::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

+1-1
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

+1-1
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

+2-2
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

+6-6
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

+2-2
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,

src/librustc_typeck/astconv.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
12401240
}
12411241
}
12421242
(&ty::Param(_), Def::SelfTy(Some(param_did), None)) |
1243-
(&ty::Param(_), Def::Param(param_did)) => {
1243+
(&ty::Param(_), Def::TyParam(param_did)) => {
12441244
match self.find_bound_for_assoc_item(param_did, assoc_name, span) {
12451245
Ok(bound) => bound,
12461246
Err(ErrorReported) => return (tcx.types.err, Def::Err),
@@ -1387,7 +1387,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
13871387
)
13881388
}
13891389
Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) |
1390-
Def::Union(did) | Def::Foreign(did) => {
1390+
Def::Union(did) | Def::TyForeign(did) => {
13911391
assert_eq!(opt_self_ty, None);
13921392
self.prohibit_generics(path.segments.split_last().unwrap().1);
13931393
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 {
14011401
tcx.parent_def_id(did).unwrap(),
14021402
path.segments.last().unwrap())
14031403
}
1404-
Def::Param(did) => {
1404+
Def::TyParam(did) => {
14051405
assert_eq!(opt_self_ty, None);
14061406
self.prohibit_generics(&path.segments);
14071407

src/librustc_typeck/check/compare_method.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
830830
hir::intravisit::walk_ty(self, ty);
831831
match ty.node {
832832
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
833-
if let hir::def::Def::Param(def_id) = path.def {
833+
if let hir::def::Def::TyParam(def_id) = path.def {
834834
if def_id == self.1 {
835835
self.0 = Some(ty.span);
836836
}

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
350350
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
351351
match path.def {
352352
Def::SelfTy(Some(def_id), None) |
353-
Def::Param(def_id) => {
353+
Def::TyParam(def_id) => {
354354
def_id == tcx.hir.local_def_id(param_id)
355355
}
356356
_ => false

src/librustdoc/clean/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
8383
ret.extend(build_impls(cx, did, true));
8484
clean::EnumItem(build_enum(cx, did))
8585
}
86-
Def::Foreign(did) => {
86+
Def::TyForeign(did) => {
8787
record_extern_fqn(cx, did, clean::TypeKind::Foreign);
8888
ret.extend(build_impls(cx, did, false));
8989
clean::ForeignTypeItem

src/librustdoc/clean/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2411,7 +2411,7 @@ impl Clean<Type> for hir::Ty {
24112411
return new_ty;
24122412
}
24132413

2414-
if let Def::Param(did) = path.def {
2414+
if let Def::TyParam(did) = path.def {
24152415
if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
24162416
return ImplTrait(bounds);
24172417
}
@@ -2460,7 +2460,7 @@ impl Clean<Type> for hir::Ty {
24602460
}
24612461
hir::GenericParamKind::Type { ref default, .. } => {
24622462
let ty_param_def =
2463-
Def::Param(cx.tcx.hir.local_def_id(param.id));
2463+
Def::TyParam(cx.tcx.hir.local_def_id(param.id));
24642464
let mut j = 0;
24652465
let type_ = generic_args.args.iter().find_map(|arg| {
24662466
match arg {
@@ -3710,10 +3710,10 @@ fn resolve_type(cx: &DocContext,
37103710
Def::SelfTy(..) if path.segments.len() == 1 => {
37113711
return Generic(keywords::SelfType.name().to_string());
37123712
}
3713-
Def::Param(..) if path.segments.len() == 1 => {
3713+
Def::TyParam(..) if path.segments.len() == 1 => {
37143714
return Generic(format!("{:#}", path));
37153715
}
3716-
Def::SelfTy(..) | Def::Param(..) | Def::AssociatedTy(..) => true,
3716+
Def::SelfTy(..) | Def::TyParam(..) | Def::AssociatedTy(..) => true,
37173717
_ => false,
37183718
};
37193719
let did = register_def(&*cx, path.def);
@@ -3731,7 +3731,7 @@ pub fn register_def(cx: &DocContext, def: Def) -> DefId {
37313731
Def::Struct(i) => (i, TypeKind::Struct),
37323732
Def::Union(i) => (i, TypeKind::Union),
37333733
Def::Mod(i) => (i, TypeKind::Module),
3734-
Def::Foreign(i) => (i, TypeKind::Foreign),
3734+
Def::TyForeign(i) => (i, TypeKind::Foreign),
37353735
Def::Const(i) => (i, TypeKind::Const),
37363736
Def::Static(i, _) => (i, TypeKind::Static),
37373737
Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"),

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
234234
None,
235235
P(hir::Path {
236236
span: DUMMY_SP,
237-
def: Def::Param(param.def_id),
237+
def: Def::TyParam(param.def_id),
238238
segments: HirVec::from_vec(vec![
239239
hir::PathSegment::from_ident(Ident::from_interned_str(param.name))
240240
]),

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
267267
Def::Struct(did) |
268268
Def::Union(did) |
269269
Def::Enum(did) |
270-
Def::Foreign(did) |
270+
Def::TyForeign(did) |
271271
Def::TyAlias(did) if !self_is_hidden => {
272272
self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
273273
},

0 commit comments

Comments
 (0)