Binary operation != cannot be applied when using generics for a bit vector
<p>I'm in the process of implementing a Bit Vector class as an exercise, however only knowing Rust for less than a week I run into trouble with the following code:</p>

<pre><code>use std::cmp::Eq;
use std::ops::BitAnd;
use std::ops::Index;
use std::ops::Not;

struct BitVector&lt;S = usize&gt; 
    where S: Sized + BitAnd&lt;usize&gt; + Not + Eq {
    data: Vec&lt;S&gt;,
    capacity: usize
}

impl&lt;S&gt; BitVector&lt;S&gt;
    where S: Sized + BitAnd&lt;usize&gt; + Not + Eq {
    fn with_capacity(capacity: usize) -&gt; BitVector {
        let len = (capacity / (std::mem::size_of::&lt;S&gt;() * 8)) + 1;
        BitVector { data: vec![0; len], capacity: capacity }
    }
}

impl&lt;S&gt; Index&lt;usize&gt; for BitVector&lt;S&gt;
    where S: Sized + BitAnd&lt;usize&gt; + Not + Eq {
    type Output = bool;

    fn index(&amp;self, index: usize) -&gt; &amp;bool {
        let data_index = index / (std::mem::size_of::&lt;S&gt;() * 8);
        let remainder = index % (std::mem::size_of::&lt;S&gt;() * 8);
        (self.data[data_index] &amp; (1 &lt;&lt; remainder)) != 0
    }
}
</code></pre>

<p>The idea is that <code>S</code> can be one of for example <code>u8</code>, <code>u16</code>, <code>u32</code>, <code>u64</code> and <code>usize</code> to ensure that setting it to <code>0</code> in <code>with_capacity</code> creates a bit value for <code>S</code> that consists of all zeroes.</p>

<p>The error I get is the following:</p>

<blockquote>
  <p>lib.rs:27:10: 27:50 error: binary operation <code>!=</code> cannot be applied to type <code>&lt;S as std::ops::BitAnd&lt;usize&gt;&gt;::Output</code> [E0369]<br>
  lib.rs:27         (self.data[data_index] &amp; (1 &lt;&lt; remainder)) != 0<br>
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
  lib.rs:27:10: 27:50 help: run <code>rustc --explain E0369</code> to see a detailed explanation<br>
  lib.rs:27:10: 27:50 note: an implementation of <code>std::cmp::PartialEq</code> might be missing for <code>&lt;S as std::ops::BitAnd&lt;usize&gt;&gt;::Output</code><br>
  lib.rs:27         (self.data[data_index] &amp; (1 &lt;&lt; remainder)) != 0
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
  error: aborting due to previous error<br>
  error: Could not compile <code>bit-vector</code>.</p>
</blockquote>