title: How can I use a trait implementation from another crate in the original crate?
body: <p>I have a Rust project which divided among several crates in a workspace. One of these crates is a test crate which holds utilities for use in unit and integration tests within the other crates.</p>
  <p>In one crate I define a trait that is implemented by a struct in the test crate. However, when I try to use the struct from the test crate in the original crate which defined the trait, I encounter errors when trying to use the trait's member functions.</p>
  <p>Here is a short example:</p>
  <p>In the <code>project-trait</code> crate:</p>
  <pre class="lang-rust prettyprint-override"><code>trait Trait {
      fn do_something(&amp;self)
  }
  </code></pre>
  <p>In the <code>project-test</code> crate:</p>
  <pre class="lang-rust prettyprint-override"><code>use project_trait::Trait;
  
  pub struct TestObject;
  
  impl Trait for TestObject {
      fn do_something(&amp;self) {
          // ...
      }
  }
  </code></pre>
  <p>Finally, back in the <code>project-trait</code> crate:</p>
  <pre class="lang-rust prettyprint-override"><code>#[cfg(test)]
  mod test {
      use crate::Trait;
      use project_test::TestObject;
  
      #[test]
      fn use_test_object() {
          let object = TestObject;
          object.do_something();
      }
  }
  </code></pre>
  <p>When running <code>cargo test</code> in the <code>project-trait</code> crate, I get error E0599 which says I should import <code>project_trait::Trait</code> to use the <code>do_something</code> method. It seems Rust doesn't see that <code>crate::Trait</code> and <code>project_trait::Trait</code> are the same trait.</p>
  <p>Is there any workaround for this?</p>