]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/min_const_generics/self-ty-in-const-1.rs
Add tests for `#[no_mangle]` in `impl` blocks that looks like generic `impl` blocks...
[rust.git] / src / test / ui / const-generics / min_const_generics / self-ty-in-const-1.rs
1 trait Foo {
2     fn t1() -> [u8; std::mem::size_of::<Self>()]; //~ERROR generic parameters
3 }
4
5 struct Bar<T>(T);
6
7 impl Bar<u8> {
8     fn t2() -> [u8; std::mem::size_of::<Self>()] { todo!() } // ok
9 }
10
11 impl<T> Bar<T> {
12     fn t3() -> [u8; std::mem::size_of::<Self>()] {} //~ERROR generic `Self`
13 }
14
15 trait Baz {
16     fn hey();
17 }
18
19 impl Baz for u16 {
20     fn hey() {
21         let _: [u8; std::mem::size_of::<Self>()]; // ok
22     }
23 }
24
25 fn main() {}