Why can't I use the `ty` macro matcher to construct a struct?

Viewed 75
struct A {
    x: i64,
}

macro_rules! foo {
    ($T:ty) => {
        fn test() -> $T {
            $T { x: 3 }
        }
    }
}

foo!(A);

Playground

error: expected expression, found `A`
8 |             $T { x: 3 }

I know I can use ident, but I don't get why I cannot use $T {}.

1 Answers
Related