]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/const-generics/const-impl.rs
Merge commit '533f0fc81ab9ba097779fcd27c8f9ea12261fef5' into psimd
[rust.git] / src / test / rustdoc / const-generics / const-impl.rs
1 #![allow(incomplete_features)]
2
3 #![feature(adt_const_params)]
4
5 #![crate_name = "foo"]
6
7 #[derive(PartialEq, Eq)]
8 pub enum Order {
9     Sorted,
10     Unsorted,
11 }
12
13 // @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
14 // @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
15 // @has foo/struct.VSet.html '//div[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
16 pub struct VSet<T, const ORDER: Order> {
17     inner: Vec<T>,
18 }
19
20 // @has foo/struct.VSet.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
21 impl<T> VSet<T, { Order::Sorted }> {
22     pub fn new() -> Self {
23         Self { inner: Vec::new() }
24     }
25 }
26
27 // @has foo/struct.VSet.html '//div[@id="impl-1"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Unsorted }>'
28 impl<T> VSet<T, { Order::Unsorted }> {
29     pub fn new() -> Self {
30         Self { inner: Vec::new() }
31     }
32 }
33
34 pub struct Escape<const S: &'static str>;
35
36 // @has foo/struct.Escape.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
37 impl Escape<r#"<script>alert("Escape");</script>"#> {
38     pub fn f() {}
39 }