Skip to content

Commit 0ffd85d

Browse files
authored
Rollup merge of rust-lang#69498 - mark-i-m:describe-it-2, r=matthewjasper
Change "method" to "associated function" r? @matthewjasper cc @Centril @eddyb rust-lang#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 rust-lang#67742)
2 parents 8f35707 + b6518f0 commit 0ffd85d

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

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

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

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

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

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

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

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

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

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

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0164]: expected tuple struct or tuple variant, found method `A::new`
1+
error[E0164]: expected tuple struct or tuple variant, found associated function `A::new`
22
--> $DIR/fn-in-pat.rs:11:9
33
|
44
LL | A::new() => (),
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0521]: borrowed data escapes outside of method
1+
error[E0521]: borrowed data escapes outside of associated function
22
--> $DIR/issue-16683.rs:4:9
33
|
44
LL | fn b(&self) {
5-
| ----- `self` is a reference that is only valid in the method body
5+
| ----- `self` is a reference that is only valid in the associated function body
66
LL | self.a();
7-
| ^^^^^^^^ `self` escapes the method body here
7+
| ^^^^^^^^ `self` escapes the associated function body here
88

99
error: aborting due to previous error
1010

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0521]: borrowed data escapes outside of method
1+
error[E0521]: borrowed data escapes outside of associated function
22
--> $DIR/issue-17758.rs:7:9
33
|
44
LL | fn bar(&self) {
5-
| ----- `self` is a reference that is only valid in the method body
5+
| ----- `self` is a reference that is only valid in the associated function body
66
LL | self.foo();
7-
| ^^^^^^^^^^ `self` escapes the method body here
7+
| ^^^^^^^^^^ `self` escapes the associated function body here
88

99
error: aborting due to previous error
1010

src/test/ui/issues/issue-21202.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod B {
88
use crate1::A::Foo;
99
fn bar(f: Foo) {
1010
Foo::foo(&f);
11-
//~^ ERROR: method `foo` is private
11+
//~^ ERROR: associated function `foo` is private
1212
}
1313
}
1414

src/test/ui/issues/issue-21202.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0624]: method `foo` is private
1+
error[E0624]: associated function `foo` is private
22
--> $DIR/issue-21202.rs:10:9
33
|
44
LL | Foo::foo(&f);

src/test/ui/issues/issue-28344.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
1111
| ^^^^^
1212
| |
1313
| function or associated item not found in `dyn std::ops::BitXor<_>`
14-
| help: there is a method with a similar name: `bitxor`
14+
| help: there is an associated function with a similar name: `bitxor`
1515

1616
error[E0191]: the value of the associated type `Output` (from trait `std::ops::BitXor`) must be specified
1717
--> $DIR/issue-28344.rs:8:13
@@ -26,7 +26,7 @@ LL | let g = BitXor::bitor;
2626
| ^^^^^
2727
| |
2828
| function or associated item not found in `dyn std::ops::BitXor<_>`
29-
| help: there is a method with a similar name: `bitxor`
29+
| help: there is an associated function with a similar name: `bitxor`
3030

3131
error: aborting due to 4 previous errors
3232

