summaryrefslogtreecommitdiffstats
path: root/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
new file mode 100644
index 000000000..b5f139590
--- /dev/null
+++ b/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
@@ -0,0 +1,18 @@
+struct Foo {
+ field: u32,
+}
+
+impl Foo {
+ fn field(&self) -> u32 {
+ self.field
+ }
+
+ fn new() -> Foo {
+ field; //~ ERROR cannot find value `field` in this scope
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+ fn clone(&self) -> Foo {
+ Foo { field } //~ ERROR cannot find value `field` in this scope
+ }
+}
+fn main() {}