diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-03-10 14:01:53 +0300 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-03-10 14:01:53 +0300 |
| commit | 09e08bac9355179476b30fce4f0f98c0b395e1c8 (patch) | |
| tree | 742f56699bbcabe0e4bc1a42ad7ae7542f9b05c6 /src | |
| parent | 3ac4076ac0e4276dce59cd254dfa2c5cf848dca8 (diff) | |
| parent | d9dba7699f6f9771f28438c2c49d920536d76a26 (diff) | |
| download | rust-09e08bac9355179476b30fce4f0f98c0b395e1c8.tar.gz rust-09e08bac9355179476b30fce4f0f98c0b395e1c8.zip | |
Rollup merge of #31830 - frewsxcv:assoc-func, r=steveklabnik
Prefer 'associated function' over 'static method' in msg. TRPL seems to refer to 'static functions' as 'associated functions'. This terminology should be used consistently.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/check/method/suggest.rs | 3 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-7575.rs | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 7dc9d46c303..cdf7e1bd33a 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -141,7 +141,8 @@ pub fn report_error<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, if !static_sources.is_empty() { err.fileline_note( span, - "found defined static methods, maybe a `self` is missing?"); + "found the following associated functions; to be used as \ + methods, functions must have a `self` parameter"); report_candidates(fcx, &mut err, span, item_name, static_sources); } diff --git a/src/test/compile-fail/issue-7575.rs b/src/test/compile-fail/issue-7575.rs index 6c7196527ef..3cb30981b67 100644 --- a/src/test/compile-fail/issue-7575.rs +++ b/src/test/compile-fail/issue-7575.rs @@ -9,6 +9,7 @@ // except according to those terms. // Test the mechanism for warning about possible missing `self` declarations. +// ignore-tidy-linelength trait CtxtFn { fn f8(self, usize) -> usize; @@ -72,15 +73,15 @@ impl ManyImplTrait for Myisize {} fn no_param_bound(u: usize, m: Myisize) -> usize { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR no method named `f9` found for type `usize` in the current scope - //~^^ NOTE found defined static methods, maybe a `self` is missing? + //~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter //~^^^ ERROR no method named `fff` found for type `Myisize` in the current scope - //~^^^^ NOTE found defined static methods, maybe a `self` is missing? + //~^^^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter } fn param_bound<T: ManyImplTrait>(t: T) -> bool { t.is_str() //~^ ERROR no method named `is_str` found for type `T` in the current scope - //~^^ NOTE found defined static methods, maybe a `self` is missing? + //~^^ NOTE found the following associated functions; to be used as methods, functions must have a `self` parameter } fn main() { |
