Closed
Description
This code doesn't seem to compile with the following error [playground]:
macro_rules! foo {
($t:ty) => {
fn bar<T>(_: T) where T: $t {}
}
}
foo!(std::fmt::Debug);
error: expected one of `!`, `(`, `,`, `?`, `for`, `{`, `~`, lifetime, or path, found `std::fmt::Debug`
--> src/main.rs:3:34
|
3 | fn bar<T>(_: T) where T: $t {}
| ^^ expected one of 9 possible tokens
...
7 | foo!(std::fmt::Debug);
| --------------------- in this macro invocation
|
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
There should be no error since ty
designator stands for type, std::fmt::Debug
is definitely a type and where clause accepts trait types.
This problem persists on any channel I've tested it - stable, beta and nightly.