]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/issue-61574-const-parameters.rs
Merge commit '48d60ab7c505c6c1ebb042eacaafd8dc9f7a9267' into libgccjit-codegen
[rust.git] / src / test / ui / hygiene / issue-61574-const-parameters.rs
1 // A more comprehensive test that const parameters have correctly implemented
2 // hygiene
3
4 // check-pass
5
6 #![feature(const_generics)] //~ WARNING `const_generics` is incomplete
7
8 use std::ops::Add;
9
10 struct VectorLike<T, const SIZE: usize>([T; {SIZE}]);
11
12 macro_rules! impl_operator_overload {
13     ($trait_ident:ident, $method_ident:ident) => {
14
15         impl<T, const SIZE: usize> $trait_ident for VectorLike<T, {SIZE}>
16         where
17             T: $trait_ident,
18         {
19             type Output = VectorLike<T, {SIZE}>;
20
21             fn $method_ident(self, _: VectorLike<T, {SIZE}>) -> VectorLike<T, {SIZE}> {
22                 let _ = SIZE;
23                 unimplemented!()
24             }
25         }
26
27     }
28 }
29
30 impl_operator_overload!(Add, add);
31
32 fn main() {}