about summary refs log tree commit diff
path: root/src/test/ui/suggestions
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-07-18 11:41:21 -0700
committerEsteban Küber <esteban@kuber.com.ar>2017-07-18 13:33:36 -0700
commite39bcecf79a6951f528b12b47ea671f9b0328bb3 (patch)
treef63798cafedefb476c2e44061b81727fc520b3b3 /src/test/ui/suggestions
parentfaf90351b79de04de0176b1e0de07cc5f1730eaa (diff)
downloadrust-e39bcecf79a6951f528b12b47ea671f9b0328bb3.tar.gz
rust-e39bcecf79a6951f528b12b47ea671f9b0328bb3.zip
Handle type ascription cases with a method call instead of a type
Diffstat (limited to 'src/test/ui/suggestions')
-rw-r--r--src/test/ui/suggestions/type-ascription-with-fn-call.rs18
-rw-r--r--src/test/ui/suggestions/type-ascription-with-fn-call.stderr13
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/type-ascription-with-fn-call.rs b/src/test/ui/suggestions/type-ascription-with-fn-call.rs
new file mode 100644
index 00000000000..7c10bf98c84
--- /dev/null
+++ b/src/test/ui/suggestions/type-ascription-with-fn-call.rs
@@ -0,0 +1,18 @@
+// Copyright 2017 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.
+
+#![feature(type_ascription)]
+
+fn main() {
+    f()  :
+    f();
+}
+
+fn f() {}
diff --git a/src/test/ui/suggestions/type-ascription-with-fn-call.stderr b/src/test/ui/suggestions/type-ascription-with-fn-call.stderr
new file mode 100644
index 00000000000..93c65c263dd
--- /dev/null
+++ b/src/test/ui/suggestions/type-ascription-with-fn-call.stderr
@@ -0,0 +1,13 @@
+error[E0573]: expected type, found function `f`
+  --> $DIR/type-ascription-with-fn-call.rs:15:5
+   |
+14 |     f()  :
+   |          - help: did you mean to use `;` here instead?
+15 |     f();
+   |     ^^^
+   |     |
+   |     not a type
+   |     expecting a type here because of type ascription
+
+error: aborting due to previous error
+