title: Why do I need to dereference a variable when comparing it but not when doing arithmetic?
body: <p>I have the following code:</p>
  
  <pre><code>fn example(known_primes: &amp;[i32], number: i32, prime: i32, limit: i32) {
      let mut is_prime = true;
  
      for prime in known_primes {
          if number % prime == 0 {
              is_prime = false;
              break;
          }
          if *prime &gt; limit {
              break;
          }
      }
  }
  </code></pre>
  
  <p>Why do I need to dereference <code>prime</code> in the second condition (<code>*prime &gt; limit</code>), when I don't need to do so in the first one (<code>number % prime == 0</code>)?</p>
  
  <p>Both <code>%</code> and <code>&lt;</code> are operators that take two numbers and return something. The only difference seems to be in what they return (a number vs. a boolean). While <a href="https://stackoverflow.com/questions/40677086/why-isnt-it-possible-to-compare-a-borrowed-integer-to-a-literal-integer">Why isn&#39;t it possible to compare a borrowed integer to a literal integer?</a> <em>does</em> explain what would be required to make the code work (implementations for all overloads, ideally in the standard library), it <em>does not</em> say why it does work for <code>a % b</code>. Is there a fundamental difference between these operators? Or is it just not implemented yet?</p>