Skip to content

Commit f40272c

Browse files
authored
Rollup merge of #69498 - mark-i-m:describe-it-2, r=matthewjasper
Change "method" to "associated function" r? @matthewjasper cc @Centril @eddyb #67742 I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it... The relevant changes are the last two commits (it is rebased on top of #67742)
2 parents 0619e46 + b6518f0 commit f40272c

File tree

77 files changed

+177
-177
lines changed

Some content is hidden

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

77 files changed

+177
-177
lines changed

src/librustc_hir/def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ impl DefKind {
107107
DefKind::Union => "union",
108108
DefKind::Trait => "trait",
109109
DefKind::ForeignTy => "foreign type",
110-
// FIXME: Update the description to "assoc fn"
111-
DefKind::AssocFn => "method",
110+
DefKind::AssocFn => "associated function",
112111
DefKind::Const => "constant",
113112
DefKind::AssocConst => "associated constant",
114113
DefKind::TyParam => "type parameter",
@@ -123,6 +122,7 @@ impl DefKind {
123122
DefKind::AssocTy
124123
| DefKind::AssocConst
125124
| DefKind::AssocOpaqueTy
125+
| DefKind::AssocFn
126126
| DefKind::Enum
127127
| DefKind::OpaqueTy => "an",
128128
DefKind::Macro(macro_kind) => macro_kind.article(),

src/test/ui/associated-item/associated-item-enum.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | Enum::mispellable();
88
| ^^^^^^^^^^^
99
| |
1010
| variant or associated item not found in `Enum`
11-
| help: there is a method with a similar name: `misspellable`
11+
| help: there is an associated function with a similar name: `misspellable`
1212

1313
error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope
1414
--> $DIR/associated-item-enum.rs:18:11

src/test/ui/async-await/issues/issue-62097.nll.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ help: to force the closure to take ownership of `self` (and any other referenced
1616
LL | foo(move || self.bar()).await;
1717
| ^^^^^^^
1818

19-
error[E0521]: borrowed data escapes outside of method
19+
error[E0521]: borrowed data escapes outside of associated function
2020
--> $DIR/issue-62097.rs:13:9
2121
|
2222
LL | pub async fn run_dummy_fn(&self) {
23-
| ----- `self` is a reference that is only valid in the method body
23+
| ----- `self` is a reference that is only valid in the associated function body
2424
LL | foo(|| self.bar()).await;
25-
| ^^^^^^^^^^^^^^^^^^ `self` escapes the method body here
25+
| ^^^^^^^^^^^^^^^^^^ `self` escapes the associated function body here
2626

2727
error: aborting due to 2 previous errors
2828

src/test/ui/async-await/issues/issue-63388-1.nll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | ) -> &dyn Foo
99
LL | / {
1010
LL | | foo
1111
LL | | }
12-
| |_____^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
12+
| |_____^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
1313

1414
error: aborting due to previous error
1515

src/test/ui/auto-ref-slice-plus-ref.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `test_mut` found for struct `std::vec::Vec<{intege
22
--> $DIR/auto-ref-slice-plus-ref.rs:7:7
33
|
44
LL | a.test_mut();
5-
| ^^^^^^^^ help: there is a method with a similar name: `get_mut`
5+
| ^^^^^^^^ help: there is an associated function with a similar name: `get_mut`
66
|
77
= help: items from traits can only be used if the trait is implemented and in scope
88
note: `MyIter` defines an item `test_mut`, perhaps you need to implement it

src/test/ui/block-result/issue-3563.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco
22
--> $DIR/issue-3563.rs:3:17
33
|
44
LL | || self.b()
5-
| ^ help: there is a method with a similar name: `a`
5+
| ^ help: there is an associated function with a similar name: `a`
66

77
error: aborting due to previous error
88

src/test/ui/error-codes/E0624.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ mod inner {
88

99
fn main() {
1010
let foo = inner::Foo;
11-
foo.method(); //~ ERROR method `method` is private [E0624]
11+
foo.method(); //~ ERROR associated function `method` is private [E0624]
1212
}

src/test/ui/error-codes/E0624.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0624]: method `method` is private
1+
error[E0624]: associated function `method` is private
22
--> $DIR/E0624.rs:11:9
33
|
44
LL | foo.method();

src/test/ui/explore-issue-38412.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ LL | r.unstable_undeclared();
7979
= note: see issue #38412 <https://github.com/rust-lang/rust/issues/38412> for more information
8080
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
8181

82-
error[E0624]: method `pub_crate` is private
82+
error[E0624]: associated function `pub_crate` is private
8383
--> $DIR/explore-issue-38412.rs:50:7
8484
|
8585
LL | r.pub_crate();
8686
| ^^^^^^^^^
8787

88-
error[E0624]: method `pub_mod` is private
88+
error[E0624]: associated function `pub_mod` is private
8989
--> $DIR/explore-issue-38412.rs:51:7
9090
|
9191
LL | r.pub_mod();
9292
| ^^^^^^^
9393

94-
error[E0624]: method `private` is private
94+
error[E0624]: associated function `private` is private
9595
--> $DIR/explore-issue-38412.rs:52:7
9696
|
9797
LL | r.private();
@@ -115,19 +115,19 @@ LL | t.unstable_undeclared();
115115
= note: see issue #38412 <https://github.com/rust-lang/rust/issues/38412> for more information
116116
= help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable
117117

118-
error[E0624]: method `pub_crate` is private
118+
error[E0624]: associated function `pub_crate` is private
119119
--> $DIR/explore-issue-38412.rs:63:7
120120
|
121121
LL | t.pub_crate();
122122
| ^^^^^^^^^
123123

124-
error[E0624]: method `pub_mod` is private
124+
error[E0624]: associated function `pub_mod` is private
125125
--> $DIR/explore-issue-38412.rs:64:7
126126
|
127127
LL | t.pub_mod();
128128
| ^^^^^^^
129129

130-
error[E0624]: method `private` is private
130+
error[E0624]: associated function `private` is private
131131
--> $DIR/explore-issue-38412.rs:65:7
132132
|
133133
LL | t.private();

src/test/ui/fn-in-pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn hof<F>(_: F) where F: FnMut(()) {}
88

99
fn ice() {
1010
hof(|c| match c {
11-
A::new() => (), //~ ERROR expected tuple struct or tuple variant, found method
11+
A::new() => (), //~ ERROR expected tuple struct or tuple variant, found associated function
1212
_ => ()
1313
})
1414
}

0 commit comments

Comments
 (0)