]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/const-generics/const-impl.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / rustdoc / const-generics / const-impl.rs
CommitLineData
a2a8927a 1#![allow(incomplete_features)]
94222f64 2#![feature(adt_const_params)]
dc9dc135 3#![crate_name = "foo"]
48663c56 4
e74abb32 5#[derive(PartialEq, Eq)]
48663c56
XL
6pub 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>'
064997fb
FG
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>'
48663c56
XL
14pub struct VSet<T, const ORDER: Order> {
15 inner: Vec<T>,
16}
17
064997fb 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 }>'
a2a8927a 19impl<T> VSet<T, { Order::Sorted }> {
48663c56
XL
20 pub fn new() -> Self {
21 Self { inner: Vec::new() }
22 }
23}
24
064997fb 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 }>'
a2a8927a 26impl<T> VSet<T, { Order::Unsorted }> {
48663c56
XL
27 pub fn new() -> Self {
28 Self { inner: Vec::new() }
29 }
30}
dfeec247
XL
31
32pub struct Escape<const S: &'static str>;
33
064997fb 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>"#>'
a2a8927a 35impl Escape<r#"<script>alert("Escape");</script>"#> {
dfeec247
XL
36 pub fn f() {}
37}