title: "use of undeclared type or module" when using Diesel's `belongs_to` attribute
body: <p>I'm loosely following Diesel's <a href="https://diesel.rs/guides/getting-started/" rel="noreferrer">getting started</a> guide trying to set up a relational database, but getting the following error on compile:</p>
  
  <pre><code>error[E0433]: failed to resolve: use of undeclared type or module `birds`
   --&gt; src/models.rs:9:12
    |
  9 | pub struct Bird {
    |            ^^^^ use of undeclared type or module `birds`
  
  error: aborting due to previous error
  
  For more information about this error, try `rustc --explain E0433`.
  error: Could not compile `prrr_gql`.
  
  </code></pre>
  
  <p>Here's the binary:</p>
  
  <pre><code>extern crate prrr_gql;
  extern crate diesel;
  
  use self::prrr_gql::*;
  use self::models::*;
  use self::diesel::prelude::*;
  
  fn main() {
      use prrr_gql::schema::cats::dsl::*;
      use prrr_gql::schema::birds::dsl::*;
  
      let connection = establish_connection();
      let results = cats.load::&lt;Cat&gt;(&amp;connection)
          .expect("Error hearding cats");
  
      for cat in results {
          println!("{}", cat.name);
      }
  }
  </code></pre>
  
  <p>and lib.rs (imported as <code>prrr_gql</code>)</p>
  
  <pre><code>#[macro_use]
  extern crate diesel;
  extern crate dotenv;
  
  use diesel::prelude::*;
  use diesel::pg::PgConnection;
  use dotenv::dotenv;
  use std::env;
  
  pub mod schema;
  pub mod models;
  
  pub fn establish_connection() -&gt; PgConnection {
      dotenv().ok();
  
      let database_url = env::var("DATABASE_URL")
          .expect("DATABASE_URL must be set");
  
      PgConnection::establish(&amp;database_url)
          .expect(&amp;format!("Error connecting to {}", database_url))
  }
  </code></pre>
  
  <p>models.rs</p>
  
  <pre><code>#[derive(Queryable, Debug)]
  pub struct Cat {
      pub id: i32,
      pub name: String,
  }
  
  #[derive(Queryable, Associations, Debug)]
  #[belongs_to(Cat)]
  pub struct Bird {
      pub id: i32,
      pub cat_id: i32,
      pub species: String,
      pub colors: String
  }
  </code></pre>
  
  <p>and the schema.rs generated by Diesel</p>
  
  <pre><code>table! {
      birds (id) {
          id -&gt; Int4,
          species -&gt; Varchar,
          colors -&gt; Varchar,
          cat_id -&gt; Nullable&lt;Int4&gt;,
      }
  }
  
  table! {
      cats (id) {
          id -&gt; Int4,
          name -&gt; Varchar,
      }
  }
  
  joinable!(birds -&gt; cats (cat_id));
  
  allow_tables_to_appear_in_same_query!(
      birds,
      cats,
  );
  </code></pre>
  
  <p>The only <a href="https://github.com/diesel-rs/diesel/issues/1438" rel="noreferrer">issue</a> I could find related to this says I need to have <code>birds</code> in scope and references the <code>table!</code> macro that I have provided, so I'm not sure what's missing.</p>
  
  <p>When I comment out everything related to the <code>birds</code> database, everything runs as expected.</p>
  
  <p>Full project with Cargo.toml for reference: <a href="https://github.com/crashspringfield/prrr_gql/tree/diesel-error" rel="noreferrer">https://github.com/crashspringfield/prrr_gql/tree/diesel-error</a></p>