2023-02-16 14:32:59 -06:00
|
|
|
// revisions: fn_once_bad_item fn_once_bad_sig fn_mut_bad_item fn_mut_bad_sig fn_bad_item fn_bad_sig
|
2021-06-12 05:48:04 -05:00
|
|
|
|
|
|
|
#![feature(lang_items)]
|
|
|
|
#![feature(no_core)]
|
|
|
|
#![no_core]
|
|
|
|
|
2023-02-16 14:32:59 -06:00
|
|
|
#[lang = "sized"]
|
|
|
|
trait Sized {}
|
|
|
|
|
|
|
|
#[cfg(any(fn_bad_item, fn_bad_sig))]
|
2021-06-12 05:48:04 -05:00
|
|
|
#[lang = "fn"]
|
|
|
|
trait MyFn<T> {
|
2023-02-16 14:32:59 -06:00
|
|
|
#[cfg(fn_bad_sig)]
|
|
|
|
fn call(i: i32) -> i32 { 0 }
|
|
|
|
|
|
|
|
#[cfg(fn_bad_item)]
|
2021-06-12 05:48:04 -05:00
|
|
|
const call: i32 = 42;
|
|
|
|
}
|
|
|
|
|
2023-02-16 14:32:59 -06:00
|
|
|
#[cfg(any(fn_mut_bad_item, fn_mut_bad_sig))]
|
2021-06-12 05:48:04 -05:00
|
|
|
#[lang = "fn_mut"]
|
|
|
|
trait MyFnMut<T> {
|
2023-02-16 14:32:59 -06:00
|
|
|
#[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;
|
2021-06-12 05:48:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a = || 42;
|
|
|
|
a();
|
2023-02-16 14:32:59 -06:00
|
|
|
//~^ ERROR failed to find an overloaded call trait for closure call
|
2021-06-12 05:48:04 -05:00
|
|
|
|
|
|
|
let mut i = 0;
|
2023-02-16 14:32:59 -06:00
|
|
|
let mut b = || { };
|
2021-06-12 05:48:04 -05:00
|
|
|
b();
|
2023-02-16 14:32:59 -06:00
|
|
|
//~^ ERROR failed to find an overloaded call trait for closure call
|
2021-06-12 05:48:04 -05:00
|
|
|
}
|