]> git.lizzy.rs Git - rust.git/commitdiff
Prefer 'associated function' over 'static method' in msg.
authorCorey Farwell <coreyf@rwell.org>
Tue, 23 Feb 2016 05:04:30 +0000 (00:04 -0500)
committerCorey Farwell <coreyf@rwell.org>
Thu, 10 Mar 2016 05:29:39 +0000 (21:29 -0800)
TRPL seems to refer to 'static functions' as 'associated functions'.
This terminology should be used consistently.

src/librustc_typeck/check/method/suggest.rs
src/test/compile-fail/issue-7575.rs

index 1367db16314e2f53e3cbae16406546d320b5d5af..8ac002bc4dffdfea9c5b7103c63fac297422efb3 100644 (file)
@@ -141,7 +141,8 @@ macro_rules! span_did_you_mean {
             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);
             }
index 6c7196527efdbd73db01cf703c57bc6d9a41282d..3cb30981b673c0ff0aa8278f4b5915d722dd743b 100644 (file)
@@ -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() {