Skip to content

Commit 98c7ed6

Browse files
committed
DefKind::Method -> DefKind::AssocFn
1 parent b135c73 commit 98c7ed6

File tree

23 files changed

+38
-37
lines changed

23 files changed

+38
-37
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,12 @@ impl<'hir> Map<'hir> {
326326
},
327327
Node::TraitItem(item) => match item.kind {
328328
TraitItemKind::Const(..) => DefKind::AssocConst,
329-
TraitItemKind::Method(..) => DefKind::Method,
329+
TraitItemKind::Method(..) => DefKind::AssocFn,
330330
TraitItemKind::Type(..) => DefKind::AssocTy,
331331
},
332332
Node::ImplItem(item) => match item.kind {
333333
ImplItemKind::Const(..) => DefKind::AssocConst,
334-
ImplItemKind::Method(..) => DefKind::Method,
334+
ImplItemKind::Method(..) => DefKind::AssocFn,
335335
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
336336
ImplItemKind::OpaqueTy(..) => DefKind::AssocOpaqueTy,
337337
},

src/librustc/middle/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ pub enum EvalResult {
250250
fn skip_stability_check_due_to_privacy(tcx: TyCtxt<'_>, mut def_id: DefId) -> bool {
251251
// Check if `def_id` is a trait method.
252252
match tcx.def_kind(def_id) {
253-
Some(DefKind::Method) | Some(DefKind::AssocTy) | Some(DefKind::AssocConst) => {
253+
Some(DefKind::AssocFn) | Some(DefKind::AssocTy) | Some(DefKind::AssocConst) => {
254254
if let ty::TraitContainer(trait_def_id) = tcx.associated_item(def_id).container {
255255
// Trait methods do not declare visibility (even
256256
// for visibility info in cstore). Use containing

src/librustc/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl<'tcx> TypeckTables<'tcx> {
611611
}
612612

613613
match self.type_dependent_defs().get(expr.hir_id) {
614-
Some(Ok((DefKind::Method, _))) => true,
614+
Some(Ok((DefKind::AssocFn, _))) => true,
615615
_ => false,
616616
}
617617
}

src/librustc/ty/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl AssocItem {
230230
pub fn def_kind(&self) -> DefKind {
231231
match self.kind {
232232
AssocKind::Const => DefKind::AssocConst,
233-
AssocKind::Method => DefKind::Method,
233+
AssocKind::Method => DefKind::AssocFn,
234234
AssocKind::Type => DefKind::AssocTy,
235235
AssocKind::OpaqueTy => DefKind::AssocOpaqueTy,
236236
}
@@ -2872,7 +2872,7 @@ impl<'tcx> TyCtxt<'tcx> {
28722872
}
28732873
} else {
28742874
match self.def_kind(def_id).expect("no def for `DefId`") {
2875-
DefKind::AssocConst | DefKind::Method | DefKind::AssocTy => true,
2875+
DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy => true,
28762876
_ => false,
28772877
}
28782878
};
@@ -3051,7 +3051,7 @@ impl<'tcx> TyCtxt<'tcx> {
30513051
/// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
30523052
pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> {
30533053
let item = if def_id.krate != LOCAL_CRATE {
3054-
if let Some(DefKind::Method) = self.def_kind(def_id) {
3054+
if let Some(DefKind::AssocFn) = self.def_kind(def_id) {
30553055
Some(self.associated_item(def_id))
30563056
} else {
30573057
None

src/librustc_ast_lowering/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
7575
ParenthesizedGenericArgs::Ok
7676
}
7777
// `a::b::Trait(Args)::TraitItem`
78-
Res::Def(DefKind::Method, _)
78+
Res::Def(DefKind::AssocFn, _)
7979
| Res::Def(DefKind::AssocConst, _)
8080
| Res::Def(DefKind::AssocTy, _)
8181
if i + 2 == proj_start =>

src/librustc_hir/def.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub enum DefKind {
7272
Static,
7373
/// Refers to the struct or enum variant's constructor.
7474
Ctor(CtorOf, CtorKind),
75-
Method,
75+
AssocFn,
7676
AssocConst,
7777

7878
// Macro namespace
@@ -107,7 +107,8 @@ impl DefKind {
107107
DefKind::Union => "union",
108108
DefKind::Trait => "trait",
109109
DefKind::ForeignTy => "foreign type",
110-
DefKind::Method => "method",
110+
// FIXME: Update the description to "assoc fn"
111+
DefKind::AssocFn => "method",
111112
DefKind::Const => "constant",
112113
DefKind::AssocConst => "associated constant",
113114
DefKind::TyParam => "type parameter",
@@ -150,7 +151,7 @@ impl DefKind {
150151
| DefKind::ConstParam
151152
| DefKind::Static
152153
| DefKind::Ctor(..)
153-
| DefKind::Method
154+
| DefKind::AssocFn
154155
| DefKind::AssocConst => ns == Namespace::ValueNS,
155156

156157
DefKind::Macro(..) => ns == Namespace::MacroNS,

src/librustc_infer/infer/error_reporting/need_type_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
468468
&segment.args,
469469
) {
470470
let borrow = tables.borrow();
471-
if let Some((DefKind::Method, did)) = borrow.type_dependent_def(e.hir_id) {
471+
if let Some((DefKind::AssocFn, did)) = borrow.type_dependent_def(e.hir_id) {
472472
let generics = self.tcx.generics_of(did);
473473
if !generics.params.is_empty() {
474474
err.span_suggestion(

src/librustc_lint/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
5454
match callee.kind {
5555
hir::ExprKind::Path(ref qpath) => {
5656
match cx.tables.qpath_res(qpath, callee.hir_id) {
57-
Res::Def(DefKind::Fn, def_id) | Res::Def(DefKind::Method, def_id) => {
57+
Res::Def(DefKind::Fn, def_id) | Res::Def(DefKind::AssocFn, def_id) => {
5858
Some(def_id)
5959
}
6060
// `Res::Local` if it was a closure, for which we

src/librustc_metadata/rmeta/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl EntryKind {
504504
EntryKind::Struct(_, _) => DefKind::Struct,
505505
EntryKind::Union(_, _) => DefKind::Union,
506506
EntryKind::Fn(_) | EntryKind::ForeignFn(_) => DefKind::Fn,
507-
EntryKind::Method(_) => DefKind::Method,
507+
EntryKind::Method(_) => DefKind::AssocFn,
508508
EntryKind::Type => DefKind::TyAlias,
509509
EntryKind::TypeParam => DefKind::TyParam,
510510
EntryKind::ConstParam => DefKind::ConstParam,

src/librustc_mir/util/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ fn write_mir_sig(
545545
trace!("write_mir_sig: {:?}", src.instance);
546546
let kind = tcx.def_kind(src.def_id());
547547
let is_function = match kind {
548-
Some(DefKind::Fn) | Some(DefKind::Method) | Some(DefKind::Ctor(..)) => true,
548+
Some(DefKind::Fn) | Some(DefKind::AssocFn) | Some(DefKind::Ctor(..)) => true,
549549
_ => tcx.is_closure(src.def_id()),
550550
};
551551
match (kind, src.promoted) {

0 commit comments

Comments
 (0)