diesel: error: cannot find macro `infer_schema!` in this scope

I’m following the tutorial step by step. In “src/schema.rs” I have only this single line:

 infer_schema!("dotenv:DATABASE_URL");

And:

% cargo build
[................]
error: cannot find macro `infer_schema!` in this scope
 --> src/schema.rs:1:1
  |
1 | infer_schema!("dotenv:DATABASE_URL");
  | ^^^^^^^^^^^^

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I asked help on the diesel-rs/diesel and @weiznich came to the rescue.

@weiznich quickly found out that I was missing a macro_use annotation on the extern crate diesel import. In fact, I was missing the entire import. Adding it in, made my problems go away, even without the altered recursion limit.

Ah, I see. You’ll to enable the large-tables (or huge-tables) feature for diesel in your Cargo.toml. (It’s off by default to make diesel compile faster.)