]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/const-generics/const-impl.rs
Rollup merge of #100487 - tmiasko:assert-safe, r=petrochenkov
[rust.git] / src / test / rustdoc / const-generics / const-impl.rs
1 #![allow(incomplete_features)]
2 #![feature(adt_const_params)]
3 #![crate_name = "foo"]
4
5 #[derive(PartialEq, Eq)]
6 pub enum Order {
7     Sorted,
8     Unsorted,
9 }
10
11 // @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
12 // @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
13 // @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
14 pub struct VSet<T, const ORDER: Order> {
15     inner: Vec<T>,
16 }
17
18 // @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3ASorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
19 impl<T> VSet<T, { Order::Sorted }> {
20     pub fn new() -> Self {
21         Self { inner: Vec::new() }
22     }
23 }
24
25 // @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3AUnsorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Unsorted }>'
26 impl<T> VSet<T, { Order::Unsorted }> {
27     pub fn new() -> Self {
28         Self { inner: Vec::new() }
29     }
30 }
31
32 pub struct Escape<const S: &'static str>;
33
34 // @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr#%22%3Cscript%3Ealert(%22Escape%22)%3B%3C/script%3E%22#%3E"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
35 impl Escape<r#"<script>alert("Escape");</script>"#> {
36     pub fn f() {}
37 }