summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc/generic_const_exprs.rs
blob: 6ff591639754620ceb10a73e9e4cf78c72893b56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Regression test for <https://github.com/rust-lang/rust/issues/92859>.

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

#![crate_name = "foo"]

// @has 'foo/trait.Foo.html'

pub trait Foo: Sized {
    const WIDTH: usize;

    fn arrayify(self) -> [Self; Self::WIDTH];
}

impl<T: Sized> Foo for T {
    const WIDTH: usize = 1;

    // @has - '//*[@id="tymethod.arrayify"]/*[@class="code-header"]' \
    // 'fn arrayify(self) -> [Self; Self::WIDTH]'
    fn arrayify(self) -> [Self; Self::WIDTH] {
        [self]
    }
}