]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-3.rs
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / super-traits-fail-3.rs
1 #![feature(const_trait_impl)]
2
3 // revisions: yy yn ny nn
4 //[yy] check-pass
5
6 #[cfg_attr(any(yy, yn), const_trait)]
7 trait Foo {
8     fn a(&self);
9 }
10
11 #[cfg_attr(any(yy, ny), const_trait)]
12 trait Bar: ~const Foo {}
13 //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
14
15 const fn foo<T: ~const Bar>(x: &T) {
16     //[yn,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
17     x.a();
18 }
19
20 fn main() {}