summaryrefslogtreecommitdiffstats
path: root/src/test/ui/trait-bounds/mismatch-fn-trait.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/trait-bounds/mismatch-fn-trait.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/trait-bounds/mismatch-fn-trait.rs b/src/test/ui/trait-bounds/mismatch-fn-trait.rs
new file mode 100644
index 000000000..0ed64043a
--- /dev/null
+++ b/src/test/ui/trait-bounds/mismatch-fn-trait.rs
@@ -0,0 +1,28 @@
+fn take(_f: impl FnMut(i32)) {}
+
+fn test1(f: impl FnMut(u32)) {
+ take(f)
+ //~^ ERROR [E0277]
+}
+
+fn test2(f: impl FnMut(i32, i32)) {
+ take(f)
+ //~^ ERROR [E0277]
+}
+
+fn test3(f: impl FnMut()) {
+ take(f)
+ //~^ ERROR [E0277]
+}
+
+fn test4(f: impl FnOnce(i32)) {
+ take(f)
+ //~^ ERROR [E0277]
+}
+
+fn test5(f: impl FnOnce(u32)) {
+ take(f)
+ //~^ ERROR [E0277]
+}
+
+fn main() {}