error[E0599]: no function or associated item named `hello_world` found for type `T` in the current scope
--> tests/dummy.rs:36:16
|
31 | | $generic::hello_world();
| |_____________________________^
...
36 | say_hello!(T);
| _____-----------^--
| | |
| | in this macro invocation
The problem here is not the macro, but the code. You can just try to compile the same code without the macro and you will get the same function. The issue is that you have not told the compiler in any way that T has a function hello_world so when you do T::hello_world() it tells you exactly that. Potentially what you want is (I've intentionally kept your macro):
It looks like the compiler correctly points out the error. You want an expr, not a type. The two are subtly different here, which becomes more clear if you consider generics. The type Vec<u8> would be invalid if inserted here. Instead you would need Vec::<u8> which is an expression.