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

multiple applicable items in scope errors when using the new trait solver with diesel #122433

Closed
weiznich opened this issue Mar 13, 2024 · 2 comments
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Comments

@weiznich
Copy link
Contributor

I tried this code: https://github.com/diesel-rs/diesel (diesel-rs/diesel@12429cb)

with the flowing command:

RUSTFLAGS="-Znext-solver" cargo +nightly check -p diesel

I expected to see this happen: Code compiles without error (as without the -Znext-solver flag)

Instead, this happened: Compilation produces error

Long error message
error[E0034]: multiple applicable items in scope
    --> diesel/src/associations/belongs_to.rs:148:71
     |
148  |         FilterDsl::filter(Child::table(), Child::foreign_key_column().eq(parent.id()))
     |                                                                       ^^ multiple `eq` found
     |
note: candidate #1 is defined in the trait `global_expression_methods::ExpressionMethods`
    --> diesel/src/expression_methods/global_expression_methods.rs:71:5
     |
71   | /     fn eq<T>(self, other: T) -> dsl::Eq<Self, T>
72   | |     where
73   | |         Self::SqlType: SqlType,
74   | |         T: AsExpression<Self::SqlType>,
     | |_______________________________________^
note: candidate #2 is defined in the trait `PartialEq`
    --> /home/weiznich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:255:5
     |
255  |     fn eq(&self, other: &Rhs) -> bool;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #3 is defined in the trait `Iterator`
    --> /home/weiznich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:3784:5
     |
3784 | /     fn eq<I>(self, other: I) -> bool
3785 | |     where
3786 | |         I: IntoIterator,
3787 | |         Self::Item: PartialEq<I::Item>,
3788 | |         Self: Sized,
     | |____________________^
help: disambiguate the method for candidate #1
     |
148  |         FilterDsl::filter(Child::table(), global_expression_methods::ExpressionMethods::eq(Child::foreign_key_column(), parent.id()))
     |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
     |
148  |         FilterDsl::filter(Child::table(), PartialEq::eq(&Child::foreign_key_column(), parent.id()))
     |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #3
     |
148  |         FilterDsl::filter(Child::table(), Iterator::eq(Child::foreign_key_column(), parent.id()))
     |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/connection/mod.rs:307:35
    |
307 |         Self::TransactionManager::transaction(self, f)
    |                                   ^^^^^^^^^^^ multiple `transaction` found
    |
note: candidate #1 is defined in the trait `TransactionManager`
   --> diesel/src/connection/transaction_manager.rs:50:5
    |
50  | /     fn transaction<F, R, E>(conn: &mut Conn, callback: F) -> Result<R, E>
51  | |     where
52  | |         F: FnOnce(&mut Conn) -> Result<R, E>,
53  | |         E: From<Error>,
    | |_______________________^
note: candidate #2 is defined in the trait `connection::Connection`
   --> diesel/src/connection/mod.rs:302:5
    |
302 | /     fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
303 | |     where
304 | |         F: FnOnce(&mut Self) -> Result<T, E>,
305 | |         E: From<Error>,
    | |_______________________^
help: use fully-qualified syntax to disambiguate
    |
307 |         <<Self as connection::Connection>::TransactionManager as TransactionManager>::transaction(self, f)
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307 |         connection::Connection::transaction(self, f)
    |         ~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/expression/select_by.rs:106:24
    |
106 |         self.selection.walk_ast(out)
    |                        ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
106 |         column_list::ColumnList::walk_ast(&self.selection, out)
    |
help: disambiguate the method for candidate #2
    |
106 |         query_builder::QueryFragment::walk_ast(&self.selection, out)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/insert_statement/mod.rs:231:30
    |
231 |             self.into_clause.walk_ast(out.reborrow())?;
    |                              ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
231 |             column_list::ColumnList::walk_ast(&self.into_clause, out.reborrow())?;
    |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
    |
231 |             query_builder::QueryFragment::walk_ast(&self.into_clause, out.reborrow())?;
    |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/insert_statement/mod.rs:238:26
    |
