Diesel: compile error on deriving `Identifiable`

Created on 27 Dec 2017  ·  3Comments  ·  Source: diesel-rs/diesel

Setup

Versions

  • Rust: rustc 1.23.0-beta.2 (c9107ee93 2017-12-08)
  • Diesel: 1.0.0-rc1
  • Database: sqlite
  • Operating System linux x86_64

Feature Flags

  • diesel: sqlite
  • diesel_codegen:

Problem Description

What are you trying to accomplish?

trying to follow the association documentation https://docs.diesel.rs/diesel/associations/index.html and get a compilation error

What is the expected output?

no build errors

What is the actual output?

   Compiling association_error v0.1.0 (file:///home/qmx/tmp/association_error)
error[E0433]: failed to resolve. Use of undeclared type or module `payees`
  --> src/lib.rs:13:17
   |
13 | #[derive(Debug, Identifiable)]
   |                 ^^^^^^^^^^^^ Use of undeclared type or module `payees`
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to 2 previous errors

error: Could not compile `association_error`.

To learn more, run the command again with --verbose.

Are you seeing any additional errors?

Steps to reproduce

fully reproduceable repo here https://github.com/qmx/diesel-association-error-repro

Checklist

  • [x] I have already looked over the issue tracker for similar issues.

Most helpful comment

You need to ensure that your payees module is in scope, with a line such as use schema::payees; (Assuming that you have your table! or infer_schema! declarations in a module called schema).

All 3 comments

You need to ensure that your payees module is in scope, with a line such as use schema::payees; (Assuming that you have your table! or infer_schema! declarations in a module called schema).

good call, any suggestion on how to make this more obvious at the docs? Happy to put a PR together, as I've read it a handful times and couldn't see.

We mention this in a few other places (I think the associations docs mentions it?) we could probably put that same wording in the docs for Identifiable.

Was this page helpful?
0 / 5 - 0 ratings