about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorggomez <guillaume1.gomez@gmail.com>2016-05-13 17:17:10 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2016-05-23 01:18:06 +0200
commit145747ebfc5518a20bf7ccddebc20c49bb4203ba (patch)
treebcc9cc1cc39c9f219373d0db8ea1315915f63907 /src/test
parente87cd7e380c89e3f80ceab417e3525e546a1e362 (diff)
downloadrust-145747ebfc5518a20bf7ccddebc20c49bb4203ba.tar.gz
rust-145747ebfc5518a20bf7ccddebc20c49bb4203ba.zip
Don't suggest using fields in a static method
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/issue-2356.rs7
-rw-r--r--src/test/compile-fail/unresolved_static_type_field.rs24
2 files changed, 29 insertions, 2 deletions
diff --git a/src/test/compile-fail/issue-2356.rs b/src/test/compile-fail/issue-2356.rs
index 6b81afe13c6..5e816bcfa61 100644
--- a/src/test/compile-fail/issue-2356.rs
+++ b/src/test/compile-fail/issue-2356.rs
@@ -32,7 +32,8 @@ impl MaybeDog {
 impl Groom for cat {
   fn shave(other: usize) {
     whiskers -= other;
-    //~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
+    //~^ ERROR: unresolved name `whiskers`
+    //~| HELP this is an associated function
     shave(4);
     //~^ ERROR: unresolved name `shave`. Did you mean to call `Groom::shave`?
     purr();
@@ -77,7 +78,8 @@ impl cat {
 
   pub fn grow_older(other:usize) {
     whiskers = 4;
-    //~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
+    //~^ ERROR: unresolved name `whiskers`
+    //~| HELP this is an associated function
     purr_louder();
     //~^ ERROR: unresolved name `purr_louder`
   }
@@ -86,5 +88,6 @@ impl cat {
 fn main() {
     self += 1;
     //~^ ERROR: unresolved name `self`
+    //~| HELP: Module
     // it's a bug if this suggests a missing `self` as we're not in a method
 }
diff --git a/src/test/compile-fail/unresolved_static_type_field.rs b/src/test/compile-fail/unresolved_static_type_field.rs
new file mode 100644
index 00000000000..80f6108f02d
--- /dev/null
+++ b/src/test/compile-fail/unresolved_static_type_field.rs
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(_: bool) {}
+
+struct Foo {
+    cx: bool,
+}
+
+impl Foo {
+    fn bar() {
+        f(cx); //~ ERROR E0425
+               //~| HELP this is an associated function
+    }
+}
+
+fn main() {}