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

Conflicting implementation error after updating to 0.16 from 0.15 #1156

Closed
DmitriK opened this Issue Sep 7, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@DmitriK

DmitriK commented Sep 7, 2017

Setup

Versions

  • Rust: 1.20.0
  • Diesel: 0.16.0
  • Database: sqlite
  • Operating System Arch Linux

Feature Flags

  • diesel: "sqlite"
  • diesel_codegen: "sqlite"

Problem Description

My application builds fine when using diesel 0.15.2 and diesel_codegen 0.15.0. After running cargo update, both were updated to 0.16.0. When I try to build, I get the following error:

error: recursion limit reached while expanding the macro `table_body`
  --> src/db.rs:19:5
   |
19 |     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

OK, do what the compiler says, and add #![recursion_limit="128"] to the crate. Build now fails with:

error[E0119]: conflicting implementations of trait `diesel::JoinTo<db::schema::__diesel_infer_schema::infer_presols::presols::table>` for type `db::schema::__diesel_infer_schema::infer_awards::awards::table`:
  --> src/db.rs:19:5
   |
17 |     infer_schema!("dotenv:DATABASE_URL");
   |     ------------------------------------- first implementation here
18 | 
19 |     joinable!(awards -> presols(presol_id));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `db::schema::__diesel_infer_schema::infer_awards::awards::table`
   |
   = note: this error originates in a macro outside of the current crate

error[E0119]: conflicting implementations of trait `diesel::JoinTo<db::schema::__diesel_infer_schema::infer_awards::awards::table>` for type `db::schema::__diesel_infer_schema::infer_presols::presols::table`:
  --> src/db.rs:19:5
   |
17 |     infer_schema!("dotenv:DATABASE_URL");
   |     ------------------------------------- first implementation here
18 | 
19 |     joinable!(awards -> presols(presol_id));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `db::schema::__diesel_infer_schema::infer_presols::presols::table`
   |
   = note: this error originates in a macro outside of the current crate

error: aborting due to 2 previous errors

Based on older bugs, I tried to add the 'large-tables' feature to diesel, but it does not fix it. Reverting to 0.15* fixes it. In the meantime, I'll just make do by holding the version back, but it doesn't seem right that an update resulted in build failures.

Steps to reproduce

Module triggering error:

mod schema {
    use diesel::Table;

    infer_schema!("dotenv:DATABASE_URL");

    joinable!(awards -> presols(presol_id));
}

Schema:

$ diesel print-schema
table! {
    awards (id) {
        id -> Integer,
        date -> Nullable<Text>,
        awdDate -> Nullable<Text>,
        awdNbr -> Text,
        awardee -> Text,
        url -> Text,
        presol_id -> Integer,
    }
}

table! {
    presols (id) {
        id -> Integer,
        date -> Nullable<Text>,
        subject -> Text,
        description -> Text,
        naics -> Integer,
        url -> Text,
        solnbr -> Text,
        ignored -> Bool,
    }
}

table! {
    scanned_dates (date) {
        date -> Nullable<Text>,
    }
}

Checklist

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

This comment has been minimized.

Member

Eijebong commented Sep 7, 2017

joinable! calls are now inferred by infer_schema!. Just remove it and it should work :)

@DmitriK

This comment has been minimized.

DmitriK commented Sep 7, 2017

Removed joinable! line and it works perfectly. Thank you!

@DmitriK DmitriK closed this Sep 7, 2017

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