Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error on deriving Identifiable #1438

Closed
1 task done
qmx opened this issue Dec 27, 2017 · 6 comments
Closed
1 task done

compile error on deriving Identifiable #1438

qmx opened this issue Dec 27, 2017 · 6 comments

Comments

@qmx
Copy link

qmx commented Dec 27, 2017

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

  • I have already looked over the issue tracker for similar issues.
@sgrif
Copy link
Member

sgrif commented Dec 28, 2017

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).

@sgrif sgrif closed this as completed Dec 28, 2017
@qmx
Copy link
Author

qmx commented Dec 28, 2017

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.

@sgrif
Copy link
Member

sgrif commented Dec 28, 2017

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.

HarrisonMc555 added a commit to HarrisonMc555/task-planner-rocket that referenced this issue Jul 25, 2019
Had some problems with macros and derives and stuff. Eventually figured it
out. Issue diesel-rs/diesel#1438 was helpful, although it pointed out that I
hadn't read the documentation very well.
@jblachly
Copy link

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.

Would also be nice in the guide (https://diesel.rs/guides/all-about-updates.html), example code for which puts everything (schema def macro and struct) together in lib.rs so that it is in scope; others following along since the getting started guide likely have the schema def macros in a separate file, which, if not brought in scope, leads to compilation failure as above.

Liking Diesel so far, thanks

@weiznich
Copy link
Member

@jblachly We are happy to receive PR's that improve the guides. See this repository for the website source code.

@jblachly
Copy link

@jblachly We are happy to receive PR's that improve the guides. See this repository for the website source code.

et voila

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants