I tried this code:
macro_rules! impl_primitive {
($ty:ty) => { impl_primitive!(impl $ty);};
(impl $ty:ty) => { fn a(_: $ty) {} }
}
impl_primitive! { u8 }
link to playground
I expected to see this happen:
Macro is expanded to fn a(_: u8) {}
Instead, this happened:
On stable 1.67 it works as expected.
On beta 1.68 and nightly 1.69 it fails with the following error
error: expected a trait, found type
--> src/lib.rs:6:19
|
2 | ($ty:ty) => { impl_primitive!(impl $ty);};
| ------ while parsing argument for this `ty` macro fragment
...
6 | impl_primitive! { u8 }
| ^^
It is probably caused by ty fragment that now treats impl as a start of impl Trait type.
So makes sense. But breaks existing code :)
I tried this code:
link to playground
I expected to see this happen:
Macro is expanded to
fn a(_: u8) {}Instead, this happened:
On stable
1.67it works as expected.On beta
1.68and nightly1.69it fails with the following errorIt is probably caused by
tyfragment that now treatsimplas a start ofimpl Traittype.So makes sense. But breaks existing code :)