]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/issue-100222.rs
fix tidy
[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 impl const IndexMut for <() as Index>::Output {
20     const C: <Self as Index>::Output = ();
21     type Assoc = <Self as Index>::Output;
22     fn foo(&mut self, x: <Self as Index>::Output) -> <Self as Index>::Output
23         where <Self as Index>::Output:,
24     {}
25 }
26
27 const C: <() as Index>::Output = ();
28
29 fn main() {}