Can macros match against constant arguments instead of literals?

后端 未结 2 1709
我寻月下人不归
我寻月下人不归 2020-12-21 22:07

Given the macro matching example, this shows how macros can match an argument.

I\'ve made very minor changes here to use numbers:

macro_rules! foo {
         


        
2条回答
  •  误落风尘
    2020-12-21 23:01

    I'm fairly sure the answer is "no"; at macro expansion time all you have are token trees - expansion happens before evaluation, or even type inference/checking.

提交回复
热议问题