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

`infer_schema!` recursion limit reached while expanding the macro `static_cond` #1430

Closed
maueroats opened this Issue Dec 22, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@maueroats

maueroats commented Dec 22, 2017

Setup

Adapting Diesel demo code to access a small database, I was unable to use infer_schema! on an empty database with six (or more) columns. Using the same database with five columns, infer_schema! works fine.

Versions

  • Rust: nightly cargo 0.25.0-nightly (930f9d949 2017-12-05 (same behavior with rust stable)
  • Diesel: 1.0.0-beat1
  • Database: mysql 5.7
  • Operating System linux mint 18.2

Feature Flags

  • diesel: mysql
  • diesel_codegen: none known/set

Problem Description

Following the getting started document, infer_schema! works fine.

With my own database (which I thought was trivial), infer_schema! fails with the following message:

   Compiling dbdemo v0.1.0 (file:///home/user/Rust/dbdemo)
error: recursion limit reached while expanding the macro `static_cond`
 --> src/schema.rs:1:1
  |
1 | infer_schema!("dotenv:DATABASE_URL");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: Could not compile `dbdemo`.

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

The table in question is an empty table created by the following diesel migration run:

CREATE TABLE stations (
  id INT PRIMARY KEY NOT NULL,
  location TEXT NOT NULL,
  city TEXT NOT NULL,
  dpcapacity INT NOT NULL,
  online TEXT NOT NULL,
  evil TEXT NOT NULL
)

If I omit the last line with evil and do diesel migration redo followed by touching the file with the infer_schema!, then cargo build does not fail. Stopped investigating at this point.

What are you trying to accomplish?

Use Diesel to access a small database.

What is the expected output?

Successful compilation.

What is the actual output?

n/a

Are you seeing any additional errors?

no

Steps to reproduce

See above. Let me know if this is not enough to reproduce.

Note that a diesel print-schema works fine, even though infer_schema! does not.

Checklist

  • I have already looked over the issue tracker for similar issues.
@Eijebong

This comment has been minimized.

Member

Eijebong commented Dec 22, 2017

Do what the compiler tells you, add a #![recursion_limit="128"] attribute to your crate

@Eijebong Eijebong closed this Dec 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment