]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/const-generics/const-impl.rs
Add a const-generics folder to rustdoc tests
[rust.git] / src / test / rustdoc / const-generics / const-impl.rs
1 // ignore-tidy-linelength
2
3 #![feature(const_generics)]
4
5 #![crate_name = "foo"]
6
7 pub enum Order {
8     Sorted,
9     Unsorted,
10 }
11
12 // @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
13 // @has foo/struct.VSet.html '//h3[@id="impl-Send"]/code' 'impl<const ORDER: Order, T> Send for VSet<T, ORDER>'
14 // @has foo/struct.VSet.html '//h3[@id="impl-Sync"]/code' 'impl<const ORDER: Order, T> Sync for VSet<T, ORDER>'
15 pub struct VSet<T, const ORDER: Order> {
16     inner: Vec<T>,
17 }
18
19 // @has foo/struct.VSet.html '//h3[@id="impl"]/code' 'impl<T> VSet<T, { Order::Sorted }>'
20 impl <T> VSet<T, {Order::Sorted}> {
21     pub fn new() -> Self {
22         Self { inner: Vec::new() }
23     }
24 }
25
26 // @has foo/struct.VSet.html '//h3[@id="impl-1"]/code' 'impl<T> VSet<T, { Order::Unsorted }>'
27 impl <T> VSet<T, {Order::Unsorted}> {
28     pub fn new() -> Self {
29         Self { inner: Vec::new() }
30     }
31 }