rustc version: rustc 1.42.0-nightly (3291ae339 2020-01-15)
.../code/diesel/diesel (master=) ✖ RUSTFLAGS="--cap-lints=warn" cargo +nightly check
Compiling proc-macro2 v1.0.7
Compiling unicode-xid v0.2.0
Compiling syn v1.0.13
Compiling byteorder v1.3.2
Compiling quote v1.0.2
Compiling diesel_derives v1.4.1 (/home/jeb/code/diesel/diesel_derives)
Checking diesel v1.4.3 (/home/jeb/code/diesel/diesel)
warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
(... trimmed many instances of this warning...)
warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
--> diesel/src/migration/errors.rs:108:43
|
108 | write!(f, "Failed with: {}", self.description())
| ^^^^^^^^^^^
error[E0275]: overflow evaluating the requirement `<Self as query_dsl::limit_dsl::LimitDsl>::Output`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0275`.
error: could not compile `diesel`.
To learn more, run the command again with --verbose.
Notably, there is no information about where the error actually is. rustc 1.42.0-nightly (31dd4f4ac 2020-01-13) was fine. I also see a passing CI run on diesel for nightly on commit 8a87b945b27.
EDIT: I did run this test on the master branch of diesel, but I first discovered the problem in diesel 1.4.3.
The same code (diesel 1.4.3) builds fine in stable, so marking as regression.
There is a bisec in the linked diesel issue.
Bisect was able to find 6d0bb91bcba33a70fae4b0c663fb4403ed78f071 as the culprit, but it's a rollup.
Likely #67914 cc @Aaron1011
It looks like we need to run normalization, not just fulfillment, in canonical mode.
I'll open a PR later today
Unfortunately, normalization and projection don't have the equivalent of SelectionContext's "canonical mode" - they always report overflow errors. I'm somewhat hesitant to add such a mode, as I think this would be the only use-case.
The root issue here is that const-prop is very much "best effort" - it's okay to bail out if we're uncertain about something. However, trait selection and projection are very much not "best effort" - if we can't prove something, we tend to need to raise an error to avoid unsoundness. A lot of code is designed around this principle (e.g. normalize does not return a Result).
A minimal example to reproduce is this:
pub trait Query {}
pub trait AsQuery {
type Query: Query;
}
pub trait Table: AsQuery + Sized {}
pub trait LimitDsl {
type Output;
}
pub(crate) trait LoadQuery<Conn, U>: RunQueryDsl<Conn> {}
impl<T: Query> AsQuery for T {
type Query = Self;
}
impl<T> LimitDsl for T
where
T: Table,
T::Query: LimitDsl,
{
type Output = <T::Query as LimitDsl>::Output;
}
pub(crate) trait RunQueryDsl<Conn>: Sized {
fn first<U>(self, _conn: &Conn) -> U
where
Self: LimitDsl,
Self::Output: LoadQuery<Conn, U>,
{
// Overflow is caused by this function body
unimplemented!()
}
}
Please note that this is only reproducible in a library crate, but not in a binary crate (So put it in lib.rs, not in main.rs).
I got this error on diesel 1.4.3 but I guess the difference was I was on rust nightly. Updating rust to nightly 2020-1-25 fixed the issue. spooky
I'm getting this issue while installing the diesel crate on nightly 2020-01-19. Updating to 2020-1-26 fixed the issue.
Most helpful comment
A minimal example to reproduce is this:
Please note that this is only reproducible in a library crate, but not in a binary crate (So put it in lib.rs, not in main.rs).