src/test/ui/issues/issue-3763.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ fn main() {
2121
let _woohoo = (Box::new(my_struct)).priv_field;
2222
//~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
2323

24-
(&my_struct).happyfun(); //~ ERROR method `happyfun` is private
24+
(&my_struct).happyfun(); //~ ERROR associated function `happyfun` is private
2525

26-
(Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
26+
(Box::new(my_struct)).happyfun(); //~ ERROR associated function `happyfun` is private
2727
let nope = my_struct.priv_field;
2828
//~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
2929
}

src/test/ui/issues/issue-3763.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
1010
LL | let _woohoo = (Box::new(my_struct)).priv_field;
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error[E0624]: method `happyfun` is private
13+
error[E0624]: associated function `happyfun` is private
1414
--> $DIR/issue-3763.rs:24:18
1515
|
1616
LL | (&my_struct).happyfun();
1717
| ^^^^^^^^
1818

19-
error[E0624]: method `happyfun` is private
19+
error[E0624]: associated function `happyfun` is private
2020
--> $DIR/issue-3763.rs:26:27
2121
|
2222
LL | (Box::new(my_struct)).happyfun();

src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for enum `std::option::Option<{in
22
--> $DIR/option-as_deref.rs:2:29
33
|
44
LL | let _result = &Some(42).as_deref();
5-
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
5+
| ^^^^^^^^ help: there is an associated function with a similar name: `as_ref`
66
|
77
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
88
`{integer}: std::ops::Deref`

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for enum `std::result::Result<{in
22
--> $DIR/result-as_deref.rs:4:27
33
|
44
LL | let _result = &Ok(42).as_deref();
5-
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
5+
| ^^^^^^^^ help: there is an associated function with a similar name: `as_ref`
66
|
77
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
88
`{integer}: std::ops::Deref`

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_err` found for enum `std::result::Result
22
--> $DIR/result-as_deref_err.rs:4:28
33
|
44
LL | let _result = &Err(41).as_deref_err();
5-
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut`
5+
| ^^^^^^^^^^^^ help: there is an associated function with a similar name: `as_deref_mut`
66
|
77
= note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
88
`{integer}: std::ops::Deref`

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut` found for enum `std::result::Result
22
--> $DIR/result-as_deref_mut.rs:4:31
33
|
44
LL | let _result = &mut Ok(42).as_deref_mut();
5-
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
5+
| ^^^^^^^^^^^^ help: there is an associated function with a similar name: `as_deref_err`
66
|
77
= note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
88
`{integer}: std::ops::DerefMut`

src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_err` found for enum `std::result::Re
22
--> $DIR/result-as_deref_mut_err.rs:4:32
33
|
44
LL | let _result = &mut Err(41).as_deref_mut_err();
5-
| ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut`
5+
| ^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `as_deref_mut`
66
|
77
= note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
88
`{integer}: std::ops::DerefMut`

src/test/ui/issues/issue-53498.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ pub mod test {
1313
}
1414

1515
fn main() {
16-
test::Foo::<test::B>::foo(); //~ ERROR method `foo` is private
16+
test::Foo::<test::B>::foo(); //~ ERROR associated function `foo` is private
1717
}

src/test/ui/issues/issue-53498.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0624]: method `foo` is private
1+
error[E0624]: associated function `foo` is private
22
--> $DIR/issue-53498.rs:16:5
33
|
44
LL | test::Foo::<test::B>::foo();

src/test/ui/issues/issue-55587.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0164]: expected tuple struct or tuple variant, found method `Path::new`
1+
error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new`
22
--> $DIR/issue-55587.rs:4:9
33
|
44
LL | let Path::new();

src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
77
| lifetime `'a` defined here
88
LL |
99
LL | if x > y { x } else { y }
10-
| ^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
10+
| ^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
1111

1212
error: aborting due to previous error
1313

src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
77
| lifetime `'a` defined here
88
LL |
99
LL | x
10-
| ^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
10+
| ^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
1111

1212
error: aborting due to previous error
1313

src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
77
| lifetime `'a` defined here
88
LL |
99
LL | if true { x } else { self }
10-
| ^^^^ method was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
10+
| ^^^^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
1111

1212
error: aborting due to previous error
1313

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &i32) -> &i32 {
66
| |
77
| let's call the lifetime of this reference `'2`
88
LL | x
9-
| ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
9+
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
1010

1111
error: aborting due to previous error
1212

src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &Foo) -> &Foo {
66
| |
77
| let's call the lifetime of this reference `'2`
88
LL | if true { x } else { self }
9-
| ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
9+
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
1010

1111
error: aborting due to previous error
1212

src/test/ui/match/match-fn-call.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error[E0164]: expected tuple struct or tuple variant, found method `Path::new`
1+
error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new`
22
--> $DIR/match-fn-call.rs:6:9
33
|
44
LL | Path::new("foo") => println!("foo"),
55
| ^^^^^^^^^^^^^^^^ `fn` calls are not allowed in patterns
66
|
77
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
88

9-
error[E0164]: expected tuple struct or tuple variant, found method `Path::new`
9+
error[E0164]: expected tuple struct or tuple variant, found associated function `Path::new`
1010
--> $DIR/match-fn-call.rs:8:9
1111
|
1212
LL | Path::new("bar") => println!("bar"),

src/test/ui/methods/method-path-in-pattern.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ impl MyTrait for Foo {}
1313
fn main() {
1414
match 0u32 {
1515
Foo::bar => {}
16-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
16+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
1717
}
1818
match 0u32 {
1919
<Foo>::bar => {}
20-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
20+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
2121
}
2222
match 0u32 {
2323
<Foo>::trait_bar => {}
24-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::trait_bar`
24+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
2525
}
2626
if let Foo::bar = 0u32 {}
27-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
27+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
2828
if let <Foo>::bar = 0u32 {}
29-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
29+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
3030
if let Foo::trait_bar = 0u32 {}
31-
//~^ ERROR expected unit struct, unit variant or constant, found method `Foo::trait_bar`
31+
//~^ ERROR expected unit struct, unit variant or constant, found associated function
3232
}

0 commit comments

Comments
 (0)