summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-05-24 17:34:23 -0400
committerPietro Albini <pietro@pietroalbini.org>2018-06-03 12:04:09 +0200
commit10f8495e732d8d39b580f603b36110173557e9bc (patch)
tree19e70ac877902b36176a136c917cbdebac29f205 /src/test
parent068f4e00d4617430ece73cc6db19fac137bca297 (diff)
downloadrust-10f8495e732d8d39b580f603b36110173557e9bc.tar.gz
rust-10f8495e732d8d39b580f603b36110173557e9bc.zip
prohibit turbofish in `impl Trait` methods
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs27
-rw-r--r--src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr9
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs
new file mode 100644
index 00000000000..ac53612d2da
--- /dev/null
+++ b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs
@@ -0,0 +1,27 @@
+// 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.
+
+use std::any::Any;
+pub struct EventHandler {
+}
+
+impl EventHandler
+{
+    pub fn handle_event<T: Any>(&mut self, _efunc: impl FnMut(T)) {}
+}
+
+struct TestEvent(i32);
+
+fn main() {
+    let mut evt = EventHandler {};
+    evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
+        //~^ ERROR cannot provide explicit type parameters
+    });
+}
diff --git a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr
new file mode 100644
index 00000000000..fec3f78535d
--- /dev/null
+++ b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr
@@ -0,0 +1,9 @@
+error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
+  --> $DIR/universal-turbofish-in-method-issue-50950.rs:24:9
+   |
+LL |     evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
+   |         ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0632`.