Skip to content

Commit f41dfec

Browse files
committed
Prefer 'associated function' over 'static method' in msg.
TRPL seems to refer to 'static functions' as 'associated functions'. This terminology should be used consistently.
1 parent c8fc481 commit f41dfec

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/librustc_typeck/check/method/suggest.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
141141
if !static_sources.is_empty() {
142142
err.fileline_note(
143143
span,
144-
"found defined static methods, maybe a `self` is missing?");
144+
"found the following associated functions; to be used as \
145+
methods, functions must have a `self` parameter");
145146

146147
report_candidates(fcx, &mut err, span, item_name, static_sources);
147148
}

src/test/compile-fail/issue-7575.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ impl ManyImplTrait for Myisize {}
7272
fn no_param_bound(u: usize, m: Myisize) -> usize {
7373
u.f8(42) + u.f9(342) + m.fff(42)
7474
//~^ ERROR no method named `f9` found for type `usize` in the current scope
75-
//~^^ NOTE found defined static methods, maybe a `self` is missing?
75+
//~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
7676
//~^^^ ERROR no method named `fff` found for type `Myisize` in the current scope
77-
//~^^^^ NOTE found defined static methods, maybe a `self` is missing?
77+
//~^^^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
7878
}
7979

8080
fn param_bound<T: ManyImplTrait>(t: T) -> bool {
8181
t.is_str()
8282
//~^ ERROR no method named `is_str` found for type `T` in the current scope
83-
//~^^ NOTE found defined static methods, maybe a `self` is missing?
83+
//~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter
8484
}
8585

8686
fn main() {

0 commit comments

Comments
 (0)