]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / issue-100222.rs
1 // revisions: nn ny yn yy
2 // check-pass
3 #![feature(const_trait_impl, associated_type_defaults, const_mut_refs)]
4
5 #[cfg_attr(any(yn, yy), const_trait)]
6 pub trait Index {
7     type Output;
8 }
9
10 #[cfg_attr(any(ny, yy), const_trait)]
11 pub trait IndexMut where Self: Index {
12     const C: <Self as Index>::Output;
13     type Assoc = <Self as Index>::Output;
14     fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output;
15 }
16
17 impl Index for () { type Output = (); }
18
19 #[cfg(not(any(nn, yn)))]
20 impl const IndexMut for <() as Index>::Output {
21     const C: <Self as Index>::Output = ();
22     type Assoc = <Self as Index>::Output;
23     fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output
24         where <Self as Index>::Output:,
25     {}
26 }
27
28 #[cfg(any(nn, yn))]
29 impl IndexMut for <() as Index>::Output {
30     const C: <Self as Index>::Output = ();
31     type Assoc = <Self as Index>::Output;
32     fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output
33         where <Self as Index>::Output:,
34     {}
35 }
36
37 const C: <() as Index>::Output = ();
38
39 fn main() {}