]> git.lizzy.rs Git - rust.git/blob - tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
Rollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiser
[rust.git] / tests / ui / lang-items / fn-fn_mut-call-ill-formed.rs
1 // Make sure that an error is reported if the `call` function of the
2 // `fn`/`fn_mut` lang item is grossly ill-formed.
3
4 #![feature(lang_items)]
5 #![feature(no_core)]
6 #![no_core]
7
8 #[lang = "fn"]
9 trait MyFn<T> {
10     const call: i32 = 42;
11     //~^ ERROR: `call` trait item in `fn` lang item must be a function
12 }
13
14 #[lang = "fn_mut"]
15 trait MyFnMut<T> {
16     fn call(i: i32, j: i32) -> i32 { i + j }
17     //~^ ERROR: first argument of `call` in `fn_mut` lang item must be a reference
18 }
19
20 fn main() {
21     let a = || 42;
22     a();
23
24     let mut i = 0;
25     let mut b = || { i += 1; };
26     b();
27 }