diff --git a/src/test/ui/hygiene/issue-61574-const-parameters.rs b/src/test/ui/hygiene/issue-61574-const-parameters.rs new file mode 100644 index 0000000000000..dcfb42287d5cb --- /dev/null +++ b/src/test/ui/hygiene/issue-61574-const-parameters.rs @@ -0,0 +1,32 @@ +// A more comprehensive test that const parameters have correctly implemented +// hygiene + +// check-pass + +#![feature(const_generics)] + +use std::ops::Add; + +struct VectorLike([T; {SIZE}]); + +macro_rules! impl_operator_overload { + ($trait_ident:ident, $method_ident:ident) => { + + impl $trait_ident for VectorLike + where + T: $trait_ident, + { + type Output = VectorLike; + + fn $method_ident(self, _: VectorLike) -> VectorLike { + let _ = SIZE; + unimplemented!() + } + } + + } +} + +impl_operator_overload!(Add, add); + +fn main() {} diff --git a/src/test/ui/hygiene/issue-61574-const-parameters.stderr b/src/test/ui/hygiene/issue-61574-const-parameters.stderr new file mode 100644 index 0000000000000..302b5fde8879c --- /dev/null +++ b/src/test/ui/hygiene/issue-61574-const-parameters.stderr @@ -0,0 +1,6 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/issue-61574-const-parameters.rs:6:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ +