diff --git a/diesel_compile_tests/tests/fail/invalid_joins.rs b/diesel_compile_tests/tests/fail/invalid_joins.rs new file mode 100644 index 000000000000..0ece4b0289ab --- /dev/null +++ b/diesel_compile_tests/tests/fail/invalid_joins.rs @@ -0,0 +1,68 @@ +extern crate diesel; + +use diesel::*; + +table! { + users { + id -> Integer, + name -> VarChar, + } +} + +table! { + posts { + id -> Integer, + title -> Text, + user_id -> Integer, + } +} + +table! { + comments { + id -> Integer, + user_id -> Integer, + post_id -> Integer, + name -> Text, + } +} + +joinable!(posts -> users (user_id)); +joinable!(comments -> users (user_id)); +joinable!(comments -> posts (post_id)); +allow_tables_to_appear_in_same_query!(posts, users, comments); + +fn main() {} + +fn invalid_inner_joins() { + // This is a valid join + let _ = users::table.inner_join(posts::table); + + // This fails, because we join the same table more than once + let _ = users::table.inner_join(posts::table.inner_join(users::table)); + + // It also fails if we use an explicit on clause + let _ = users::table.inner_join(posts::table.inner_join(users::table.on(posts::user_id.eq(users::id)))); + + // Also if we put the on clause on the first join + let _ = users::table.inner_join(posts::table.on(users::id.eq(posts::user_id)).inner_join(users::table)); + + // it also fails if we join to another subjoin + let _ = users::table.inner_join(comments::table).inner_join(posts::table.inner_join(comments::table)); +} + +fn invalid_left_joins() { + // This is a valid join + let _ = users::table.left_join(posts::table); + + // This fails, because we join the same table more than once + let _ = users::table.left_join(posts::table.left_join(users::table)); + + // It also fails if we use an explicit on clause + let _ = users::table.left_join(posts::table.left_join(users::table.on(posts::user_id.eq(users::id)))); + + // Also if we put the on clause on the first join + let _ = users::table.left_join(posts::table.on(users::id.eq(posts::user_id)).left_join(users::table)); + + // it also fails if we join to another subjoin + let _ = users::table.left_join(comments::table).left_join(posts::table.left_join(comments::table)); +} diff --git a/diesel_compile_tests/tests/fail/invalid_joins.stderr b/diesel_compile_tests/tests/fail/invalid_joins.stderr new file mode 100644 index 000000000000..97d7a562eed1 --- /dev/null +++ b/diesel_compile_tests/tests/fail/invalid_joins.stderr @@ -0,0 +1,493 @@ +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:41:26 + | +41 | let _ = users::table.inner_join(posts::table.inner_join(users::table)); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:41:37 + | +41 | let _ = users::table.inner_join(posts::table.inner_join(users::table)); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:41:26 + | +41 | let _ = users::table.inner_join(posts::table.inner_join(users::table)); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 3 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `diesel::expression::grouped::Grouped, NullableExpression>>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:44:26 + | +44 | let _ = users::table.inner_join(posts::table.inner_join(users::table.on(posts::user_id.eq(users::id)))); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:44:37 + | +44 | let _ = users::table.inner_join(posts::table.inner_join(users::table.on(posts::user_id.eq(users::id)))); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped>>>>, Inner> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:44:26 + | +44 | let _ = users::table.inner_join(posts::table.inner_join(users::table.on(posts::user_id.eq(users::id)))); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 3 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, Inner>>` for `diesel::expression::grouped::Grouped, NullableExpression>>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:47:26 + | +47 | let _ = users::table.inner_join(posts::table.on(users::id.eq(posts::user_id)).inner_join(users::table)); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:47:37 + | +47 | let _ = users::table.inner_join(posts::table.on(users::id.eq(posts::user_id)).inner_join(users::table)); + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `((users::columns::id, users::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (users::columns::id, users::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:47:26 + | +47 | let _ = users::table.inner_join(posts::table.on(users::id.eq(posts::user_id)).inner_join(users::table)); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `diesel::expression::grouped::Grouped>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:50:54 + | +50 | let _ = users::table.inner_join(comments::table).inner_join(posts::table.inner_join(comments::table)); + | ^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `comments::columns::id` + --> tests/fail/invalid_joins.rs:20:1 + | +20 | / table! { +21 | | comments { +22 | | id -> Integer, +23 | | user_id -> Integer, +... | +26 | | } +27 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>>` for `((users::columns::id, users::columns::name), (comments::columns::id, comments::columns::user_id, comments::columns::post_id, comments::columns::name), query_source::joins::private::SkipSelectableExpressionBoundCheckWrapper<((posts::columns::id, posts::columns::title, posts::columns::user_id), (comments::columns::id, comments::columns::user_id, comments::columns::post_id, comments::columns::name))>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, Inner, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:58:26 + | +58 | let _ = users::table.left_join(posts::table.left_join(users::table)); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:58:36 + | +58 | let _ = users::table.left_join(posts::table.left_join(users::table)); + | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:58:26 + | +58 | let _ = users::table.left_join(posts::table.left_join(users::table)); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 3 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `diesel::expression::grouped::Grouped, NullableExpression>>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:61:26 + | +61 | let _ = users::table.left_join(posts::table.left_join(users::table.on(posts::user_id.eq(users::id)))); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:61:36 + | +61 | let _ = users::table.left_join(posts::table.left_join(users::table.on(posts::user_id.eq(users::id)))); + | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped>>>>, LeftOuter> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:61:26 + | +61 | let _ = users::table.left_join(posts::table.left_join(users::table.on(posts::user_id.eq(users::id)))); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 3 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped>>>>, LeftOuter>>` for `diesel::expression::grouped::Grouped, NullableExpression>>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:64:26 + | +64 | let _ = users::table.left_join(posts::table.on(users::id.eq(posts::user_id)).left_join(users::table)); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:64:36 + | +64 | let _ = users::table.left_join(posts::table.on(users::id.eq(posts::user_id)).left_join(users::table)); + | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | | + | required by a bound introduced by this call + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped>>` for `users::table` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter> as AppearsInFromClause>::Count == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:64:26 + | +64 | let _ = users::table.left_join(posts::table.on(users::id.eq(posts::user_id)).left_join(users::table)); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `users::columns::id` + --> tests/fail/invalid_joins.rs:5:1 + | +5 | / table! { +6 | | users { +7 | | id -> Integer, +8 | | name -> VarChar, +9 | | } +10 | | } + | |_^ + = note: 2 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `diesel::expression::grouped::Grouped>` + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped>>` for `SelectStatement>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0271]: type mismatch resolving `>::Output == diesel::query_source::Once` + --> tests/fail/invalid_joins.rs:67:53 + | +67 | let _ = users::table.left_join(comments::table).left_join(posts::table.left_join(comments::table)); + | ^^^^^^^^^ expected struct `MoreThanOnce`, found struct `diesel::query_source::Once` + | +note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `comments::columns::id` + --> tests/fail/invalid_joins.rs:20:1 + | +20 | / table! { +21 | | comments { +22 | | id -> Integer, +23 | | user_id -> Integer, +... | +26 | | } +27 | | } + | |_^ + = note: 3 redundant requirements hidden + = note: required because of the requirements on the impl of `AppearsOnTable, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>>` for `((users::columns::id, users::columns::name), NullableExpression<(comments::columns::id, comments::columns::user_id, comments::columns::post_id, comments::columns::name)>, NullableExpression)>>)` + = note: required because of the requirements on the impl of `QuerySource` for `query_source::joins::Join, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `QuerySource` for `JoinOn, diesel::expression::grouped::Grouped, NullableExpression>>>, SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter>, diesel::expression::grouped::Grouped, NullableExpression>>>` + = note: required because of the requirements on the impl of `InternalJoinDsl, diesel::expression::grouped::Grouped, NullableExpression>>>>>, LeftOuter, diesel::expression::grouped::Grouped, NullableExpression>>>` for `SelectStatement, diesel::expression::grouped::Grouped, NullableExpression>>>>>` + = note: this error originates in the macro `$crate::__diesel_column` which comes from the expansion of the macro `table` (in Nightly builds, run with -Z macro-backtrace for more info)