summaryrefslogtreecommitdiffstats
path: root/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs')
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs34
1 files changed, 28 insertions, 6 deletions
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
index 52bd8136d..757c6538d 100644
--- a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
@@ -1,27 +1,49 @@
-// Make sure that an error is reported if the `call` function of the
-// `fn`/`fn_mut` lang item is grossly ill-formed.
+// revisions: fn_once_bad_item fn_once_bad_sig fn_mut_bad_item fn_mut_bad_sig fn_bad_item fn_bad_sig
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]
+#[lang = "sized"]
+trait Sized {}
+
+#[cfg(any(fn_bad_item, fn_bad_sig))]
#[lang = "fn"]
trait MyFn<T> {
+ #[cfg(fn_bad_sig)]
+ fn call(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_bad_item)]
const call: i32 = 42;
- //~^ ERROR: `call` trait item in `fn` lang item must be a function
}
+#[cfg(any(fn_mut_bad_item, fn_mut_bad_sig))]
#[lang = "fn_mut"]
trait MyFnMut<T> {
- fn call(i: i32, j: i32) -> i32 { i + j }
- //~^ ERROR: first argument of `call` in `fn_mut` lang item must be a reference
+ #[cfg(fn_mut_bad_sig)]
+ fn call_mut(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_mut_bad_item)]
+ const call_mut: i32 = 42;
+}
+
+#[cfg(any(fn_once_bad_item, fn_once_bad_sig))]
+#[lang = "fn_once"]
+trait MyFnOnce<T> {
+ #[cfg(fn_once_bad_sig)]
+ fn call_once(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_once_bad_item)]
+ const call_once: i32 = 42;
}
fn main() {
let a = || 42;
a();
+ //~^ ERROR failed to find an overloaded call trait for closure call
let mut i = 0;
- let mut b = || { i += 1; };
+ let mut b = || { };
b();
+ //~^ ERROR failed to find an overloaded call trait for closure call
}