]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfc-2632-const-trait-impl/const-closure-trait-method-fail.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / rfc-2632-const-trait-impl / const-closure-trait-method-fail.rs
1 #![feature(const_trait_impl)]
2
3 #[const_trait]
4 trait Tr {
5     fn a(self) -> i32;
6 }
7
8 impl Tr for () {
9     fn a(self) -> i32 { 42 }
10 }
11
12 const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
13     x(())
14 }
15
16 const _: () = assert!(need_const_closure(Tr::a) == 42);
17 //~^ ERROR: the trait bound
18
19 fn main() {}