about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/typeck/issue-88803-call-expr-method.fixed9
-rw-r--r--src/test/ui/typeck/issue-88803-call-expr-method.rs9
-rw-r--r--src/test/ui/typeck/issue-88803-call-expr-method.stderr15
3 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.fixed b/src/test/ui/typeck/issue-88803-call-expr-method.fixed
new file mode 100644
index 00000000000..19b96ecf3fc
--- /dev/null
+++ b/src/test/ui/typeck/issue-88803-call-expr-method.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+
+fn main() {
+    let a = Some(42);
+    println!(
+        "The value is {}.",
+        a.unwrap() //~ERROR [E0615]
+    );
+}
diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.rs b/src/test/ui/typeck/issue-88803-call-expr-method.rs
new file mode 100644
index 00000000000..a0619946637
--- /dev/null
+++ b/src/test/ui/typeck/issue-88803-call-expr-method.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+
+fn main() {
+    let a = Some(42);
+    println!(
+        "The value is {}.",
+        (a.unwrap)() //~ERROR [E0615]
+    );
+}
diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.stderr b/src/test/ui/typeck/issue-88803-call-expr-method.stderr
new file mode 100644
index 00000000000..dd717ed9416
--- /dev/null
+++ b/src/test/ui/typeck/issue-88803-call-expr-method.stderr
@@ -0,0 +1,15 @@
+error[E0615]: attempted to take value of method `unwrap` on type `Option<{integer}>`
+  --> $DIR/issue-88803-call-expr-method.rs:7:12
+   |
+LL |         (a.unwrap)()
+   |            ^^^^^^ method, not a field
+   |
+help: remove wrapping parentheses to call the method
+   |
+LL -         (a.unwrap)()
+LL +         a.unwrap()
+   | 
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0615`.