]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/issue-61574-const-parameters.rs
Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov
[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 use std::ops::Add;
7
8 struct VectorLike<T, const SIZE: usize>([T; {SIZE}]);
9
10 macro_rules! impl_operator_overload {
11     ($trait_ident:ident, $method_ident:ident) => {
12
13         impl<T, const SIZE: usize> $trait_ident for VectorLike<T, {SIZE}>
14         where
15             T: $trait_ident,
16         {
17             type Output = VectorLike<T, {SIZE}>;
18
19             fn $method_ident(self, _: VectorLike<T, {SIZE}>) -> VectorLike<T, {SIZE}> {
20                 let _ = SIZE;
21                 unimplemented!()
22             }
23         }
24
25     }
26 }
27
28 impl_operator_overload!(Add, add);
29
30 fn main() {}