title: Can macros match against constant arguments instead of literals?
body: <p>Given the <a href="https://doc.rust-lang.org/book/macros.html#matching" rel="nofollow">macro matching example</a>, this shows how macros can match an argument.</p>
  
  <p>I've made very minor changes here to use numbers:</p>
  
  <pre><code>macro_rules! foo {
      (0 =&gt; $e:expr) =&gt; (println!("mode X: {}", $e));
      (1 =&gt; $e:expr) =&gt; (println!("mode Y: {}", $e));
  }
  
  fn main() {
      foo!(1 =&gt; 3);
  }
  </code></pre>
  
  <p>Works, printing: <code>mode Y: 3</code></p>
  
  <p>However I would like to use a constant as an argument, can this be made to work:</p>
  
  <pre><code>const CONST: usize = 1;
  
  macro_rules! foo {
      (0 =&gt; $e:expr) =&gt; (println!("mode X: {}", $e));
      (1 =&gt; $e:expr) =&gt; (println!("mode Y: {}", $e));
  }
  
  fn main() {
      foo!(CONST =&gt; 3);
  }
  </code></pre>
  
  <p>Is this possible in Rust?</p>
  
  <hr>
  
  <p>Note, using a regular <code>match</code> statement isn't usable for me, since in my code each branch resolves to different types, giving an error.
  So I'm specifically interested to know if a constant can be passed to a macro.</p>