238 |         self.into_clause.walk_ast(out.reborrow())?;
    |                          ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
238 |         column_list::ColumnList::walk_ast(&self.into_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
    |
238 |         query_builder::QueryFragment::walk_ast(&self.into_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/nodes/mod.rs:29:29
    |
29  |         T::STATIC_COMPONENT.walk_ast(pass)
    |                             ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
29  |         column_list::ColumnList::walk_ast(&T::STATIC_COMPONENT, pass)
    |
help: disambiguate the method for candidate #2
    |
29  |         query_builder::QueryFragment::walk_ast(&T::STATIC_COMPONENT, pass)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/select_clause.rs:121:32
    |
121 |         self.default_selection.walk_ast(pass)
    |                                ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
121 |         column_list::ColumnList::walk_ast(&self.default_selection, pass)
    |
help: disambiguate the method for candidate #2
    |
121 |         query_builder::QueryFragment::walk_ast(&self.default_selection, pass)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/select_statement/mod.rs:355:37
    |
355 |         self.from.as_query_source().from_clause()
    |                                     ^^^^^^^^^^^ multiple `from_clause` found
    |
note: candidate #1 is defined in the trait `SelectStatementAccessor`
   --> diesel/src/query_builder/select_statement/mod.rs:122:5
    |
122 |     fn from_clause(&self) -> &Self::From;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_source::QuerySource`
   --> diesel/src/query_source/mod.rs:38:5
    |
38  |     fn from_clause(&self) -> Self::FromClause;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
355 |         SelectStatementAccessor::from_clause(&self.from.as_query_source())
    |
help: disambiguate the method for candidate #2
    |
355 |         query_source::QuerySource::from_clause(&self.from.as_query_source())
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_builder/update_statement/mod.rs:208:26
    |
208 |         self.from_clause.walk_ast(out.reborrow())?;
    |                          ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
208 |         column_list::ColumnList::walk_ast(&self.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
    |
208 |         query_builder::QueryFragment::walk_ast(&self.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_dsl/filter_dsl.rs:28:25
    |
28  |         self.as_query().filter(predicate)
    |                         ^^^^^^ multiple `filter` found
    |
note: candidate #1 is defined in the trait `filter_dsl::FilterDsl`
   --> diesel/src/query_dsl/filter_dsl.rs:17:5
    |
17  |     fn filter(self, predicate: Predicate) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `Iterator`
   --> /home/weiznich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:883:5
    |
883 | /     fn filter<P>(self, predicate: P) -> Filter<Self, P>
884 | |     where
885 | |         Self: Sized,
886 | |         P: FnMut(&Self::Item) -> bool,
    | |______________________________________^
help: disambiguate the method for candidate #1
    |
28  |         filter_dsl::FilterDsl::filter(self.as_query(), predicate)
    |
help: disambiguate the method for candidate #2
    |
28  |         Iterator::filter(self.as_query(), predicate)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:24:25
    |
24  |         self.as_query().filter(predicate)
    |                         ^^^^^^ multiple `filter` found
    |
note: candidate #1 is defined in the trait `filter_dsl::FilterDsl`
   --> diesel/src/query_dsl/filter_dsl.rs:17:5
    |
17  |     fn filter(self, predicate: Predicate) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:648:5
    |
648 | /     fn filter<Predicate>(self, predicate: Predicate) -> Filter<Self, Predicate>
649 | |     where
650 | |         Self: methods::FilterDsl<Predicate>,
    | |____________________________________________^
note: candidate #3 is defined in the trait `Iterator`
   --> /home/weiznich/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:883:5
    |
883 | /     fn filter<P>(self, predicate: P) -> Filter<Self, P>
884 | |     where
885 | |         Self: Sized,
886 | |         P: FnMut(&Self::Item) -> bool,
    | |______________________________________^
help: disambiguate the method for candidate #1
    |
24  |         filter_dsl::FilterDsl::filter(self.as_query(), predicate)
    |
help: disambiguate the method for candidate #2
    |
24  |         query_dsl::QueryDsl::filter(self.as_query(), predicate)
    |
help: disambiguate the method for candidate #3
    |
24  |         Iterator::filter(self.as_query(), predicate)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:37:25
    |
37  |         self.as_query().select(selection)
    |                         ^^^^^^ multiple `select` found
    |
note: candidate #1 is defined in the trait `select_dsl::SelectDsl`
   --> diesel/src/query_dsl/select_dsl.rs:19:5
    |
19  |     fn select(self, selection: Selection) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:309:5
    |
309 | /     fn select<Selection>(self, selection: Selection) -> Select<Self, Selection>
310 | |     where
311 | |         Selection: Expression,
312 | |         Self: methods::SelectDsl<Selection>,
    | |____________________________________________^
help: disambiguate the method for candidate #1
    |
37  |         select_dsl::SelectDsl::select(self.as_query(), selection)
    |
help: disambiguate the method for candidate #2
    |
37  |         query_dsl::QueryDsl::select(self.as_query(), selection)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:185:25
    |
185 |         self.as_query().or_filter(predicate)
    |                         ^^^^^^^^^ multiple `or_filter` found
    |
note: candidate #1 is defined in the trait `filter_dsl::OrFilterDsl`
   --> diesel/src/query_dsl/filter_dsl.rs:72:5
    |
72  |     fn or_filter(self, predicate: Predicate) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:697:5
    |
697 | /     fn or_filter<Predicate>(self, predicate: Predicate) -> OrFilter<Self, Predicate>
698 | |     where
699 | |         Self: methods::OrFilterDsl<Predicate>,
    | |______________________________________________^
help: disambiguate the method for candidate #1
    |
185 |         filter_dsl::OrFilterDsl::or_filter(self.as_query(), predicate)
    |
help: disambiguate the method for candidate #2
    |
185 |         query_dsl::QueryDsl::or_filter(self.as_query(), predicate)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:213:25
    |
213 |         self.as_query().limit(limit)
    |                         ^^^^^ multiple `limit` found
    |
note: candidate #1 is defined in the trait `limit_dsl::LimitDsl`
   --> diesel/src/query_dsl/limit_dsl.rs:15:5
    |
15  |     fn limit(self, limit: i64) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:894:5
    |
894 | /     fn limit(self, limit: i64) -> Limit<Self>
895 | |     where
896 | |         Self: methods::LimitDsl,
    | |________________________________^
help: disambiguate the method for candidate #1
    |
213 |         limit_dsl::LimitDsl::limit(self.as_query(), limit)
    |
help: disambiguate the method for candidate #2
    |
213 |         query_dsl::QueryDsl::limit(self.as_query(), limit)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:241:25
    |
241 |         self.as_query().offset(offset)
    |                         ^^^^^^ multiple `offset` found
    |
note: candidate #1 is defined in the trait `offset_dsl::OffsetDsl`
   --> diesel/src/query_dsl/offset_dsl.rs:15:5
    |
15  |     fn offset(self, offset: i64) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:945:5
    |
945 | /     fn offset(self, offset: i64) -> Offset<Self>
946 | |     where
947 | |         Self: methods::OffsetDsl,
    | |_________________________________^
help: disambiguate the method for candidate #1
    |
241 |         offset_dsl::OffsetDsl::offset(self.as_query(), offset)
    |
help: disambiguate the method for candidate #2
    |
241 |         query_dsl::QueryDsl::offset(self.as_query(), offset)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:254:25
    |
254 |         self.as_query().order(expr)
    |                         ^^^^^ multiple `order` found
    |
note: candidate #1 is defined in the trait `order_dsl::OrderDsl`
   --> diesel/src/query_dsl/order_dsl.rs:16:5
    |
16  |     fn order(self, expr: Expr) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:783:5
    |
783 | /     fn order<Expr>(self, expr: Expr) -> Order<Self, Expr>
784 | |     where
785 | |         Expr: Expression,
786 | |         Self: methods::OrderDsl<Expr>,
    | |______________________________________^
help: disambiguate the method for candidate #1
    |
254 |         order_dsl::OrderDsl::order(self.as_query(), expr)
    |
help: disambiguate the method for candidate #2
    |
254 |         query_dsl::QueryDsl::order(self.as_query(), expr)
    |

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/aliasing/dsl_impls.rs:267:25
    |
267 |         self.as_query().then_order_by(expr)
    |                         ^^^^^^^^^^^^^ multiple `then_order_by` found
    |
note: candidate #1 is defined in the trait `order_dsl::ThenOrderDsl`
   --> diesel/src/query_dsl/order_dsl.rs:44:5
    |
44  |     fn then_order_by(self, expr: Expr) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
   --> diesel/src/query_dsl/mod.rs:845:5
    |
845 | /     fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order>
846 | |     where
847 | |         Self: methods::ThenOrderDsl<Order>,
    | |___________________________________________^
help: disambiguate the method for candidate #1
    |
267 |         order_dsl::ThenOrderDsl::then_order_by(self.as_query(), expr)
    |
help: disambiguate the method for candidate #2
    |
267 |         query_dsl::QueryDsl::then_order_by(self.as_query(), expr)
    |

error[E0034]: multiple applicable items in scope
    --> diesel/src/query_source/joins.rs:158:73
     |
158  |                 .append_selection(self.right.source.default_selection().nullable()),
     |                                                                         ^^^^^^^^ multiple `nullable` found
     |
note: candidate #1 is defined in the trait `global_expression_methods::NullableExpressionMethods`
    --> diesel/src/expression_methods/global_expression_methods.rs:540:5
     |
540  |     fn nullable(self) -> dsl::Nullable<Self> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_dsl::QueryDsl`
    --> diesel/src/query_dsl/mod.rs:1382:5
     |
1382 | /     fn nullable(self) -> NullableSelect<Self>
1383 | |     where
1384 | |         Self: methods::SelectNullableDsl,
     | |_________________________________________^
help: disambiguate the method for candidate #1
     |
158  |                 .append_selection(global_expression_methods::NullableExpressionMethods::nullable(self.right.source.default_selection())),
     |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
     |
158  |                 .append_selection(query_dsl::QueryDsl::nullable(self.right.source.default_selection())),
     |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/joins.rs:205:31
    |
205 |         self.left.from_clause.walk_ast(out.reborrow())?;
    |                               ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
205 |         column_list::ColumnList::walk_ast(&self.left.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
    |
205 |         query_builder::QueryFragment::walk_ast(&self.left.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
   --> diesel/src/query_source/joins.rs:208:32
    |
208 |         self.right.from_clause.walk_ast(out.reborrow())?;
    |                                ^^^^^^^^ multiple `walk_ast` found
    |
note: candidate #1 is defined in the trait `column_list::ColumnList`
   --> diesel/src/query_builder/insert_statement/column_list.rs:14:5
    |
14  |     fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `query_builder::QueryFragment`
   --> diesel/src/query_builder/mod.rs:215:5
    |
215 |     fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
    |
208 |         column_list::ColumnList::walk_ast(&self.right.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
    |
208 |         query_builder::QueryFragment::walk_ast(&self.right.from_clause, out.reborrow())?;
    |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Semi-related note: cargo check without the -Znew-solver flag takes 5s. With the new solver it takes significantly longer (2min 6s).

Meta

rustc --version --verbose:

rustc 1.78.0-nightly (a165f1f65 2024-03-12)
binary: rustc
commit-hash: a165f1f65015b1bd4afd2ec50700aaacf2e0c485
commit-date: 2024-03-12
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0
@weiznich weiznich added the C-bug Category: This is a bug. label Mar 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 13, 2024
@fmease fmease added A-trait-system Area: Trait system T-types Relevant to the types team, which will review and decide on the PR/issue. -Znext-solver WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. -Znext-solver labels Mar 13, 2024
@compiler-errors compiler-errors added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 13, 2024
@compiler-errors
Copy link
Member

Fixed by #122317

@weiznich
Copy link
Contributor Author

I can confirm that this bug is fixed 👍

The new solver is still significantly slower than the old one for diesel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

No branches or pull requests

4 participants