-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Diesel's build is failing on beta and nightly #47139
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
Comments
This is now a regression from stable to beta |
Our build is failing due to a regression in Rust. rust-lang/rust#47139
I have some time now, I can go through and do a bisect to find the cause. |
@shssoichiro Thank you! <3 I'm sorry I haven't provided a more specific reproduction case |
It looks like the regression originated in 8c59418. My first guess at what's happening is that the blanket |
Hmm. Any idea how those two traits are connected? That seems surprising. |
I'd like to dig a bit more into this and understand better what's going on. |
I'm not sure how |
FWIW the impls it appears to be recursing through look like this: impl<T, Tab> Insertable<Tab> for Option<T>
where
T: Insertable<Tab>,
T::Values: Default,
{
// ...
}
impl<'a, T, Tab> Insertable<Tab> for &'a Option<T>
where
Option<&'a T>: Insertable<Tab>,
{
// ...
} |
I'm no longer seeing this on nightly (our builds are still failing due to #47462). The bug was fixed somewhere in b98fd524e...6828cf901 |
I don't see anything in that diff that looks like it could have in any way affected this. |
@sgrif huh, creepy. |
@sgrif but still failing on beta? |
I've noticed that I no longer see the issue on 1.24.0-beta.7 (c7037ff 2018-01-21), so it looks like a recent beta version fixed it. |
beta.7 is still failing on Travis for us. https://travis-ci.org/diesel-rs/diesel/jobs/331917195 |
As is the most recent nightly https://travis-ci.org/diesel-rs/diesel/jobs/331917198 |
This failure seems like it might be a plausible model: https://play.rust-lang.org/?gist=30e5797dec3f425a6d82f1f6a12dc0d0&version=stable |
The play snippet above fails with this:
where diesel fails with:
|
We can simplify by removing the What I don't know is why this failure occurs only sometimes in Diesel (vs predictably for that snippet above). It may be that I'm reproducing a different problem. UPDATE: Looking at the logging more, I'm pretty sure it's the same basic pattern. |
Interesting. I feel like I'm observing a different cycle, though one with a similar shape (I mean locally). I hadn't observed those impls yet. |
So it seems to me that extending the "select-project-recursion" nexus is going to be somewhat intrusive. I haven't pushed too hard on it, but it doesn't sound like the kind of thing I would want to backport. I am going to investigate a bit why this error is not happening on nightly -- I find that confusing. |
This error is definitely happening on nightly. https://travis-ci.org/diesel-rs/diesel/jobs/332968985 |
Digging in some more, the overflow is arising (in Diesel) as a result of a coherence check comparing these two impls:
|
@sgrif Huh. At least in the commit I am looking at, it does not reproduce for some reason. |
@nikomatsakis Yeah, it went away for a bit, then some code in Diesel changed and it came back |
To save time, the way that the first impl applies is through:
The important bit is the
where we know |
Also just to rule this out, the weird shit we do with the second type parameter to diff --git a/diesel/src/query_dsl/load_dsl.rs b/diesel/src/query_dsl/load_dsl.rs
index e3a1ea8..3b502b1 100644
--- a/diesel/src/query_dsl/load_dsl.rs
+++ b/diesel/src/query_dsl/load_dsl.rs
@@ -1,4 +1,3 @@
-use backend::Backend;
use connection::Connection;
use deserialize::Queryable;
use query_builder::{AsQuery, QueryFragment, QueryId};
@@ -38,17 +37,15 @@ where
/// to call `execute` from generic code.
///
/// [`RunQueryDsl`]: ../trait.RunQueryDsl.html
-pub trait ExecuteDsl<Conn: Connection<Backend = DB>, DB: Backend = <Conn as Connection>::Backend>
- : Sized {
+pub trait ExecuteDsl<Conn>: Sized {
/// Execute this command
fn execute(query: Self, conn: &Conn) -> QueryResult<usize>;
}
-impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T
+impl<Conn, T> ExecuteDsl<Conn> for T
where
- Conn: Connection<Backend = DB>,
- DB: Backend,
- T: QueryFragment<DB> + QueryId,
+ Conn: Connection,
+ T: QueryFragment<Conn::Backend> + QueryId,
{
fn execute(query: Self, conn: &Conn) -> QueryResult<usize> {
conn.execute_returning_count(&query) |
And the commit that cause the issue to re-appear is diesel-rs/diesel@8da028e |
OK, I found out how to make it build again in a fairly surgical way. The problem arises in this part of the coherence check, which is really just an effort to make an improved error message: rust/src/librustc/traits/select.rs Lines 1097 to 1099 in ed9751a
The order of the vector returned by One simple fix that is obviously safe for beta backport is just not to do this call at all. |
The scheme was causing overflows during coherence checking (e.g. rust-lang#47139).
Fixed by #47738 |
remove intercrate ambiguity hints The scheme was causing overflows during coherence checking (e.g. #47139). This is sort of a temporary fix; the proper fix I think involves reworking trait selection in deeper ways. cc @sgrif -- this *should* fix diesel cc @qnighy -- I'd like to discuss you with alternative techniques for achieving the same end. =) Actually, it might be good to put some energy into refactoring traits first. r? @eddyb
There appears to be some regression in trait resolution between beta and nightly. Our builds are failing on nightly with this error: https://travis-ci.org/diesel-rs/diesel/jobs/324077372#L1081
I haven't yet looked into what the exact cause is, but the same code is compiling successfully on stable and beta.
The text was updated successfully, but these errors were encountered: