]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.rs
Rollup merge of #93813 - xldenis:public-mir-passes, r=wesleywiser
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / trait-where-clause.rs
1 #![feature(const_fn_trait_bound)]
2 #![feature(const_trait_impl)]
3
4 trait Bar {}
5
6 trait Foo {
7     fn a();
8     fn b() where Self: ~const Bar;
9     fn c<T: ~const Bar>();
10 }
11
12 const fn test1<T: ~const Foo + Bar>() {
13     T::a();
14     T::b();
15     //~^ ERROR the trait bound
16     T::c::<T>();
17     //~^ ERROR the trait bound
18 }
19
20 const fn test2<T: ~const Foo + ~const Bar>() {
21     T::a();
22     T::b();
23     T::c::<T>();
24 }
25
26 fn test3<T: Foo>() {
27     T::a();
28     T::b();
29     //~^ ERROR the trait bound
30     T::c::<T>();
31     //~^ ERROR the trait bound
32 }
33
34 fn test4<T: Foo + Bar>() {
35     T::a();
36     T::b();
37     T::c::<T>();
38 }
39
40 fn main() {}